/* ── Header auth button ───────────────────────────────────────────────────── */

.hdr-auth-btn {
  margin-left: auto;
  background: rgba(139,92,246,0.15);
  border: 1px solid rgba(139,92,246,0.3);
  border-radius: 20px;
  color: #a78bfa;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 14px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.hdr-auth-btn:hover { background: rgba(139,92,246,0.25); border-color: rgba(139,92,246,0.5); }

.hdr-auth-btn--avatar { display:flex;align-items:center;gap:6px;padding:4px 8px 4px 4px }

.hdr-avatar {
  display: inline-flex;
  min-width: 26px;
  height: 26px;
  padding: 0 8px;
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
  border-radius: 13px;
  align-items: center;
  /* flex-start, not center -- centered content clips symmetrically on BOTH
     sides once it's wider than max-width (a long phone number/name), with
     text-overflow:ellipsis never actually kicking in since there's no single
     predictable overflow edge. Left-aligned lets it truncate normally at
     the end, keeping the more identifying start of the text visible. */
  justify-content: flex-start;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.2px;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── User menu wrapper ─────────────────────────────────────────────────────── */
.hdr-user-menu { margin-left:auto;flex-shrink:0 }

/* ── Side panel backdrop ───────────────────────────────────────────────────── */
.usr-panel-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 8998;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(2px);
}
.usr-panel-backdrop--open { display:block }

/* ── Side panel ────────────────────────────────────────────────────────────── */
.usr-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 240px;
  z-index: 8999;
  background: rgba(18,10,35,.97);
  border-left: 1px solid rgba(124,58,237,.3);
  box-shadow: -8px 0 40px rgba(0,0,0,.5);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .25s cubic-bezier(.4,0,.2,1);
  backdrop-filter: blur(16px);
}
.usr-panel--open { transform: translateX(0) }

