/* ═══════════════════════════════════════════════════════════
   Z5 License Portal — 1:1 match with purchase.php
   ═══════════════════════════════════════════════════════════ */
:root {
    --bg:   #090d18;
    --panel:#111728;
    --line: #27324d;
    --text: #eaf2ff;
    --muted:#9eb0d0;
    --cyan: #65d8ff;
    --ok:   #37d39a;
    --warn: #f7ba53;
}

/* ─── Reset ────────────────────────────────────────────────── */
* { box-sizing: border-box; }

/* ─── Body — exact match ───────────────────────────────────── */
body {
    margin: 0;
    font-family: Consolas, "Cascadia Mono", monospace;
    background: #0a0d12;
    color: var(--text);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
}

/* ─── Global typography — from purchase.php ───────────────── */
h1 { margin: 0 0 6px; font-size: 1.05rem; letter-spacing: .01em; }
p  { margin: 0; color: var(--muted); line-height: 1.4; font-size: .82rem; }

a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Ambient background ──────────────────────────────────── */
.ambient-bg {
    position: fixed; inset: 0; z-index: 0; pointer-events: none;
    background:
        radial-gradient(ellipse 55% 45% at 15% 15%, rgba(110,143,212,.18) 0%, transparent 65%),
        radial-gradient(ellipse 45% 55% at 85% 80%, rgba(100,60,200,.14)  0%, transparent 60%),
        radial-gradient(ellipse 40% 35% at 70% 20%, rgba(60,140,180,.08)  0%, transparent 55%),
        radial-gradient(ellipse 60% 30% at 40% 95%, rgba(80,50,160,.10)   0%, transparent 65%);
}

