/* ══════════════════════════════════════════════════════════════════════
   QVATUBE — Cuenta / Perfil
   ══════════════════════════════════════════════════════════════════════ */

.menu-btn {
  position: relative; flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2); cursor: pointer;
}
.menu-btn:active { transform: scale(.92); }
.menu-btn.has-alert { border-color: var(--accent); color: var(--accent); }
.menu-btn-badge {
  position: absolute; top: -2px; right: -2px; min-width: 15px; height: 15px;
  padding: 0 3px; border-radius: 8px; background: var(--accent); color: var(--accent-ink);
  font-size: 9.5px; font-weight: 700; line-height: 15px; text-align: center;
  border: 2px solid var(--bg); box-sizing: content-box;
}

/* Dropdown compacto anclado al menu-btn — a diferencia de .auth-panel
   (bottom sheet de pantalla completa), este es chico y cuelga desde el
   botón, pensado para acciones de navegación rápida, no para formularios
   largos. */
.menu-dropdown-overlay {
  position: fixed; inset: 0; background: transparent; z-index: 300;
  opacity: 0; pointer-events: none;
}
.menu-dropdown-overlay.show { opacity: 1; pointer-events: all; }

.menu-dropdown {
  position: fixed; top: calc(var(--header-h, calc(env(safe-area-inset-top, 0px) + var(--safe-top) + 64px)) + 6px); right: 16px; z-index: 301;
  width: 240px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: 0 12px 32px rgba(0,0,0,.45);
  padding: 6px; transform-origin: top right;
  transform: scale(.92) translateY(-6px); opacity: 0; pointer-events: none;
  transition: transform .18s cubic-bezier(.32,.72,0,1), opacity .18s ease;
}
.menu-dropdown.show { transform: scale(1) translateY(0); opacity: 1; pointer-events: all; }

.menu-dropdown-item {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 10px 10px; border-radius: var(--r); background: none; border: none;
  color: var(--text); font-size: 13.5px; font-weight: 500; text-align: left; cursor: pointer;
}
.menu-dropdown-item:active { background: var(--surface-2); }
.menu-dropdown-item svg { flex-shrink: 0; color: var(--text-2); }
.menu-dropdown-item span:not([class]) { flex: 1; }
.menu-dropdown-item-badge {
  flex-shrink: 0; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--accent); color: var(--accent-ink); font-size: 10.5px; font-weight: 700;
  line-height: 17px; text-align: center;
}
.menu-dropdown-sep { height: 1px; background: var(--border); margin: 4px 6px; }