.usr-panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(124,58,237,.2);
}
.usr-panel-avatar {
  display: inline-flex;
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  background: linear-gradient(135deg,#7c3aed,#5b21b6);
  border-radius: 20px;
  align-items: center;
  /* Same fix as .hdr-avatar -- centered content with overflow:hidden clips
     both sides with no ellipsis; flex-start truncates normally at the end. */
  justify-content: flex-start;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: 0.3px;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.usr-panel-name {
  display: block;
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text, #fff);
  white-space: normal;
  word-break: break-word;
}

.usr-panel-nav { display:flex;flex-direction:column;padding:8px 0 }
.usr-panel-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: none;
  border: none;
  color: #c4b5fd;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background .12s;
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
}
.usr-panel-item:hover { background: rgba(124,58,237,.15) }
.usr-panel-item svg { flex-shrink:0;opacity:.7 }
.usr-panel-item--danger { color:#f87171;margin-top:auto }
.usr-panel-item--danger:hover { background: rgba(248,113,113,.08) }
.usr-panel-item--danger svg { opacity:.7 }

/* ── Profile / Subscriptions pages ───────────────────────────────────────── */

.usr-profile-card {
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(124,58,237,.18);
  border-radius: 16px;
  padding: 20px;
}

.usr-field-label {
  display: block;
  font-size: 11px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase;
  color: rgba(255,255,255,.45); margin-bottom: 8px;
}
.usr-field-input {
  width: 100%; box-sizing: border-box;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 10px;
  padding: 12px 14px;
  color: #fff; font-size: 15px; font-family: var(--font);
  outline: none; transition: border-color .15s;
}
.usr-field-input:focus { border-color: rgba(124,58,237,.7); background: rgba(255,255,255,.09) }
.usr-field-input::placeholder { color: rgba(255,255,255,.25) }
.usr-field-input:disabled { color: rgba(255,255,255,.4); cursor: not-allowed; background: rgba(255,255,255,.03) }
.usr-field-hint { font-size: 12px; color: rgba(255,255,255,.35); margin: 8px 0 20px; line-height: 1.5 }
.usr-change-phone-btn {
  background: none; border: none; padding: 0; margin: 0 0 20px;
  color: #a78bfa; font-size: 12.5px; font-weight: 600; cursor: pointer;
  font-family: inherit;
}
.usr-change-phone-btn:hover { color: #c4b5fd; }

.usr-save-btn {
  width: 100%; padding: 13px;
  background: linear-gradient(135deg,#7c3aed,#5b21b6);
  color: #fff; border: none; border-radius: 12px;
  font-size: 14px; font-weight: 600; cursor: pointer; font-family: var(--font);
  transition: opacity .15s;
}
.usr-save-btn:hover { opacity:.9 }
.usr-save-btn:disabled { opacity:.5; cursor:not-allowed }
.usr-save-msg { font-size: 13px; color: #86efac; margin: 10px 0 0; min-height: 18px; text-align: center }

/* Subscriptions list */
.usr-sub-card {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.usr-sub-card:last-child { margin-bottom: 0 }
.usr-sub-row {
  display: flex; align-items: center; justify-content: space-between;
}
.usr-sub-name { font-size: 13px; color: #c4b5fd; font-weight: 500; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.usr-sub-right { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex-shrink: 0; margin-left: 10px }
.usr-sub-plan {
  font-size: 11px; font-weight: 700; text-transform: capitalize;
  background: rgba(124,58,237,.25); color: #a78bfa;
  padding: 2px 8px; border-radius: 10px;
}
.usr-sub-plan--expired { background: rgba(239,68,68,.15); color: #f87171 }
.usr-sub-expiry { font-size: 11px; color: rgba(255,255,255,.35) }
.usr-sub-expiry--expired { color: #f87171 }
.usr-sub-meta {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.06);
}
.usr-sub-meta-text { font-size: 11px; color: rgba(255,255,255,.35); overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.usr-sub-renew-btn {
  flex-shrink: 0; font-size: 11px; font-weight: 600; color: #c4b5fd;
  background: rgba(124,58,237,.15); border: 1px solid rgba(124,58,237,.3);
  border-radius: 8px; padding: 5px 10px; cursor: pointer; font-family: var(--font);
  transition: background .15s;
}
.usr-sub-renew-btn:hover { background: rgba(124,58,237,.28) }
.usr-no-subs { font-size: 13px; color: rgba(255,255,255,.35); text-align: center; padding: 16px 0 }
.usr-loading { font-size: 13px; color: rgba(255,255,255,.35); text-align: center; padding: 24px 0 }
.usr-buy-bulk-btn {
  display: block; width: 100%; font-size: 13px; font-weight: 700; color: #fff;
  background: linear-gradient(90deg,#7c3aed,#8b5cf6); border: none;
  border-radius: 10px; padding: 11px; cursor: pointer; font-family: var(--font);
  margin-bottom: 14px; transition: opacity .15s;
}
.usr-buy-bulk-btn:hover { opacity: .9 }
/* Stays pinned to the bottom of .mss-body's scroll area as the subscriptions
   list scrolls underneath it -- opaque gradient background already covers
   whatever scrolls behind, no extra backdrop needed. */
.usr-buy-bulk-btn--sticky { position: sticky; bottom: 0; z-index: 2; }

/* ── Login overlay ────────────────────────────────────────────────────────── */

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
  animation: authOverlayIn 0.18s ease;
}
@keyframes authOverlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: #16161f;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: 32px 28px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.6), 0 4px 16px rgba(0,0,0,0.4);
  position: relative;
  margin: auto 0;
}

.auth-dismiss-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: rgba(255,255,255,0.3);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.auth-dismiss-btn:hover { color: rgba(255,255,255,0.7); background: rgba(255,255,255,0.07); }

.auth-logo {
  display: flex;
  align-items: center;
  margin-bottom: 28px;
}
.auth-logo-img { height: 60px; width: auto; max-width: 100%; object-fit: contain; display: block; }

/* Panels */
.auth-panel { animation: authFadeIn 0.22s ease; }
@keyframes authFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.auth-title {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 6px;
  letter-spacing: -0.3px;
}

.auth-sub {
  font-size: 13px;
  color: rgba(255,255,255,0.55);
  margin: 0 0 22px;
  line-height: 1.5;
}

.auth-fields { display: flex; flex-direction: column; gap: 14px; margin-bottom: 18px; }

.auth-fields .field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  margin-bottom: 6px;
}

.auth-fields .field input {
  width: 100%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  padding: 12px 14px;
  color: #fff;
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.auth-fields .field input:focus {
  border-color: rgba(139,92,246,0.7);
  background: rgba(255,255,255,0.1);
}
.auth-fields .field input::placeholder { color: rgba(255,255,255,0.25); }
.auth-fields .field input:-webkit-autofill,
.auth-fields .field input:-webkit-autofill:hover,
.auth-fields .field input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px rgba(255,255,255,0.08) inset;
  box-shadow: 0 0 0 1000px rgba(255,255,255,0.08) inset;
  -webkit-text-fill-color: #fff;
  caret-color: #fff;
  transition: background-color 99999s ease-in-out 0s;
}

.auth-btn {
  width: 100%;
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 14px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 0.15s, transform 0.1s;
}
.auth-btn:active { transform: scale(0.98); opacity: 0.9; }
.auth-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.auth-error {
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  color: #fca5a5;
  margin-bottom: 14px;
}

.google-fallback-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: #fff; color: #1f1f1f;
  border: 1px solid rgba(255,255,255,0.15); border-radius: 12px;
  padding: 14px 20px; font-size: 14px; font-weight: 600;
  cursor: pointer; width: 100%; box-sizing: border-box;
  font-family: inherit; transition: box-shadow 0.15s, background 0.15s, opacity 0.15s, transform 0.1s;
}
.google-fallback-btn:hover { background: #f8f9fa; box-shadow: 0 1px 4px rgba(0,0,0,0.25); }
.google-fallback-btn:active { transform: scale(0.98); opacity: 0.9; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  color: rgba(255,255,255,0.25);
  font-size: 12px;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,0.1);
}

.auth-tos {
  font-size: 11px;
  color: rgba(255,255,255,0.3);
  text-align: center;
  margin: 12px 0 0;
  line-height: 1.5;
}

.auth-skip-link {
  display: block;
  text-align: center;
  font-size: 12px;
  color: rgba(255,255,255,0.45);
  text-decoration: underline;
  margin: 14px 0 0;
}
.auth-skip-link:hover { color: rgba(255,255,255,0.7); }

/* Step 2 — WhatsApp link + QR */
.auth-wa-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  overflow: hidden;
}

.auth-wa-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #25d366;
  color: #fff;
  text-decoration: none;
  border-radius: 12px;
  padding: 13px 18px;
  font-size: 14px;
  font-weight: 600;
  flex: 1;
  min-width: 0;
  transition: opacity 0.15s;
}
.auth-wa-btn:active { opacity: 0.85; }

.auth-qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  max-width: 118px;
}
.auth-qr-wrap > div {
  border-radius: 8px; overflow: hidden; background: #fff; padding: 4px;
  max-width: 100%;
}
.auth-qr-wrap canvas, .auth-qr-wrap img {
  display: block; max-width: 100%; height: auto;
}
.auth-qr-label {
  font-size: 10px;
  color: rgba(255,255,255,0.4);
  text-align: center;
  white-space: nowrap;
}

.auth-manual-hint {
  font-size: 12px;
  color: rgba(255,255,255,0.4);
  margin: 0 0 8px;
}
.auth-manual-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
}
.auth-manual-code {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.auth-copy-btn {
  background: none; border: none; padding: 4px; margin: 0;
  color: rgba(255,255,255,0.4); cursor: pointer;
  display: inline-flex; align-items: center;
  align-self: center; /* row uses align-items:baseline, wrong fit for a button */
  -webkit-tap-highlight-color: transparent;
}
.auth-copy-btn:hover { color: rgba(255,255,255,0.8); }
.auth-manual-to {
  font-size: 12px;
  color: rgba(255,255,255,0.55);
}
.auth-manual-to strong {
  color: rgba(255,255,255,0.85);
  font-weight: 600;
}

.auth-polling {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255,255,255,0.55);
  font-size: 13px;
  margin-bottom: 16px;
}

.auth-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: #a78bfa;
  border-radius: 50%;
  animation: authSpin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes authSpin { to { transform: rotate(360deg); } }

.auth-back-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  margin-top: 4px;
}
.auth-back-btn:hover { color: rgba(255,255,255,0.9); }
.auth-skip-btn {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

/* Step 3 — success */
.auth-success-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

#authPanel3 { text-align: center; }
#authPanel3 .auth-sub { margin-bottom: 24px; }

/* Phone row — must come after .auth-fields .field input to win at equal specificity */
.auth-phone-row { display: flex; gap: 8px; }
select.auth-phone-cc {
  width: 62px; flex-shrink: 0;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15);
  border-radius: 10px; padding: 12px 4px;
  color: #fff; font-size: 13px; font-weight: 600; font-family: inherit;
  outline: none; cursor: pointer; text-align: center;
  -webkit-appearance: none; appearance: none; transition: border-color .15s;
}
select.auth-phone-cc:focus { border-color: rgba(139,92,246,.7); background: rgba(255,255,255,.1); }
.auth-fields .field .auth-phone-row input[type="tel"] {
  flex: 1; width: 0; min-width: 0;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15);
  border-radius: 10px; padding: 12px 14px; color: #fff; font-size: 15px;
  outline: none; font-family: inherit; box-sizing: border-box; transition: border-color .15s;
}
.auth-fields .field .auth-phone-row input[type="tel"]::placeholder { color: rgba(255,255,255,.25); }
.auth-fields .field .auth-phone-row input[type="tel"]:focus { border-color: rgba(139,92,246,.7); background: rgba(255,255,255,.1); }
.auth-fields .field .auth-phone-row input[type="tel"]:-webkit-autofill,
.auth-fields .field .auth-phone-row input[type="tel"]:-webkit-autofill:hover,
.auth-fields .field .auth-phone-row input[type="tel"]:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px rgba(255,255,255,0.08) inset;
  box-shadow: 0 0 0 1000px rgba(255,255,255,0.08) inset;
  -webkit-text-fill-color: #fff;
  caret-color: #fff;
  transition: background-color 99999s ease-in-out 0s;
}
/* Locked when Publish already has a phone from Contact Details -- see
   _showAuthOverlay() in auth.js. */
select.auth-phone-cc:disabled,
.auth-fields .field .auth-phone-row input[type="tel"]:disabled {
  opacity: .55; cursor: not-allowed;
}
.auth-phone-hint {
  font-size: 11px; color: rgba(255,255,255,0.4); margin: 6px 0 0; line-height: 1.4;
}
