/* ============================================
   MaxSMMPanel License Server — Design System
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    /* Dark mode (default) */
    --bg: #0B0F17;
    --surface: #131A28;
    --surface-2: #1B2333;
    --border: #232C40;
    --text: #E7ECF5;
    --text-dim: #8A93A6;
    --text-faint: #545E72;

    --accent: #2DD4BF;
    --accent-dim: rgba(45, 212, 191, 0.12);
    --warn: #F5A623;
    --warn-dim: rgba(245, 166, 35, 0.12);
    --danger: #F05252;
    --danger-dim: rgba(240, 82, 82, 0.12);

    --font-display: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --radius: 10px;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    --transition: 180ms cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --bg: #F5F7FA;
    --surface: #FFFFFF;
    --surface-2: #EEF1F6;
    --border: #E0E5EC;
    --text: #171C26;
    --text-dim: #5B6474;
    --text-faint: #97A0B0;

    --accent: #0F9E8E;
    --accent-dim: rgba(15, 158, 142, 0.08);
    --warn: #B9740A;
    --warn-dim: rgba(185, 116, 10, 0.08);
    --danger: #D33;
    --danger-dim: rgba(221, 51, 51, 0.08);

    --shadow: 0 8px 24px rgba(20, 30, 50, 0.08);
}

* { box-sizing: border-box; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
    transition: background var(--transition), color var(--transition);
}

h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; letter-spacing: -0.01em; }
.mono { font-family: var(--font-mono); }

a { color: inherit; text-decoration: none; }

::selection { background: var(--accent-dim); color: var(--accent); }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ---------- Layout ---------- */

.app-shell {
    display: grid;
    grid-template-columns: 250px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px 24px;
}

.sidebar-brand .dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-dim);
}

.sidebar-brand span {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 15px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text-dim);
    font-size: 14px;
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
}

.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active { background: var(--accent-dim); color: var(--accent); }

.main {
    padding: 28px 36px 60px;
    max-width: 1200px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
}

.topbar h1 { font-size: 22px; font-weight: 600; }
.topbar p { margin: 4px 0 0; color: var(--text-dim); font-size: 14px; }

/* ---------- Theme Toggle ---------- */

.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 6px 14px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-dim);
    transition: border-color var(--transition), color var(--transition);
}

.theme-toggle:hover { color: var(--text); border-color: var(--accent); }

/* ---------- Cards / Stats ---------- */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    animation: fadeUp 420ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.stat-card .label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-faint);
    margin-bottom: 8px;
}

.stat-card .value {
    font-family: var(--font-mono);
    font-size: 28px;
    font-weight: 500;
}

.stat-card .value.accent { color: var(--accent); }
.stat-card .value.warn { color: var(--warn); }

/* ---------- Table ---------- */

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    animation: fadeUp 420ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.panel-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h3 { font-size: 15px; font-weight: 600; }

table { width: 100%; border-collapse: collapse; }

th {
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-faint);
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

tr:last-child td { border-bottom: none; }

tbody tr { transition: background var(--transition); }
tbody tr:hover { background: var(--surface-2); }

/* ---------- Status Pulse (signature element) ---------- */

.status-pulse {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
}

.status-pulse .dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    position: relative;
}

.status-pulse.active .dot { background: var(--accent); }
.status-pulse.active .dot::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 1px solid var(--accent);
    animation: pulse 2s ease-out infinite;
}

.status-pulse.warn .dot { background: var(--warn); }
.status-pulse.expired .dot,
.status-pulse.suspended .dot { background: var(--danger); }

@keyframes pulse {
    0% { transform: scale(0.6); opacity: 0.8; }
    100% { transform: scale(2.2); opacity: 0; }
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- Badge ---------- */

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
}

.badge.tier-basic { background: var(--surface-2); color: var(--text-dim); }
.badge.tier-pro { background: var(--accent-dim); color: var(--accent); }
.badge.tier-custom { background: var(--warn-dim); color: var(--warn); }

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: transform var(--transition), border-color var(--transition), background var(--transition);
}

.btn:hover { border-color: var(--accent); transform: translateY(-1px); }

.btn.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #062A26;
}

.btn.primary:hover { filter: brightness(1.08); }

/* ---------- Forms ---------- */

.field { margin-bottom: 16px; }
.field label {
    display: block;
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 6px;
}

.field input, .field select {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 14px;
    transition: border-color var(--transition);
}

.field input:focus, .field select:focus { border-color: var(--accent); }

/* ---------- Login Page ---------- */

.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
}

.login-card {
    width: 360px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
    animation: fadeUp 500ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-card p.sub { color: var(--text-dim); font-size: 13px; margin: 0 0 24px; }

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        border-right: none;
        border-bottom: 1px solid var(--border);
        flex-direction: row;
        overflow-x: auto;
        padding: 12px;
    }
    .sidebar-brand { display: none; }
    .main { padding: 20px; }
    table { display: block; overflow-x: auto; white-space: nowrap; }
}
