/* ==========================================================================
   Reseller Console — Premium Design System
   Palette:  obsidian base, violet→gold gradient accent (gateway / key motif)
   Type:     Sora (display) · Inter (body) · JetBrains Mono (keys / tokens)
   ========================================================================== */

:root {
    --bg:              #0B0E14;
    --surface:         #131722;
    --surface-2:       #1A2030;
    --border:          #242B3D;
    --border-soft:     #1D2333;

    --text:            #F3F5FA;
    --text-muted:      #8992A9;
    --text-dim:        #5E6780;

    --accent:          #7C5CFC;
    --accent-soft:     rgba(124, 92, 252, 0.12);
    --gold:            #F2B84B;
    --gold-soft:       rgba(242, 184, 75, 0.12);

    --success:         #34D399;
    --success-soft:    rgba(52, 211, 153, 0.12);
    --danger:          #F1626C;
    --danger-soft:     rgba(241, 98, 108, 0.12);
    --warning:         #FBBF24;
    --warning-soft:    rgba(251, 191, 36, 0.12);

    --gradient-brand:  linear-gradient(135deg, #9B7BFF 0%, #7C5CFC 45%, #F2B84B 100%);
    --radius-lg:       16px;
    --radius-md:       12px;
    --radius-sm:       8px;
    --shadow-card:     0 10px 30px -12px rgba(0, 0, 0, 0.55);
    --shadow-lift:     0 20px 45px -18px rgba(0, 0, 0, 0.65);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-tap-highlight-color: transparent; }

body {
    background:
        radial-gradient(1200px 600px at 50% -10%, rgba(124, 92, 252, 0.10), transparent 60%),
        var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    min-height: 100vh;
    padding-bottom: 48px;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: 'Sora', 'Inter', sans-serif;
    letter-spacing: -0.02em;
    color: #fff;
}

.mono { font-family: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace; }

a { color: inherit; }

/* ---------- Layout shell ---------- */
.main-container { max-width: 600px; margin: 0 auto; padding: 18px 16px 8px; }

.page-head { margin: 4px 0 20px; }
.page-head h1 { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.page-head p { font-size: 13px; color: var(--text-muted); line-height: 1.55; }

/* ---------- Top navigation ---------- */
.menu-wrapper {
    background: rgba(19, 23, 34, 0.86);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    border-bottom: 1px solid var(--border-soft);
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 999;
}

.navbar {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
    font-family: 'Sora', sans-serif;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: -0.01em;
}

.brand-logo img { display: block; width: 30px; height: 30px; }
.brand-logo .brand-sub { display: block; font-size: 10px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 1px; }

.menu-toggle { display: none; flex-direction: column; gap: 4px; cursor: pointer; padding: 6px; }
.menu-toggle span { width: 20px; height: 2px; background: var(--text); border-radius: 2px; transition: 0.25s; }

.nav-links { display: flex; gap: 6px; align-items: center; }

.nav-link {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    border: 1px solid transparent;
}
.nav-link:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.nav-link.active { color: var(--accent); background: var(--accent-soft); border-color: rgba(124, 92, 252, 0.22); }
.nav-link.logout-link { color: var(--danger); }
.nav-link.logout-link:hover { background: var(--danger-soft) !important; color: var(--danger) !important; }

@media (max-width: 640px) {
    .menu-toggle { display: flex; }
    .nav-links {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: rgba(19, 23, 34, 0.98);
        border-bottom: 1px solid var(--border-soft);
        padding: 10px 16px 16px;
        box-shadow: var(--shadow-lift);
        gap: 4px;
    }
    .nav-links.show { display: flex; }
    .nav-link { width: 100%; padding: 12px 14px; }
}

/* ---------- Cards & panels ---------- */
.panel-card, .form-card, .settings-card, .profile-card, .api-card {
    background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px 18px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-card);
    animation: rise 0.35s ease both;
}

.panel-card h3, .form-card h3, .settings-card h3, .profile-card h3 { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.panel-card p.desc, .form-card p.desc, .settings-card p.desc, .profile-card p.desc, p.desc {
    font-size: 13px; color: var(--text-muted); line-height: 1.6; margin-bottom: 20px;
}
.panel-card p { font-size: 13px; color: var(--text-muted); line-height: 1.6; }

.section-divider {
    font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--gold);
    letter-spacing: 0.09em; margin: 26px 0 14px; display: flex; align-items: center; gap: 8px;
}
.section-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ---------- Stat grid ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 4px 0 20px; }
.stat-card {
    position: relative; overflow: hidden;
    background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
    padding: 18px 10px; border-radius: var(--radius-md); border: 1px solid var(--border);
    text-align: center; box-shadow: var(--shadow-card);
}
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 3px; }
.card-total::before   { background: var(--accent); box-shadow: 0 0 12px rgba(124,92,252,0.6); }
.card-active::before  { background: var(--success); box-shadow: 0 0 12px rgba(52,211,153,0.55); }
.card-expired::before { background: var(--danger); box-shadow: 0 0 12px rgba(241,98,108,0.5); }

