/* ─────────────────────────────────────────────────────────
   Override Pico CSS primary color to Netflix Red globally.
   This fixes ALL buttons, links, focus rings in one place.
   ───────────────────────────────────────────────────────── */
:root,
[data-theme="dark"] {
    --pico-primary:          #E50914;
    --pico-primary-hover:    #c1000c;
    --pico-primary-focus:    rgba(229, 9, 20, 0.3);
    --pico-primary-inverse:  #fff;

    /* Slightly warmer card backgrounds */
    --pico-card-background-color:         #1a1a1a;
    --pico-card-sectioning-background-color: #1e1e1e;
    --pico-card-border-color:             rgba(255,255,255,0.09);
}

/* ─── Custom variables ────────────────────────────────── */
:root {
    --nf-red:       #E50914;
    --nf-red-dark:  #c1000c;
    --nf-orange:    #d97706;
    --radius:       10px;
}

/* ─── Nav ─────────────────────────────────────────────── */
nav.container-fluid {
    border-bottom: 1px solid rgba(255,255,255,0.07);
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}
.brand {
    font-size: 1.05rem;
    font-weight: 700;
    text-decoration: none !important;
    letter-spacing: -0.01em;
}
.nav-link {
    font-size: 0.88rem;
    color: var(--pico-muted-color) !important;
}
.nav-link:hover { color: var(--pico-color) !important; }

/* ─── HTMX indicator ──────────────────────────────────── */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { display: inline-block; }

/* ─── Page header ─────────────────────────────────────── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}
.page-header h2 { margin: 0; font-size: 1.4rem; }
.refresh-btn {
    margin: 0;
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
}
.status-msg {
    min-height: 1.1rem;
    font-size: 0.8rem;
    color: var(--pico-muted-color);
    margin: -0.75rem 0 0.75rem;
}

/* ─── Email cards ─────────────────────────────────────── */
.email-card {
    display: block;
    padding: 1rem 1.25rem;
    margin-bottom: 0.5rem;
    border-radius: var(--radius);
    border: 1px solid rgba(255,255,255,0.09);
    background: rgba(255,255,255,0.04);
    text-decoration: none !important;
    color: var(--pico-color) !important;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.email-card:hover {
    border-color: rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.07);
    box-shadow: 0 2px 12px rgba(0,0,0,0.35);
    text-decoration: none !important;
}
.email-card.card-kode  { border-left: 3px solid var(--nf-red); }
.email-card.card-akses { border-left: 3px solid var(--nf-orange); }

.email-card-top {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}
.email-time {
    font-size: 0.78rem;
    color: var(--pico-muted-color);
    margin-left: auto;
    white-space: nowrap;
}
.email-subject {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
    color: var(--pico-color);
}
.email-sender {
    font-size: 0.8rem;
    color: var(--pico-muted-color);
}

/* ─── Badges ──────────────────────────────────────────── */
.badge {
    display: inline-block;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    padding: 0.12rem 0.45rem;
    border-radius: 4px;
    line-height: 1.5;
    flex-shrink: 0;
}
.badge-kode  { background: var(--nf-red);    color: #fff; }
.badge-akses { background: var(--nf-orange); color: #fff; }

/* ─── Empty state ─────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--pico-muted-color);
}
.empty-state p { margin: 0.25rem 0; }

/* ─── Back link ───────────────────────────────────────── */
.back-link {
    display: inline-block;
    margin-bottom: 1.5rem;
    font-size: 0.82rem;
    color: var(--pico-muted-color);
    text-decoration: none;
}
.back-link:hover { color: var(--pico-color); }

/* ─── Email detail header ─────────────────────────────── */
.email-detail-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.email-detail-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
}
.detail-sender { font-size: 0.8rem;  color: var(--pico-muted-color); }
.detail-time   { font-size: 0.8rem;  color: var(--pico-muted-color); }
.detail-subject { margin: 0; font-size: 1.2rem; font-weight: 700; }

/* ─── OTP section ─────────────────────────────────────── */
.otp-section {
    text-align: center;
    padding: 2.5rem 2rem;
    margin-bottom: 1.5rem;
    background: rgba(229, 9, 20, 0.07);
    border: 1px solid rgba(229, 9, 20, 0.22);
    border-radius: var(--radius);
}
.otp-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.13em;
    color: var(--pico-muted-color);
    margin: 0 0 1rem;
}
.otp-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    margin-bottom: 1rem;
}
.otp-code {
    font-size: 3.25rem;
    font-weight: 800;
    font-family: ui-monospace, 'Courier New', monospace;
    letter-spacing: 0.1em;
    color: var(--nf-red);
    line-height: 1;
    user-select: all;
}
.otp-copy-btn {
    margin: 0;
    padding: 0.5rem 1.35rem;
    font-size: 0.88rem;
    font-weight: 600;
    white-space: nowrap;
    border-radius: 8px;
}
.otp-copy-btn.copied {
    --pico-primary:       #16a34a;
    --pico-primary-hover: #15803d;
}
.otp-hint {
    font-size: 0.75rem;
    color: var(--pico-muted-color);
    margin: 0;
}

/* ─── Action links ────────────────────────────────────── */
.action-links {
    margin-bottom: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}
.action-links a[role="button"] { margin: 0; font-weight: 600; }

/* ─── Collapsible email ───────────────────────────────── */
.email-full {
    margin-top: 0.5rem;
    border-top: 1px solid rgba(255,255,255,0.07);
    padding-top: 0.75rem;
}
.email-full summary {
    font-size: 0.82rem;
    color: var(--pico-muted-color);
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.email-full summary::-webkit-details-marker { display: none; }
.email-full summary::before { content: '▶'; font-size: 0.6rem; }
details[open] .email-full summary::before,
.email-full[open] summary::before { content: '▼'; }
.email-body-text {
    white-space: pre-wrap;
    font-size: 0.82rem;
    margin-top: 1rem;
    padding: 1rem 1.25rem;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.07);
    line-height: 1.6;
}

/* ─── Login ───────────────────────────────────────────── */
.login-wrap {
    display: flex;
    justify-content: center;
    padding-top: 14vh;
}
.login-card {
    width: 100%;
    max-width: 360px;
}
.login-logo {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--nf-red);
    margin-bottom: 0.75rem;
    line-height: 1;
}
.login-card h2 {
    margin: 0 0 0.3rem;
    font-size: 1.5rem;
}
.login-sub {
    font-size: 0.85rem;
    color: var(--pico-muted-color);
    margin: 0 0 1.75rem;
}
.login-error {
    color: #f87171;
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}
.login-btn { width: 100%; font-weight: 600; }

/* ─── Settings ────────────────────────────────────────── */
.settings-form-row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}
.settings-form-row input  { margin: 0; }
.settings-form-row button { margin: 0; flex-shrink: 0; }
.muted-text  { font-size: 0.82rem; color: var(--pico-muted-color); }
.small-btn   { padding: 0.25rem 0.65rem !important; font-size: 0.78rem !important; }
.hint        { font-size: 0.83rem; color: var(--pico-muted-color); }
