/* =====================================================
   subscriber.css
   Shared styles for the Subscriber self-service portal.
   CSS variables are set at runtime by subscriber.js
   from the BRAND config in each PHP file.
===================================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --ink:      #0a0a0f;
  --paper:    #f5f3ee;
  --accent:   #c8f135;
  --blob2:    #b8e0ff;
  --muted:    #7a7a8a;
  --border:   #e0ddd5;
  --card:     #ffffff;
  --radius:   18px;
}

html, body {
  min-height: 100%;
  font-family: 'Manrope', sans-serif;
  background: var(--paper);
  color: var(--ink);
}

/* ── grain ── */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  opacity: .032;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px;
}

/* ── blobs ── */
.blob { position: fixed; border-radius: 50%; filter: blur(90px); opacity: .45; pointer-events: none; z-index: 0; }
.blob-1 { width: 520px; height: 520px; background: var(--accent); top: -160px; right: -160px; animation: drift 9s ease-in-out infinite alternate; }
.blob-2 { width: 380px; height: 380px; background: var(--blob2); bottom: -120px; left: -100px; animation: drift 12s ease-in-out infinite alternate-reverse; }
@keyframes drift { from { transform: translate(0,0) scale(1); } to { transform: translate(30px,20px) scale(1.06); } }

/* ── page wrapper ── */
.sub-page {
  position: relative; z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
}

/* wide layout for table page */
.sub-page.wide {
  align-items: flex-start;
  padding-top: 48px;
}

/* ══════════════════════════════════════
   CARD (used on index, user password, edit)
══════════════════════════════════════ */
.sub-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 44px 44px 40px;
  width: 100%;
  max-width: 480px;
  box-shadow:
    0 2px 4px rgba(0,0,0,.04),
    0 12px 40px rgba(0,0,0,.08),
    0 0 0 1px rgba(255,255,255,.6) inset;
  animation: rise .5s cubic-bezier(.22,.9,.36,1) both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── logo ── */
.sub-logo-wrap { margin-bottom: 32px; }
.sub-logo-wrap img { display: block; max-height: 56px; width: auto; }

/* ── pill ── */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--accent);
  color: var(--ink);
  font-size: .72rem; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase;
  padding: 3px 10px 3px 8px;
  border-radius: 99px;
  margin-bottom: 14px;
}
.pill-dot { width: 6px; height: 6px; background: var(--ink); border-radius: 50%; }

/* ── headings ── */
.sub-card h1 {
  font-family: 'Manrope', sans-serif;
  font-size: clamp(1.6rem, 5vw, 1.95rem);
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.1;
  color: var(--ink);
  margin-bottom: 6px;
}
.sub-card .sub {
  font-size: .88rem;
  color: var(--muted);
  font-weight: 400;
  margin-bottom: 28px;
  line-height: 1.5;
}
.sub-card .sub strong { color: var(--ink); font-weight: 600; }

/* ── section heading (wide layout) ── */
.sub-section-title {
  font-family: 'Manrope', sans-serif;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -.02em;
  color: var(--ink);
  margin-bottom: 4px;
}
.sub-section-desc {
  font-size: .85rem;
  color: var(--muted);
  margin-bottom: 24px;
}

/* ── fields ── */
.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 7px;
}
.input-wrap { position: relative; }
.input-wrap .icon {
  position: absolute;
  left: 14px; top: 50%; transform: translateY(-50%);
  color: #bbb; pointer-events: none;
  display: flex; align-items: center;
  transition: color .2s;
}
.input-wrap:has(input:focus) .icon { color: var(--ink); }

