/* Roya TV — sign-in & account (public/js/account.js). Full-screen sheet on phones, centred card on desktop.
   Provider buttons follow each provider's brand rules (Google: white + multicolour G; Apple: black + Apple
   logo; Microsoft: white + four squares). Everything is scoped to .ra-* so app.css stays untouched. */

.account-overlay.ra-overlay {
  background:
    radial-gradient(60% 50% at 50% 0%, rgba(225, 29, 42, 0.22), transparent 70%),
    rgba(3, 4, 7, 0.82);
  backdrop-filter: blur(10px) saturate(1.1);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
}

.auth-card.ra-card {
  width: min(440px, 100%);
  padding: 40px 32px 28px;
  gap: 14px;
  border-radius: 28px;
  background: linear-gradient(180deg, #10131b 0%, #0a0c12 60%);
  border: 1px solid var(--line-2);
  box-shadow: 0 50px 140px -30px #000, 0 0 0 1px rgba(255, 255, 255, 0.02) inset, 0 -30px 90px -50px var(--red-glow);
  overflow: hidden;
  isolation: isolate;
}
.auth-card.ra-card::before { /* red glow behind the leaf */
  content: ""; position: absolute; z-index: -1; inset-inline: 0; top: -120px; height: 300px; pointer-events: none;
  background: radial-gradient(50% 50% at 50% 50%, rgba(225, 29, 42, 0.32), transparent 70%);
}
.auth-card.ra-card > * { flex-shrink: 0; }
.auth-card.ra-small { width: min(400px, 100%); }

.ra-close {
  position: absolute; top: 14px; inset-inline-end: 14px; z-index: 3;
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  color: var(--text-2); background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line);
  transition: background 0.2s var(--ease), color 0.2s;
}
.ra-close:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.ra-close svg { width: 18px; height: 18px; }

.ra-brand { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 2px; }
.ra-logo { filter: drop-shadow(0 8px 26px rgba(225, 29, 42, 0.55)); }
.ra-word { font-weight: 800; font-size: 1.35rem; letter-spacing: 0.01em; display: flex; align-items: baseline; gap: 6px; }
.ra-word small { font-size: 0.68rem; font-weight: 600; letter-spacing: 0.24em; color: var(--text-3); }

.ra-title { margin: 0; font-size: clamp(1.35rem, 1.1rem + 0.8vw, 1.65rem); font-weight: 700; text-align: center !important; }
.ra-sub { margin: -4px 0 2px; color: var(--text-3); font-size: var(--fs-s); text-align: center; line-height: 1.7; }