.menu-dropdown-profile { padding: 8px 10px; }
.menu-dropdown-avatar {
  flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%; overflow: hidden;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.menu-dropdown-avatar img { width: 100%; height: 100%; object-fit: cover; }
.menu-dropdown-profile-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.menu-dropdown-name {
  font-size: 13.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.menu-dropdown-sub { font-size: 11px; color: var(--text-2); }

.auth-overlay {
  position: fixed; inset: 0; background: rgba(6,5,4,.7); z-index: 300;
  opacity: 0; pointer-events: none; transition: opacity .25s ease;
}
.auth-overlay.show { opacity: 1; pointer-events: all; }

.auth-panel {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 301; background: var(--surface);
  border-radius: var(--r-lg) var(--r-lg) 0 0; max-height: 88vh; overflow-y: auto;
  transform: translateY(100%); transition: transform .35s cubic-bezier(.32,.72,0,1);
  border-top: 1px solid var(--border); padding: 22px 20px 30px;
}
.auth-panel.show { transform: translateY(0); }

.auth-title { font-family: var(--f-display); font-size: 22px; margin-bottom: 16px; letter-spacing: .5px; }

.auth-field { margin-bottom: 12px; }
.auth-field label {
  display: block; font-size: 11.5px; font-weight: 600; color: var(--text-2);
  text-transform: uppercase; letter-spacing: .4px; margin-bottom: 6px;
}
.auth-field input {
  width: 100%; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 11px 13px; color: var(--text);
  font-family: var(--f-body); font-size: 14px; outline: none;
}
.auth-field input:focus { border-color: var(--accent); }

.auth-btn {
  width: 100%; padding: 13px; border-radius: var(--r); background: var(--accent);
  color: var(--accent-ink); font-weight: 700; font-size: 14.5px; cursor: pointer; margin-top: 6px;
}
.auth-btn:active { transform: scale(.97); }
.auth-btn.secondary { background: transparent; border: 1px solid var(--border); color: var(--text); }
.auth-btn:disabled { opacity: .5; pointer-events: none; }

.auth-error { color: var(--danger); font-size: 12.5px; margin: 8px 0; min-height: 16px; }
.auth-switch { text-align: center; font-size: 12.5px; color: var(--text-3); margin-top: 16px; }
.auth-switch a { color: var(--accent); font-weight: 600; cursor: pointer; }

/* Enlace "Descargar la app Android" en los formularios de login/registro
   (appendApkLink en app.js) — deliberadamente discreto (no es un banner
   con glow como el de Inicio): acá el foco tiene que seguir siendo
   entrar/crear cuenta, esto es solo una salida secundaria para quien ya
   sabe que existe la app. Arranca ausente del DOM (se inserta solo si
   /api/apk-info confirma que el .apk existe), así que no necesita un
   style="display:none" de por medio como el banner. */
.auth-apk-link {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border-soft);
  font-size: 12px; font-weight: 600; color: var(--text-2); cursor: pointer;
}
.auth-apk-link:active { opacity: .65; }
.auth-apk-link svg { color: var(--accent); flex-shrink: 0; }

/* Botón "Explorar como invitado" — deliberadamente el más llamativo de
   todo el gate (gradiente + glow pulsante), porque es la salida "fácil"
   que compite contra crear una cuenta: si no salta a la vista, nadie la
   nota debajo del botón de registro. Vive fuera de .auth-gate-box's
   render dinámico (ver #guestModeBtn en index.html) — no lo toca
   renderAuthForm al cambiar entre login/registro. */
.guest-mode-btn {
  display: block; width: 100%; margin-top: 14px; padding: 13px;
  border: none; border-radius: var(--r); cursor: pointer;
  background: linear-gradient(135deg, #ff3d1a, #ff0844);
  color: #fff; font-family: var(--f-body); font-weight: 800; font-size: 14px; letter-spacing: .2px;
  box-shadow: 0 6px 20px rgba(255,8,68,.45);
  animation: guest-mode-pulse 2.4s ease-in-out infinite;
}
.guest-mode-btn:active { transform: scale(.97); }
@keyframes guest-mode-pulse {
  0%, 100% { box-shadow: 0 6px 20px rgba(255,8,68,.45); }
  50% { box-shadow: 0 6px 28px rgba(255,8,68,.8); }
}

/* ── Perfil ───────────────────────────────────────────────────────────── */
.profile-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border-soft); }
.profile-row:last-of-type { border-bottom: none; }
.profile-label { font-size: 12.5px; color: var(--text-2); }
.profile-value { font-size: 13.5px; font-weight: 600; }
.plan-badge { font-size: 10.5px; font-weight: 700; text-transform: uppercase; padding: 3px 9px; border-radius: 10px; background: var(--surface-2); color: var(--text-2); }
.plan-badge.premium { background: var(--accent-soft); color: var(--accent); }
/* Contador "X días" al lado de la insignia del plan (ver daysRemaining()
   en app.js) — solo aparece si el plan tiene vencimiento (todo menos
   Gratis). Tono neutro a propósito: no compite visualmente con el color
   de plan-badge.premium, es información de apoyo, no la protagonista. */
.plan-value-wrap { display: flex; align-items: center; gap: 6px; }
.days-left-badge { font-size: 10.5px; font-weight: 600; color: var(--text-3); }
/* Switch "Activar/Desactivar notificaciones" (ver initNotifToggle en
   app.js) — track+perilla clásico en vez de un botón-píldora con texto:
   vive DENTRO de un .profile-row, al lado del label, no como una acción
   de página aparte. Gris (var(--surface-2)) apagado, el rojo de marca
   (var(--accent)) prendido — perilla clara siempre, se corre a la
   derecha con transform en vez de reposicionar con left/right (más
   liviano para el navegador que animar layout). */