input[type="text"],
input[type="email"],
input[type="password"] {
  width: 100%;
  height: 50px;
  padding: 0 14px 0 42px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: #fafaf8;
  font-family: 'Manrope', sans-serif;
  font-size: .92rem;
  color: var(--ink);
  outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
input[type="text"]:not(.has-icon),
input[type="email"]:not(.has-icon) {
  padding-left: 14px;
}
input::placeholder { color: #c0bdb5; }
input:focus {
  border-color: var(--ink);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(10,10,15,.06);
}

/* password toggle */
.toggle-pw {
  position: absolute;
  right: 14px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: #bbb; padding: 4px; line-height: 0;
  transition: color .2s;
}
.toggle-pw:hover { color: var(--ink); }

/* select */
select {
  width: 100%;
  height: 50px;
  padding: 0 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: #fafaf8;
  font-family: 'Manrope', sans-serif;
  font-size: .92rem;
  color: var(--ink);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 7L11 1' stroke='%237a7a8a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
}
select:focus {
  border-color: var(--ink);
  background-color: #fff;
  box-shadow: 0 0 0 4px rgba(10,10,15,.06);
}

/* select danger variant */
select.select-danger {
  border-color: #f5c6c6;
  color: #c0392b;
}
select.select-danger:focus { border-color: #c0392b; box-shadow: 0 0 0 4px rgba(192,57,43,.08); }

/* ── buttons ── */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  height: 52px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 13px;
  font-family: 'Manrope', sans-serif;
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: -.01em;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform .15s, box-shadow .15s;
}
.btn-primary::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.12) 0%, transparent 60%);
  pointer-events: none;
}
.btn-primary:hover  { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.btn-primary:active { transform: none; box-shadow: none; }

.btn-primary .ripple {
  position: absolute; border-radius: 50%;
  background: rgba(255,255,255,.25);
  transform: scale(0);
  animation: ripple-out .5s linear;
  pointer-events: none;
}
@keyframes ripple-out { to { transform: scale(4); opacity: 0; } }

.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px;
  height: 40px;
  padding: 0 16px;
  background: rgba(10,10,15,.06);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: 'Manrope', sans-serif;
  font-size: .82rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  transition: border-color .15s, color .15s, background .15s;
}
.btn-ghost:hover { border-color: var(--ink); color: var(--ink); background: rgba(10,10,15,.1); }

.btn-danger {
  display: inline-flex; align-items: center; gap: 6px;
  height: 40px;
  padding: 0 16px;
  background: transparent;
  border: 1.5px solid #f5c6c6;
  border-radius: 10px;
  font-family: 'Manrope', sans-serif;
  font-size: .82rem;
  font-weight: 600;
  color: #c0392b;
  cursor: pointer;
  text-decoration: none;
  transition: border-color .15s, background .15s;
}
.btn-danger:hover { border-color: #c0392b; background: #fde8e8; }

.btn-row {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* ── error / success messages ── */
.field.error {
  font-size: .84rem; font-weight: 500;
  color: #c0392b;
  background: #fde8e8;
  border: 1px solid #f5c6c6;
  border-radius: 10px;
  padding: 10px 14px;
}
.error {
  color: #c0392b;
}
.field.success {
  font-size: .84rem; font-weight: 500;
  color: #16a34a;
  background: #e8fdf0;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  padding: 10px 14px;
}
.field.info {
  font-size: .84rem; font-weight: 500;
  color: #1d4ed8;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 10px 14px;
  line-height: 1.5;
}

/* ── card footer link ── */
.sub-card-footer {
  margin-top: 24px;
  text-align: center;
  font-size: .82rem;
  color: var(--muted);
}
.sub-card-footer a {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid var(--ink);
  transition: opacity .2s;
}
.sub-card-footer a:hover { opacity: .6; }

/* ══════════════════════════════════════
   WIDE LAYOUT — data table page
══════════════════════════════════════ */
.sub-wide {
  position: relative; z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 24px 64px;
  animation: rise .5s cubic-bezier(.22,.9,.36,1) both;
}

/* ── top bar ── */
.sub-topbar {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap; gap: 12px;
}

/* ── data table card ── */
.sub-table-card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
}

.sub-table-card table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
}

