/* Portal: mobile-first companion of the TV app, same identity (tokens.css). */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(900px 480px at 100% -10%, var(--ns-red-soft), transparent 60%),
        var(--ns-bg);
    color: var(--ns-text);
    font-family: var(--ns-font);
    font-size: 16px;
    line-height: 1.6;
    padding-bottom: calc(84px + env(safe-area-inset-bottom));
}

a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }

:focus-visible { outline: none; box-shadow: var(--ns-focus-ring); border-radius: var(--ns-radius-sm); }

.container {
    width: min(100%, 980px);
    margin: 0 auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ---------- Top bar ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    padding-top: calc(12px + env(safe-area-inset-top));
    background: rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--ns-border);
}

.brand {
    font-family: var(--ns-font-logo);
    font-size: 30px;
    letter-spacing: 1.5px;
    color: var(--ns-red);
    text-decoration: none;
    line-height: 1;
}

.topnav { display: none; gap: 4px; margin-inline-start: 16px; }
.topnav .nav-link {
    text-decoration: none;
    padding: 8px 14px;
    border-radius: var(--ns-radius-control);
    color: var(--ns-text-muted);
    font-weight: 700;
}
.topnav .nav-link.active { color: var(--ns-text); background: var(--ns-surface-2); }

.lang-btn {
    margin-inline-start: auto;
    background: var(--ns-surface-2);
    border: 1px solid var(--ns-border);
    border-radius: var(--ns-radius-control);
    padding: 6px 14px;
    cursor: pointer;
    font-weight: 700;
    min-height: 40px;
}

/* ---------- Bottom tab bar (phones) ---------- */
.tabbar {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: end;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: rgba(10, 10, 10, 0.94);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--ns-border);
}

.tabbar .nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    text-decoration: none;
    color: var(--ns-text-faint);
    font-size: 12px;
    font-weight: 700;
    min-height: 52px;
    justify-content: center;
}

.tabbar .nav-link.active { color: var(--ns-text); }
.tabbar .nav-link.active .tab-icon { color: var(--ns-red); }
.tab-icon { font-size: 20px; line-height: 1; }

.tab-icon-main {
    width: 54px;
    height: 54px;
    margin-top: -22px;
    border-radius: var(--ns-radius-shape);
    display: grid;
    place-items: center;
    background: var(--ns-red);
    color: #fff !important;
    font-size: 28px;
    box-shadow: 0 8px 24px var(--ns-red-glow);
}

/* ---------- Building blocks ---------- */
.card {
    background: var(--ns-surface);
    border: 1px solid var(--ns-border);
    border-radius: var(--ns-radius-lg);
    padding: 20px;
}

.card.center, .center { text-align: center; }
.card-title { font-size: 18px; margin: 0 0 12px; }
.card-icon { font-size: 38px; }
.lead { color: var(--ns-text-muted); font-size: 17px; margin: 8px 0 16px; }
.muted { color: var(--ns-text-muted); }
.footnote { color: var(--ns-text-faint); font-size: 13px; text-align: center; margin: 8px 0 24px; }
.eyebrow { color: var(--ns-text-muted); font-size: 14px; font-weight: 700; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }

.page-head h1 { font-size: 26px; margin: 8px 0 4px; line-height: 1.3; }
.page-head p { margin: 0; color: var(--ns-text-muted); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 48px;
    padding: 10px 18px;
    border-radius: 14px;
    border: 1px solid transparent;
    font-weight: 800;
    font-size: 16px;
    text-decoration: none;
    cursor: pointer;
    transition: transform var(--ns-fast) var(--ns-ease), background var(--ns-fast);
    -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-primary { background: var(--ns-red); color: #fff; box-shadow: 0 8px 22px var(--ns-red-glow); }
.btn-primary:hover { background: var(--ns-red-hover); }
.btn-ghost { background: var(--ns-surface-2); border-color: var(--ns-border-strong); }
.btn-danger { background: var(--ns-danger-soft); color: var(--ns-danger); }
.btn-small { min-height: 38px; padding: 6px 12px; font-size: 14px; border-radius: 10px; }
.g-icon { width: 22px; height: 22px; background: #fff; border-radius: 50%; padding: 2px; }

.pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: var(--ns-radius-control);
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
}
.pill-success { background: var(--ns-success-soft); color: var(--ns-success); }
.pill-info { background: var(--ns-info-soft); color: var(--ns-info); }
.pill-warning { background: var(--ns-warning-soft); color: var(--ns-warning); }
.pill-danger { background: var(--ns-danger-soft); color: var(--ns-danger); }
.pill-muted { background: var(--ns-surface-3); color: var(--ns-text-muted); }

.spinner {
    width: 40px;
    height: 40px;
    margin: 40px auto;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.12);
    border-top-color: var(--ns-red);
    animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

body.is-busy { cursor: progress; }
body.is-busy .btn-primary { opacity: 0.7; pointer-events: none; }

/* ---------- Hero / home ---------- */
.hero { padding: 16px 4px 4px; }
.hero h1 { font-size: 30px; line-height: 1.25; margin: 0 0 8px; }
.hero p { color: var(--ns-text-muted); margin: 0 0 16px; font-size: 17px; }
.hero-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.status-card { background: linear-gradient(160deg, var(--ns-surface-2), var(--ns-surface)); }
.status-card.is-active { border-color: rgba(74, 222, 128, 0.35); }
.status-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.status-main { font-size: 22px; font-weight: 800; margin: 6px 0 2px; }

.tile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px;
    border-radius: var(--ns-radius);
    background: var(--ns-surface-2);
    border: 1px solid var(--ns-border);
    text-decoration: none;
    font-weight: 700;
}
.tile-icon { font-size: 24px; }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 14px; color: var(--ns-text-muted); }
.field-row { display: grid; grid-template-columns: 1fr; gap: 14px; }
.field input, .field select, .field textarea {
    width: 100%;
    min-height: 50px;
    padding: 12px 14px;
    background: var(--ns-bg-elevated);
    border: 1px solid var(--ns-border-strong);
    border-radius: 12px;
    color: var(--ns-text);
    font-size: 16px;
    font-weight: 600;
}
.field input:focus { border-color: var(--ns-red); outline: none; }
.code-input { font-family: var(--ns-font-logo); font-size: 34px !important; letter-spacing: 6px; text-align: center; }

.segmented { display: grid; grid-template-columns: 1fr 1fr; background: var(--ns-bg-elevated); border-radius: 12px; padding: 4px; border: 1px solid var(--ns-border); }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; }
.segmented span { display: block; text-align: center; padding: 10px; border-radius: 9px; font-weight: 800; cursor: pointer; color: var(--ns-text-muted); }
.segmented input:checked + span { background: var(--ns-surface-3); color: var(--ns-text); }
.segmented input:focus-visible + span { box-shadow: var(--ns-focus-ring); }

.disclosure summary { cursor: pointer; font-weight: 800; color: var(--ns-text-muted); list-style: none; }
.disclosure summary::-webkit-details-marker { display: none; }
.disclosure[open] summary { margin-bottom: 14px; }

[hidden] { display: none !important; }

/* ---------- Lists / devices ---------- */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--ns-border); }
.list-row:last-child { border-bottom: none; }
.list-row span { display: flex; flex-direction: column; min-width: 0; }
.list-row small { color: var(--ns-text-faint); }

.device { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; }
.device-icon { font-size: 28px; width: 48px; height: 48px; display: grid; place-items: center; background: var(--ns-surface-2); border-radius: 14px; }
.device-body { min-width: 0; }
.device-title { font-size: 17px; }
.device-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.device-meta small { color: var(--ns-text-faint); }
.device-actions { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; }

.warn-card { border-color: rgba(251, 191, 36, 0.4); }
.success-card { border-color: rgba(74, 222, 128, 0.4); }
.check { width: 64px; height: 64px; margin: 4px auto 8px; border-radius: var(--ns-radius-shape); display: grid; place-items: center; background: var(--ns-success-soft); color: var(--ns-success); font-size: 34px; font-weight: 800; }