.switch-toggle {
  position: relative; flex-shrink: 0; width: 44px; height: 24px; padding: 0;
  border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border);
  cursor: pointer; transition: background .18s ease, border-color .18s ease;
}
.switch-toggle-knob {
  position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.35);
  transition: transform .18s cubic-bezier(.32,.72,0,1);
}
.switch-toggle.on { background: var(--accent); border-color: var(--accent); }
.switch-toggle.on .switch-toggle-knob { transform: translateX(20px); }
.switch-toggle:disabled { opacity: .5; cursor: default; }

/* Filas de navegación del perfil ("Mi plan y uso", "Configuraciones") —
   antes esas secciones (cuotas, notificaciones) vivían directo en
   .profile-row del perfil; ahora son paneles aparte (ver
   renderPlanUsageView/renderSettingsView en app.js) y acá solo queda el
   link de entrada, con la misma altura/separador que el resto de las
   filas para que no se note el salto de <div> a <button>. */
.profile-link-row {
  width: 100%; background: none; border: none; padding: 12px 0;
  border-bottom: 1px solid var(--border-soft); display: flex;
  justify-content: space-between; align-items: center; cursor: pointer;
  font-family: var(--f-body); text-align: left;
}
.profile-link-row:last-of-type { border-bottom: none; }
.profile-link-row:active { opacity: .65; }
.profile-link-row .profile-label { display: flex; align-items: center; gap: 6px; }
.profile-link-row .icon-chevronDown { color: var(--text-3); transform: rotate(-90deg); flex-shrink: 0; }

/* ── Referidos ────────────────────────────────────────────────────────── */
/* Campo de código de invitación en el registro — mayúsculas y separación
   entre letras para que se lea como un código, no como texto normal (la
   conversión real a mayúsculas/solo A-Z0-9 la hace el listener 'input' en
   app.js; text-transform acá es solo refuerzo visual instantáneo). */
.invite-code-input {
  text-transform: uppercase; letter-spacing: 3px; font-family: var(--f-mono); text-align: center;
}
.invite-code-input::placeholder { letter-spacing: 3px; opacity: .4; }