.sub-table-card thead th {
  padding: 13px 18px;
  text-align: left;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  background: rgba(10,10,15,.025);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.sub-table-card tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.sub-table-card tbody tr:last-child { border-bottom: none; }
.sub-table-card tbody tr:hover { background: rgba(10,10,15,.025); }

.sub-table-card tbody td {
  padding: 13px 18px;
  color: var(--ink);
  vertical-align: middle;
}

.sub-table-card .empty-state {
  padding: 40px 18px;
  text-align: center;
  color: var(--muted);
  font-size: .88rem;
}

/* ── marketing badge ── */
.badge-opted-in  { display: inline-flex; align-items: center; gap: 5px; font-size: .72rem; font-weight: 700; color: #16a34a; background: #e8fdf0; border-radius: 99px; padding: 2px 9px; }
.badge-opted-out { display: inline-flex; align-items: center; gap: 5px; font-size: .72rem; font-weight: 700; color: var(--muted); background: rgba(10,10,15,.06); border-radius: 99px; padding: 2px 9px; }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.badge-opted-in  .badge-dot { background: #16a34a; }
.badge-opted-out .badge-dot { background: var(--muted); }

/* edit link in table */
.table-edit-link {
  font-size: .78rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: border-color .15s;
  white-space: nowrap;
}
.table-edit-link:hover { border-color: var(--ink); }

/* ── mobile scroll ── */
.sub-table-scroll { overflow-x: auto; }

/* ══════════════════════════════════════
   VERIFY PAGE — full-page centred
══════════════════════════════════════ */
.verify-page {
  position: relative; z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
}

.verify-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 52px 48px 44px;
  width: 100%;
  max-width: 520px;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0,0,0,.04), 0 12px 40px rgba(0,0,0,.08);
  animation: rise .5s cubic-bezier(.22,.9,.36,1) both;
}

.verify-icon {
  width: 64px; height: 64px;
  border-radius: 50%;
  display: grid; place-items: center;
  margin: 0 auto 20px;
}
.verify-icon.success { background: #e8fdf0; color: #16a34a; }
.verify-icon.error   { background: #fde8e8; color: #c0392b; }

.verify-card h1 {
  font-family: 'Manrope', sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--ink);
  margin-bottom: 12px;
}
.verify-card p {
  font-size: .92rem;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 28px;
}

/* social links */
.verify-social {
  display: flex; align-items: center; justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.verify-social a {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  color: var(--muted);
  text-decoration: none;
  transition: border-color .15s, color .15s, background .15s;
}
.verify-social a:hover { border-color: var(--ink); color: var(--ink); background: rgba(10,10,15,.04); }

/* redirect countdown */
.verify-redirect {
  font-size: .78rem;
  color: var(--muted);
  margin-top: 20px;
}

/* ══════════════════════════════════════
   MOBILE
══════════════════════════════════════ */
@media (max-width: 540px) {
  .sub-card { padding: 32px 22px 28px; }
  .verify-card { padding: 36px 22px 32px; }
  .sub-wide { padding: 32px 16px 48px; }
}

/* ── Table search bar ── */
.sub-table-search-wrap {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.sub-table-search-wrap svg { color: var(--muted); flex-shrink: 0; }
.sub-table-search {
  flex: 1; border: none; background: transparent; outline: none;
  font-family: 'Manrope', sans-serif; font-size: .88rem; color: var(--ink);
}
.sub-table-search::placeholder { color: #c0bdb5; }
.sub-table-count {
  font-size: .75rem; color: var(--muted); flex-shrink: 0; white-space: nowrap;
}

/* ── Sortable column headers ── */
.sub-table-card thead th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.sub-table-card thead th.sortable:hover { color: var(--ink); }

.sort-icon {
  display: inline-flex; flex-direction: column;
  gap: 1px; margin-left: 5px; vertical-align: middle; opacity: .35;
}
.sort-icon span {
  display: block; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent;
}
.sort-icon span.asc  { border-bottom: 4px solid currentColor; }
.sort-icon span.desc { border-top:    4px solid currentColor; }

th.sort-asc  .sort-icon { opacity: 1; }
th.sort-asc  .sort-icon .desc { opacity: .25; }
th.sort-desc .sort-icon { opacity: 1; }
th.sort-desc .sort-icon .asc  { opacity: .25; }

/* ── No results row ── */
.no-results td {
  padding: 32px 18px;
  text-align: center;
  color: var(--muted);
  font-size: .88rem;
}