/* tabs */
.ra-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; gap: 4px; border-radius: 14px; background: var(--ink-0); border: 1px solid var(--line); }
.ra-tabs button { min-height: 40px; border-radius: 10px; font-weight: 600; font-size: var(--fs-s); color: var(--text-3); transition: background 0.2s var(--ease), color 0.2s; }
.ra-tabs button[aria-selected="true"] { background: var(--ink-3); color: #fff; box-shadow: 0 0 0 1px var(--line-2) inset, 0 6px 18px -10px #000; }
.ra-tabs button:not([aria-selected="true"]):hover { color: var(--text); }

/* provider buttons */
.ra-providers { display: grid; gap: 12px; margin-top: 6px; }
.ra-prov {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 12px;
  min-height: 48px; padding: 0 16px; border-radius: 12px; font-size: 15px; font-weight: 500;
  text-decoration: none; transition: transform 0.15s var(--ease), box-shadow 0.2s, filter 0.2s;
}
.ra-prov:active { transform: scale(0.985); }
.ra-prov:focus-visible { outline: 2px solid var(--red-2); outline-offset: 2px; }
.ra-prov-txt { white-space: nowrap; }
.ra-prov-logo { display: grid; place-items: center; flex: none; width: 20px; height: 20px; }
.ra-prov.loading { pointer-events: none; filter: saturate(0.6) brightness(0.9); }
.ra-prov.loading .ra-prov-logo { animation: raPulse 0.9s ease-in-out infinite; }
/* Google: white fill, #747775 stroke, #1F1F1F text */
.ra-google { background: #fff; color: #1f1f1f; border: 1px solid #747775; font-family: Roboto, var(--font); }
.ra-google:hover { box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15); background: #f8f9fa; }
/* Apple: black fill, white logo + text (outlined so it reads on the dark card) */
.ra-apple { background: #000; color: #fff; border: 1px solid rgba(255, 255, 255, 0.42); font-family: -apple-system, "SF Pro Text", var(--font); font-weight: 600; }
.ra-apple:hover { background: #111; }
/* Microsoft: white fill, #8C8C8C stroke, #5E5E5E text */
.ra-microsoft { background: #fff; color: #5e5e5e; border: 1px solid #8c8c8c; font-family: "Segoe UI", var(--font); font-weight: 600; }
.ra-microsoft:hover { background: #f3f3f3; }
.ra-devtag { /* corner badge, so it never squeezes the provider's label */
  position: absolute; top: -8px; inset-inline-end: 10px; font-size: 10px; font-weight: 700; line-height: 1; padding: 4px 7px; border-radius: 99px;
  background: var(--gold); color: #1a0d00; font-family: var(--font); letter-spacing: 0;
}

.ra-or { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: var(--fs-xs); margin: 4px 0 -2px; }
.ra-or::before, .ra-or::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }

/* form */
.ra-form { display: grid; gap: 12px; }
.ra-field { display: grid; gap: 6px; }
.ra-field label { font-size: var(--fs-xs); color: var(--text-2); font-weight: 500; }
.ra-field input {
  width: 100%; min-height: 50px; padding: 0 14px; border-radius: 12px; font: inherit; font-size: 16px; /* 16px: no iOS zoom */
  color: var(--text); background: var(--ink-0); border: 1px solid var(--line-2); outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.ra-field input:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(225, 29, 42, 0.25); }
.ra-field input[dir="ltr"] { text-align: left; }
.ra-field input[dir="ltr"]::placeholder { text-align: left; }
.ra-pw { position: relative; }
.ra-pw input { padding-right: 52px; }
.ra-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 44px; height: 42px; border-radius: 10px; display: grid; place-items: center; color: var(--text-3); }
.ra-eye:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.ra-eye svg { width: 19px; height: 19px; }
.ra-hint { margin: -4px 0 0; font-size: var(--fs-xs); color: var(--text-3); }
.ra-link { color: var(--text-2); font-size: var(--fs-s); font-weight: 500; justify-self: start; }
.ra-link:hover { color: #fff; text-decoration: underline; }
.ra-forgot { margin-top: -4px; }
.ra-back { justify-self: center; display: inline-flex; align-items: center; gap: 6px; }
.ra-back svg { width: 16px; height: 16px; }
[dir="ltr"] .ra-back svg { transform: scaleX(-1); }

.ra-err { font-size: var(--fs-s); color: #ffd3d6; background: rgba(225, 29, 42, 0.12); border: 1px solid rgba(255, 59, 71, 0.35); border-radius: 12px; padding: 10px 12px; line-height: 1.6; }
.ra-err[hidden] { display: none; }

.ra-submit {
  position: relative; width: 100%; min-height: 52px; border-radius: 14px; font-weight: 700; font-size: 1rem; color: #fff;
  background: linear-gradient(180deg, #ef2a37, var(--red)); box-shadow: 0 14px 34px -14px var(--red-glow), 0 1px 0 rgba(255, 255, 255, 0.18) inset;
  display: flex; align-items: center; justify-content: center; transition: filter 0.2s, transform 0.15s var(--ease);
}
.ra-submit:hover { filter: brightness(1.08); }
.ra-submit:active { transform: scale(0.99); }
.ra-submit:disabled { cursor: progress; }
.ra-submit-danger { background: linear-gradient(180deg, #b3141f, #8f0f18); }
.ra-spin { position: absolute; width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid rgba(255, 255, 255, 0.35); border-top-color: #fff; opacity: 0; }
.ra-submit.loading .ra-spin { opacity: 1; animation: raSpin 0.7s linear infinite; }
.ra-submit.loading .ra-submit-txt { opacity: 0; }

.ra-legal { margin: 2px 0 0; text-align: center; font-size: var(--fs-xs); color: var(--text-3); line-height: 1.7; }
.ra-legal a, .ra-danger a { color: var(--text-2); text-decoration: underline; text-underline-offset: 3px; }
.ra-legal a:hover { color: #fff; }
.ra-devnote { display: flex; gap: 8px; align-items: flex-start; margin: 0; font-size: var(--fs-xs); line-height: 1.6; color: #f6d79a; background: rgba(242, 181, 68, 0.08); border: 1px dashed rgba(242, 181, 68, 0.45); padding: 9px 12px; border-radius: 12px; }
.ra-devnote svg { flex: none; width: 15px; height: 15px; margin-top: 2px; }
.ra-done { display: grid; justify-items: center; gap: 10px; text-align: center; color: var(--text-2); }
.ra-done > svg { width: 40px; height: 40px; color: var(--ok); }
.ra-done p { margin: 0; line-height: 1.7; }

@keyframes raSpin { to { transform: rotate(360deg); } }
@keyframes raPulse { 50% { opacity: 0.4; } }
@media (prefers-reduced-motion: reduce) { .ra-submit.loading .ra-spin, .ra-prov.loading .ra-prov-logo { animation-duration: 2s; } }

/* phones: full-screen sheet */
@media (max-width: 600px) {
  .account-overlay.ra-overlay { padding: 0; place-items: stretch; }
  .auth-card.ra-card {
    width: 100%; min-height: 100vh; min-height: 100dvh; margin: 0; border-radius: 0; border: 0;
    padding: calc(56px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom));
    justify-content: safe center;
  }
  .ra-close { top: calc(12px + env(safe-area-inset-top)); }
}

/* avatars (header button + account page) */
.avatar-btn .ra-avatar-img, .ra-avatar .ra-avatar-img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; background: var(--ink-3); }
.ra-avatar { position: relative; flex: none; }

/* account page */
.ra-account .ra-acct-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 28px var(--gutter) 8px; }
.ra-acct-id { flex: 1; min-width: 0; }
.ra-acct-id .page-title { font-size: var(--fs-l); margin: 0; overflow-wrap: anywhere; }
.ra-acct-id .page-sub { margin: 2px 0 0; text-align: start; overflow-wrap: anywhere; }
[dir="rtl"] .ra-acct-id .page-sub { text-align: right; }
.ra-since { margin: 4px 0 0; font-size: var(--fs-xs); color: var(--text-3); }
.ra-inline { display: flex; gap: 8px; }
.ra-inline input { min-height: 44px; font-size: 15px; }
.ra-profile .ra-field input { min-height: 44px; }
.ra-methods { display: grid; gap: 8px; }
.ra-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ra-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 99px; font-size: var(--fs-xs); background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); color: var(--text-2); }
.ra-chip svg { width: 13px; height: 13px; color: var(--ok); }
.ra-danger .ra-del { color: #ff8a92; justify-self: start; }
.ra-danger .ra-del:hover { color: #fff; background: rgba(225, 29, 42, 0.18); }
.auth-card:focus { outline: none; }