.referral-code-box {
  margin: 14px 0; padding: 14px; border-radius: var(--r); background: var(--surface-2);
  border: 1px dashed var(--border);
}
.referral-code-label {
  display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; color: var(--text-2);
  text-transform: uppercase; letter-spacing: .4px; margin-bottom: 8px;
}
.referral-code-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.referral-code-value { font-family: var(--f-mono); font-size: 20px; letter-spacing: 4px; color: var(--accent); font-weight: 700; }
.referral-code-copy {
  flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%; border: none;
  background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.referral-code-copy:active { transform: scale(.9); }
.referral-code-hint { font-size: 10.5px; color: var(--text-3); line-height: 1.5; margin-top: 8px; }

.profile-name-edit { display: flex; align-items: center; gap: 6px; }
.profile-edit-btn {
  width: 22px; height: 22px; border-radius: 50%; border: none; background: var(--surface-2);
  color: var(--text-2); font-size: 11px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
}
.profile-edit-btn:active { transform: scale(.9); }
.profile-name-form { display: flex; align-items: center; gap: 6px; width: 100%; padding: 6px 0; }
.profile-name-form input {
  flex: 1; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 7px 10px; color: var(--text); font-family: var(--f-body); font-size: 13.5px; outline: none; min-width: 0;
}
.profile-name-form input:focus { border-color: var(--accent); }
.profile-name-form button {
  flex-shrink: 0; border: none; border-radius: var(--r-sm); padding: 7px 10px; font-size: 12px; font-weight: 700; cursor: pointer;
}
.profile-name-form .save-btn { background: var(--accent); color: var(--accent-ink); }
.profile-name-form .cancel-btn { background: transparent; border: 1px solid var(--border); color: var(--text-2); }
.profile-name-error { color: var(--danger); font-size: 11px; margin-top: 4px; }

/* ── Foto de perfil (panel "Mi perfil") ──────────────────────────────── */
.profile-avatar-block { display: flex; flex-direction: column; align-items: center; padding-bottom: 14px; border-bottom: 1px solid var(--border-soft); margin-bottom: 4px; }

.profile-avatar-wrap {
  position: relative; width: 84px; height: 84px; border-radius: 50%; flex-shrink: 0;
  background: var(--surface-2); border: 1px solid var(--border);
}
.profile-avatar-img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.profile-avatar-fallback {
  width: 100%; height: 100%; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center; font-size: 30px; font-weight: 700;
}

/* Spinner de "subiendo..." superpuesto al círculo — oculto salvo cuando
   .uploading está presente (ver avatarWrap.classList.add('uploading') en
   app.js), mismo criterio que .mini-player-btn.play.loading. */
.profile-avatar-spinner {
  position: absolute; inset: 0; border-radius: 50%; background: rgba(6,5,4,.6);
  display: none; align-items: center; justify-content: center;
}
.profile-avatar-wrap.uploading .profile-avatar-spinner { display: flex; }
.profile-avatar-wrap.uploading .profile-avatar-spinner .spinner { margin: 0; }

.profile-avatar-camera {
  position: absolute; right: -2px; bottom: -2px; width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); border: 3px solid var(--surface);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.profile-avatar-camera:active { transform: scale(.9); }
.profile-avatar-wrap.uploading .profile-avatar-camera { pointer-events: none; opacity: .5; }

.profile-avatar-remove {
  display: flex; align-items: center; gap: 4px; margin-top: 10px; font-size: 11.5px;
  color: var(--text-3); cursor: pointer; padding: 3px 8px; border-radius: 20px;
}
.profile-avatar-remove:active { transform: scale(.94); }
.profile-avatar-error { color: var(--danger); font-size: 11.5px; margin-top: 8px; text-align: center; min-height: 0; }

.ads-section-title { font-size: 11.5px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .4px; margin: 18px 0 4px; }
.ads-section-hint { font-size: 10.5px; color: var(--text-3); margin-bottom: 8px; }

.link-code-box {
  margin-top: 16px; padding: 14px; border-radius: var(--r); background: var(--surface-2);
  border: 1px dashed var(--border); text-align: center;
}
.link-code-value { font-family: var(--f-mono); font-size: 22px; letter-spacing: 3px; color: var(--accent); margin: 6px 0; }

/* ── Gate obligatorio de registro (pantalla completa) ───────────────────── */
.auth-gate-overlay {
  position: fixed; inset: 0; z-index: 500; background: var(--bg);
  display: none; align-items: center; justify-content: center;
  padding: 40px 20px; overflow-y: auto;
}
.auth-gate-overlay.show { display: flex; }
.auth-gate-box { width: 100%; max-width: 380px; }
.auth-gate-box .auth-title { text-align: center; }
.auth-gate-box .logo { justify-content: center; margin-left: -6px; margin-right: 0; margin-bottom: 20px; }
.auth-gate-box .logo-q { font-size: 28px; }
.auth-gate-box .logo-text { font-size: 26px; }

/* ── Verificación anti-abuso vía Telegram ─────────────────────────────── */
.verify-hint { font-size: 13px; color: var(--text-2); line-height: 1.5; text-align: center; margin: 4px 0 18px; }
.verify-fineprint { font-size: 11.5px; color: var(--text-3); text-align: center; margin-top: 16px; }
.verify-fineprint a { color: var(--accent); font-weight: 600; cursor: pointer; }

.verify-step-icon {
  font-size: 40px; text-align: center; margin: 4px 0 20px;
}
.verify-step-icon.spin { animation: verify-spin 1.6s linear infinite; }
@keyframes verify-spin { to { transform: rotate(360deg); } }

.otp-boxes { display: flex; gap: 8px; justify-content: center; margin: 6px 0 4px; }
.otp-box {
  width: 44px; height: 54px; text-align: center; font-size: 22px; font-weight: 700;
  font-family: var(--f-mono); color: var(--text); background: var(--surface-2);
  border: 1.5px solid var(--border); border-radius: var(--r-sm); outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, transform .05s ease;
}
.otp-box:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.otp-box.shake { animation: verify-shake .35s ease; border-color: var(--danger); }
@keyframes verify-shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}