/* ---------- Plans ---------- */
.plan-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.plan {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 22px;
    border-radius: var(--ns-radius-lg);
    background: var(--ns-surface);
    border: 1px solid var(--ns-border);
}
.plan.featured { border-color: rgba(229, 9, 20, 0.6); background: linear-gradient(180deg, var(--ns-red-soft), var(--ns-surface) 60%); }
.plan h2 { margin: 0; font-size: 22px; }
.plan-badge { position: absolute; top: 16px; inset-inline-end: 16px; background: var(--ns-red); color: #fff; font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: var(--ns-radius-control); }
.plan-price b { font-size: 40px; line-height: 1.1; }
.plan-price span { color: var(--ns-text-muted); font-weight: 800; }
.checks { list-style: none; padding: 0; margin: 6px 0 12px; color: var(--ns-text-muted); }
.checks li::before { content: "✓"; color: var(--ns-success); font-weight: 800; margin-inline-end: 8px; }

/* ---------- Account ---------- */
.profile { display: flex; align-items: center; gap: 14px; }
.avatar { width: 56px; height: 56px; border-radius: var(--ns-radius-shape); object-fit: cover; }
.avatar-fallback { display: grid; place-items: center; background: var(--ns-red); font-weight: 800; font-size: 22px; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; inset-inline: 16px; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 50; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; max-width: 520px; width: 100%; padding: 12px 16px; border-radius: 14px; background: var(--ns-surface-3); border: 1px solid var(--ns-border-strong); box-shadow: var(--ns-shadow); font-weight: 700; opacity: 0; transform: translateY(10px); transition: all var(--ns-normal) var(--ns-ease); }
.toast.show { opacity: 1; transform: none; }
.toast-error { border-color: rgba(255, 107, 107, 0.5); }
.toast-success { border-color: rgba(74, 222, 128, 0.5); }

/* ---------- Larger screens ---------- */
@media (min-width: 760px) {
    body { padding-bottom: 0; }
    .tabbar { display: none; }
    .topnav { display: flex; }
    .container { padding: 28px 24px; gap: 20px; }
    .hero h1 { font-size: 40px; }
    .hero-actions { display: flex; }
    .plan-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
    .tile-grid { grid-template-columns: repeat(4, 1fr); }
    .field-row { grid-template-columns: 1fr 1fr; }
    .device { grid-template-columns: auto 1fr auto; align-items: center; }
    .device-actions { grid-column: auto; }
    .toasts { bottom: 24px; }
}

/* ---------- Subscription code row ---------- */
.subcode-row { display: flex; gap: 10px; }
.subcode-row input { flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: 1px; font-weight: 800; }
.subcode-row .btn { flex: none; }
.form-error { margin: 0; color: #ff6b6b; font-size: 14px; font-weight: 700; }

/* Subscription code (activation, not a discount) */
.subcode-card { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; border-color: rgba(229, 9, 20, 0.45); }
.subcode-card .field { display: flex; flex-direction: column; gap: 6px; }
.subcode-label { font-size: 18px; font-weight: 800; }
.subcode-card .form-error:empty { display: none; }
.form-success { margin: 0; color: #4ade80; font-size: 15px; font-weight: 700; }

/* ---------- Product wordmark ("شوف TV" / "Shof TV"): Righteous in English, Reem Kufi Ink in Arabic, "TV" in a white badge ---------- */
@font-face {
    font-family: "Righteous";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("/app/assets/fonts/righteous-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+2215;
}

@font-face {
    font-family: "Reem Kufi Ink";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("/app/assets/fonts/reem-kufi-ink-arabic.woff2") format("woff2");
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC;
}

html .brand {
    font-family: var(--ns-font-brand-en);
    font-weight: 400;
    letter-spacing: .02em;
    text-transform: none;
}

html[lang="ar"] .brand {
    font-family: var(--ns-font-brand-ar);
    font-weight: 400;
    letter-spacing: 0;
}

/* "TV" is plain white text in the Latin wordmark font, in both languages. */
.brand .logo-tv {
    margin-inline-start: .18em;
    color: #fff;
    font-family: var(--ns-font-brand-en);
    font-weight: 400;
    letter-spacing: .02em;
    text-transform: none;
}

/* Footer links to the static legal pages (kept above the mobile tab bar). */
.legal-links { display: flex; justify-content: center; gap: 10px; padding: 8px 16px calc(104px + env(safe-area-inset-bottom)); color: var(--ns-text-faint); font-size: 13px; }
.legal-links a { color: var(--ns-text-muted); text-decoration: none; }
.legal-links a:hover { color: var(--ns-text); }
@media (min-width: 760px) { .legal-links { padding-bottom: 32px; } }