.stat-number { font-family: 'Sora', sans-serif; font-size: 26px; font-weight: 800; color: #fff; margin-bottom: 4px; }
.stat-label { font-size: 10.5px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.07em; }

/* ---------- Buttons ---------- */
.action-btn, .submit-btn, .save-btn, .update-btn, .login-btn, .setup-card button {
    display: inline-flex; align-items: center; justify-content: center; width: 100%;
    padding: 14px; border: none; border-radius: var(--radius-sm);
    font-size: 14.5px; font-weight: 700; letter-spacing: -0.01em;
    text-decoration: none; cursor: pointer; margin-top: 8px;
    background: var(--gradient-brand); color: #0B0E14;
    transition: filter 0.2s ease, transform 0.15s ease;
    box-shadow: 0 10px 25px -10px rgba(124, 92, 252, 0.55);
}
.action-btn:hover, .submit-btn:hover, .save-btn:hover, .update-btn:hover, .login-btn:hover, .setup-card button:hover {
    filter: brightness(1.08);
}
.action-btn:active, .submit-btn:active, .save-btn:active, .update-btn:active, .login-btn:active { transform: translateY(1px); }

.gen-btn {
    background: var(--surface-2); color: var(--gold); border: 1px solid rgba(242, 184, 75, 0.35);
    font-weight: 700; padding: 0 18px; border-radius: var(--radius-sm); cursor: pointer;
    font-size: 13px; white-space: nowrap; transition: all 0.2s;
}
.gen-btn:hover { background: var(--gold-soft); }

.btn-small { padding: 7px 13px; font-size: 12px; font-weight: 700; border-radius: var(--radius-sm); cursor: pointer; border: none; text-decoration: none; }
.btn-edit { background: var(--accent-soft); color: #B7A6FF; border: 1px solid rgba(124, 92, 252, 0.28); }
.btn-delete { background: var(--danger-soft); color: #FF9AA1; border: 1px solid rgba(241, 98, 108, 0.28); }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 16px; position: relative; }
label {
    font-size: 11.5px; font-weight: 700; color: var(--text-muted); text-transform: uppercase;
    letter-spacing: 0.06em; display: block; margin-bottom: 7px;
}
input, select {
    width: 100%; padding: 13px 14px; background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: #fff; font-size: 14px; transition: all 0.2s;
    font-family: inherit;
}
input:focus, select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(124, 92, 252, 0.18); }
input[readonly] { background: var(--surface-2); color: var(--text-dim); cursor: not-allowed; }
.input-wrapper { display: flex; gap: 8px; }
.hint-text { font-size: 11px; color: var(--text-dim); margin-top: 5px; display: block; }

/* ---------- Alerts ---------- */
.alert { padding: 13px 16px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; margin-bottom: 20px; line-height: 1.5; }
.alert-error   { background: var(--danger-soft); border: 1px solid rgba(241, 98, 108, 0.25); color: #FFB3B8; }
.alert-success { background: var(--success-soft); border: 1px solid rgba(52, 211, 153, 0.25); color: #8FF0CB; }
.alert-success a { color: var(--gold); font-weight: 700; }

/* ---------- API key cards / badges ---------- */
.card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.domain-title { font-size: 15px; font-weight: 700; color: #fff; }

.key-box-wrapper { display: flex; gap: 6px; margin: 10px 0; }
.key-display {
    flex: 1; background: var(--bg); padding: 11px; border-radius: var(--radius-sm); border: 1px solid var(--border);
    font-size: 12px; color: var(--gold); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.copy-btn { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); padding: 0 13px; font-size: 11px; font-weight: 700; border-radius: var(--radius-sm); cursor: pointer; transition: all 0.2s; }
.copy-btn:hover { background: rgba(255,255,255,0.06); }

.meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-size: 12px; color: var(--text-muted); margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-soft); }
.meta-item strong { color: var(--text); }

.card-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }

.badge { padding: 4px 8px; font-size: 10px; font-weight: 700; border-radius: 5px; text-transform: uppercase; letter-spacing: 0.05em; }
.badge-active     { background: var(--success-soft); border: 1px solid rgba(52, 211, 153, 0.25); color: #6EE7B7; }
.badge-expired    { background: var(--danger-soft); border: 1px solid rgba(241, 98, 108, 0.25); color: #FCA5AB; }
.badge-suspended  { background: var(--warning-soft); border: 1px solid rgba(251, 191, 36, 0.25); color: #FCD34D; }

.edit-panel { display: none; background: var(--bg); border-radius: var(--radius-sm); padding: 15px; border: 1px solid var(--border); margin-top: 14px; }
.edit-panel input, .edit-panel select { padding: 9px 11px; margin-bottom: 10px; font-size: 13px; }
.edit-panel label { font-size: 10.5px; color: var(--text-dim); margin-bottom: 4px; }
.panel-submit { background: var(--gradient-brand); color: #0B0E14; font-weight: 700; border: none; padding: 10px; border-radius: var(--radius-sm); cursor: pointer; width: 100%; }

.activity-list { display: flex; flex-direction: column; gap: 10px; }
.activity-item { display: flex; justify-content: space-between; align-items: center; padding: 13px; background: var(--bg); border-radius: var(--radius-sm); border: 1px solid var(--border-soft); }
.activity-info strong { font-size: 13px; color: var(--text); display: block; margin-bottom: 2px; }
.activity-info span { font-size: 11px; color: var(--text-dim); }

.empty-state, .empty-log { text-align: center; font-size: 13px; color: var(--text-dim); padding: 22px 0; }

/* ---------- Auth / install centered layout ---------- */
.auth-shell { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.login-card, .setup-card {
    background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
    width: 100%; max-width: 410px; padding: 38px 26px; border-radius: 20px;
    border: 1px solid var(--border); box-shadow: var(--shadow-lift);
    animation: rise 0.4s ease both;
}
.brand-header { text-align: center; margin-bottom: 26px; }
.brand-header img { width: 44px; height: 44px; margin-bottom: 12px; }
.brand-header h2 { font-size: 22px; font-weight: 800; }
p.subtitle { text-align: center; font-size: 13px; color: var(--text-muted); margin-top: 5px; margin-bottom: 4px; }

/* ---------- Motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulseDot { 0%, 100% { box-shadow: 0 0 0 0 rgba(124, 92, 252, 0.55); } 50% { box-shadow: 0 0 0 5px rgba(124, 92, 252, 0); } }

.logo-dot, .logo-indicator {
    width: 8px; height: 8px; background: var(--accent); border-radius: 50%;
    display: inline-block; animation: pulseDot 2.2s infinite;
}

@media (prefers-reduced-motion: reduce) {
    .panel-card, .form-card, .settings-card, .profile-card, .api-card, .login-card, .setup-card { animation: none; }
    .logo-dot, .logo-indicator { animation: none; }
}