/* ── Centro de notificaciones (dentro del mismo .auth-panel/#authScroll,
   igual patrón que renderPlansView) ────────────────────────────────── */
.notif-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 10px; }
.notif-header-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.notif-mark-all { background: none; border: none; color: var(--accent); font-size: 11.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
/* Botón "Borrar todas" — solo ícono, junto a "Marcar todas como leídas"
   en la esquina superior derecha del panel. Gris por defecto (acción
   destructiva, no debe llamar más la atención que el resto del header) y
   se pone en rojo (--danger) al pasar el mouse/tocar, para dejar claro
   que borra en vez de solo marcar. */
.notif-clear-all {
  background: none; border: none; color: var(--text-3); cursor: pointer;
  display: flex; align-items: center; justify-content: center; padding: 2px; line-height: 0;
}
.notif-clear-all:hover, .notif-clear-all:active { color: var(--danger); }
.notif-clear-all:disabled { opacity: .4; pointer-events: none; }

/* Aviso "Activa las notificaciones" arriba de la lista — solo se
   renderiza si el navegador soporta push Y el usuario todavía no tiene
   una suscripción activa (ver showPushPromo en renderNotificationsView).
   Mismo switch que Configuraciones (.switch-toggle) para no reinventar
   el control; el fondo/borde en tono de marca es lo que lo distingue
   como algo a lo que conviene prestarle atención, sin ser un modal. */
.notif-push-promo {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px; border-radius: var(--r); background: var(--accent-soft);
  border: 1px solid var(--accent); margin-bottom: 14px;
}
.notif-push-promo-text { flex: 1; min-width: 0; }
.notif-push-promo-title { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; margin-bottom: 3px; }
.notif-push-promo-hint { font-size: 11px; color: var(--text-2); line-height: 1.4; }

.notif-list { display: flex; flex-direction: column; gap: 6px; }
.notif-item {
  display: flex; align-items: flex-start; gap: 10px; width: 100%;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r);
  padding: 12px 14px; text-align: left; cursor: pointer;
}
.notif-item.unread { border-color: var(--accent); background: var(--accent-soft); }
.notif-item-dot {
  flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%; margin-top: 5px;
  background: var(--accent); opacity: 0;
}
.notif-item.unread .notif-item-dot { opacity: 1; }
.notif-item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.notif-item-title { font-size: 13px; font-weight: 700; }
.notif-item-text { font-size: 12px; color: var(--text-2); line-height: 1.45; }
.notif-item-time { font-size: 10.5px; color: var(--text-3); margin-top: 2px; }
.notif-item-thumb {
  flex-shrink: 0; width: 48px; height: 48px; object-fit: cover; border-radius: 8px;
  border: 1px solid var(--border-soft);
}


/* Botones de retorno en los pasos de verificación Telegram.
   Se fijan a la esquina superior izquierda del viewport para no quedar
   desplazados hacia el centro/abajo por el layout vertical del login. */
.auth-back-btn {
  position: fixed;
  top: max(12px, env(safe-area-inset-top, 0px));
  left: max(12px, env(safe-area-inset-left, 0px));
  z-index: 1200;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; margin: 0; padding: 9px 14px;
  border: 1px solid var(--border); border-radius: 999px;
  background: rgba(28, 28, 30, .94); color: var(--text-2);
  font: 600 13px var(--f-body); cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
  -webkit-tap-highlight-color: transparent;
}
.auth-back-btn:active { transform: scale(.97); }
@media (min-width: 700px) {
  .auth-back-btn { top: 20px; left: 20px; }
}