/* ─── Canvas layers ───────────────────────────────────────── */
.bg-layer { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.bg-stars  { opacity: .56; }
.bg-lines  { opacity: .42; }
.bg-dots   { opacity: .88; }

/* ─── Loading strip ───────────────────────────────────────── */
.loading-strip {
    position: fixed; left: 0; top: 0; width: 100%; height: 3px;
    z-index: 999; background: rgba(255,255,255,.06);
    opacity: 0; pointer-events: none; transition: opacity .15s ease;
}
.loading-strip.active { opacity: 1; }
.loading-strip > span {
    display: block; width: 36%; height: 100%;
    background: linear-gradient(90deg, transparent 0%, var(--cyan) 36%, #8bc4ff 62%, transparent 100%);
    animation: stripMove 1.1s linear infinite;
}
@keyframes stripMove {
    0%   { transform: translateX(-40%); }
    100% { transform: translateX(320%); }
}

/* ─── Outer wrapper — exact purchase.php .wrap ─────────────── */
.wrap {
    position: relative; z-index: 1;
    width: min(960px, 96vw);
    background: linear-gradient(180deg, #111728, #0c1222);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 18px 40px rgba(0,0,0,.42);
    overflow: hidden;
}

/* ─── Body padding — exact purchase.php .body ─────────────── */
.body { padding: 14px 16px 16px; }

/* ─── Hero — exact purchase.php .hero ─────────────────────── */
.hero {
    padding: 14px 16px;
    border-radius: 10px 10px 0 0;
    background: linear-gradient(180deg, rgba(26,37,61,.55), rgba(12,18,34,.01));
}

/* ─── Generic card — exact purchase.php .card ─────────────── */
.card {
    position: relative;
    border: 1px solid #33425f;
    border-radius: 12px;
    background: #0f1628;
    padding: 12px;
}

/* ─── Section block — exact purchase.php .section ─────────── */
.section {
    border: 1px solid #33425f;
    border-radius: 12px;
    background: #0f1628;
    padding: 12px;
}
.section h2 { margin: 0 0 7px; font-size: .9rem; }

/* ─── Note text ───────────────────────────────────────────── */
.note { color: var(--warn); font-size: .78rem; margin: 6px 0 0; }

/* ─── Tag pill — exact purchase.php .tag ──────────────────── */
.tag {
    display: inline-block;
    font-size: .72rem; color: #d9ebff;
    border: 1px solid #3a4b71;
    border-radius: 4px; padding: 2px 8px;
    background: #18233a;
}
.tag--warn {
    border-color: rgba(247,186,83,.6);
    background: rgba(247,186,83,.15);
    color: #ffe9bf;
}
.tag--ok {
    border-color: rgba(55,211,154,.55);
    background: rgba(55,211,154,.12);
    color: #afffdb;
}

/* ─── Inputs — styled to match the dark panel ─────────────── */
input, select, textarea {
    width: 100%;
    padding: 16px 10px;
    background: #0d1222;
    border: 1px solid #3a4b71;
    border-radius: 7px;
    color: var(--text);
    font: inherit;
    font-size: .82rem;
    outline: none;
    transition: border-color .2s ease;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 0 2px rgba(101,216,255,.1);
}

/* ─── Buttons — based on purchase.php .copy-btn ───────────── */
.btn {
    appearance: none;
    border: 1px solid #3a4b71;
    border-radius: 10px;
    background: #18233a;
    color: var(--text);
    padding: 6px 10px;
    cursor: pointer;
    font: inherit;
    font-size: .76rem;
    font-weight: 600;
    display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
    text-decoration: none; white-space: nowrap;
    transition: border-color .2s ease, background .2s ease, transform .12s ease;
}
.btn:hover  { border-color: #75b8ff; background: #1c2e4a; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: not-allowed; border-color: #3a4b71; }

.btn-fill { width: 100%; min-height: 44px; }
.btn-sm   { padding: 4px 9px; font-size: .72rem; }

/* Primary — cyan accent */
.btn-primary {
    background: rgba(25,100,180,.55);
    border-color: rgba(101,216,255,.65);
    color: #e6f8ff;
    font-weight: 700;
}
.btn-primary:hover {
    background: rgba(30,120,210,.75);
    border-color: var(--cyan);
}

/* Status colours */
.btn-danger  { color: #f07070; border-color: rgba(240,112,112,.4); }
.btn-danger:hover  { background: rgba(240,112,112,.1); }
.btn-warn    { color: var(--warn); border-color: rgba(247,186,83,.4); }
.btn-warn:hover    { background: rgba(247,186,83,.1); }
.btn-success { color: var(--ok); border-color: rgba(55,211,154,.4); }
.btn-success:hover { background: rgba(55,211,154,.1); }
.btn-cyan    { color: var(--cyan); border-color: rgba(101,216,255,.4); }
.btn-cyan:hover    { background: rgba(101,216,255,.1); }

/* ─── Login view — natural flow, no centering ─────────────── */
#loginView { display: block; }

/* Login card — same card values as purchase.php */
.login-box {
    border: 1px solid #33425f;
    border-radius: 12px;
    background: #0f1628;
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-box .eyebrow {
    font-size: .68rem; letter-spacing: .08em; text-transform: uppercase;
    color: var(--cyan); font-weight: 700; margin: 0 0 6px;
}

.login-actions { margin-top: 10px; }

.login-error {
    color: #f07070; margin-top: 8px;
    font-size: .78rem; display: none; line-height: 1.4;
}

/* ─── Dashboard ───────────────────────────────────────────── */
#dashView { display: none; }

/* Top bar — same card-border treatment */
.top-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(26,37,61,.42), rgba(12,18,34,.01));
}
.top-bar h1 {
    font-size: .78rem; letter-spacing: .05em; text-transform: uppercase;
    color: var(--muted); font-weight: 700; margin: 0;
}

.container { padding: 14px 16px 16px; }

/* Toolbar strip */
.toolbar {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 10px; flex-wrap: wrap;
}

/* ─── Grid layout (2 col, like purchase.php .grid) ────────── */
.grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 10px;
    margin: 0 0 10px;
}

/* ─── Stats row (admin) ───────────────────────────────────── */
.stats {
    display: grid;
    grid-template-columns: repeat(5, minmax(0,1fr));
    gap: 10px;
    margin: 0 0 10px;
}

.stat-card {
    border: 1px solid #33425f;
    border-radius: 12px;
    background: #0f1628;
    padding: 12px;
    text-align: center;
}
.stat-card .num   { font-size: 1.25rem; font-weight: 700; margin: 0 0 4px; }
.stat-card .label { color: var(--muted); font-size: .7rem; letter-spacing: .03em; text-transform: uppercase; }
.stat-card .num.green  { color: var(--ok); }
.stat-card .num.cyan   { color: var(--cyan); }
.stat-card .num.red    { color: #f07070; }
.stat-card .num.yellow { color: var(--warn); }

/* ─── User panel ──────────────────────────────────────────── */
.user-panel {
    display: grid;
    grid-template-columns: repeat(3, minmax(0,1fr));
    gap: 10px;
    margin: 0 0 10px;
}
.user-panel-head { grid-column: 1 / -1; margin-bottom: 2px; }
.user-panel-head h2 { font-size: .9rem; font-weight: 700; margin: 0 0 4px; }
.user-panel-head p  { font-size: .78rem; }

.user-panel .stat-card { text-align: left; }
.user-panel .toolbar   { grid-column: 1 / -1; margin-bottom: 0; }

.card-note { margin-top: 6px; font-size: .72rem; color: var(--muted); line-height: 1.4; }

#myDaysLeft { font-size: 1.05rem; font-weight: 700; color: var(--ok); margin: 0 0 4px; }
#myResets   { font-size: 1.05rem; font-weight: 700; margin: 0 0 4px; }

.user-toolbar           { margin-top: 10px; }
.release-download-toolbar { justify-content: flex-start; }
.action-stat-card .toolbar { margin-bottom: 0; }
.action-stat-card .btn     { min-width: 170px; }

/* ─── Video section ───────────────────────────────────────── */
.video-section-card {
    grid-column: 1 / -1;
    border: 1px solid #33425f;
    border-radius: 12px;
    background: #0f1628;
    padding: 12px;
}
.video-head h3 { font-size: .85rem; font-weight: 700; margin: 0 0 4px; color: var(--text); }
.video-head p  { font-size: .78rem; margin: 0 0 10px; }
.video-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 10px;
}
.video-item {
    border: 1px solid #33425f;
    border-radius: 10px;
    background: #0d1222;
    padding: 10px;
}
.video-title {
    font-size: .72rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .04em; margin-bottom: 8px; color: var(--text);
}
.video-frame-wrap {
    position: relative; border-radius: 7px;
    overflow: hidden; background: #060c16; min-height: 240px;
}
.video-frame-wrap iframe { width: 100%; height: 240px; border: 0; display: block; }
.video-placeholder {
    height: 240px; display: flex; align-items: center; justify-content: center;
    color: var(--muted); font-size: .76rem; text-align: center; padding: 0 1rem;
}

/* ─── Table — exact purchase.php table ────────────────────── */
table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: .82rem; }

th, td {
    text-align: left; vertical-align: middle;
    border-bottom: 1px solid rgba(130,188,255,.16);
    padding: 8px 7px;
}
th { color: #bdd3f3; font-size: .72rem; letter-spacing: .03em; text-transform: uppercase; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(101,216,255,.05); }

/* Badges */
.badge {
    display: inline-block; padding: 2px 8px;
    border-radius: 999px; font-size: .66rem; font-weight: 700; text-transform: uppercase;
}
.badge-active  { background: rgba(55,211,154,.14);  color: var(--ok); }
.badge-pending { background: rgba(101,216,255,.14); color: var(--cyan); }
.badge-expired { background: rgba(247,186,83,.14);  color: var(--warn); }
.badge-revoked { background: rgba(240,112,112,.14); color: #f07070; }

/* Serial key display */
.serial-key {
    font-family: Consolas, monospace;
    background: #18233a;
    border: 1px solid #3a4b71;
    padding: 2px 8px; border-radius: 4px;
    font-size: .72rem; cursor: pointer; user-select: all; font-weight: 700;
    color: #d9ebff;
}
.serial-inline { margin-top: 6px; display: inline-block; }

.hwid-cell {
    font-size: .72rem; color: var(--muted);
    max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.actions { display: flex; gap: 5px; flex-wrap: wrap; }
.empty-state { text-align: center; padding: 2.5rem; color: var(--muted); }
.time-left-cell { font-variant-numeric: tabular-nums; }

/* ─── Modal ───────────────────────────────────────────────── */
.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.6); z-index: 100;
    align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal {
    border: 1px solid #33425f;
    border-radius: 12px;
    background: #0f1628;
    padding: 16px;
    width: 420px; max-width: 92vw;
    box-shadow: 0 18px 40px rgba(0,0,0,.5);
}
.modal h2 { font-size: .95rem; margin: 0 0 14px; color: var(--cyan); font-weight: 700; }

.form-group { margin-bottom: 12px; }
.form-group label {
    display: block; font-size: .7rem; color: var(--muted);
    margin-bottom: 5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ─── Toast — exact purchase.php .toast ───────────────────── */
.toast {
    position: fixed; right: 14px; bottom: 14px; z-index: 9999;
    background: #13203a; border: 1px solid #3d5d8f; color: #eaf2ff;
    border-radius: 10px; padding: 9px 12px; font-size: .78rem;
    box-shadow: 0 12px 24px rgba(0,0,0,.35);
    opacity: 0; transform: translateY(8px);
    transition: opacity .18s ease, transform .18s ease;
    pointer-events: none;
}
.toast.show, .toast.is-visible { opacity: 1; transform: translateY(0); }
.toast--ok  { border-color: rgba(55,211,154,.65);  background: rgba(24,54,46,.95); }
.toast--err { border-color: rgba(248,131,131,.65); background: rgba(58,24,24,.95); }

/* ─── Footer ──────────────────────────────────────────────── */
.footer { margin-top: 12px; text-align: center; color: #93a8c8; font-size: .75rem; }

/* ─── Responsive ──────────────────────────────────────────── */
@media (max-width: 760px) {
    .grid, .stats, .user-panel, .video-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
    .stats { grid-template-columns: repeat(2, 1fr); }
}
