/* ===== CSS Variables — Sky Blue Theme (Dark) ===== */
:root {
    --primary: #0ea5e9;
    --primary-dark: #0284c7;
    --primary-light: #e0f2fe;
    --primary-glow: rgba(14, 165, 233, .15);
    --bg: #0f172a;
    --surface: #1e293b;
    --surface-hover: #263548;
    --border: #334155;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0,0,0,.35);
    --transition: .2s ease;
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }

/* ===== Layout ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 24px 20px; }

/* ===== Header / Navbar ===== */
.navbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}
.navbar .logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.navbar .logo svg { width: 26px; height: 26px; }
.navbar .nav-links { display: flex; gap: 16px; align-items: center; }
.navbar .nav-links a {
    color: var(--text-muted);
    font-size: .9rem;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.navbar .nav-links a:hover,
.navbar .nav-links a.active { color: var(--text); background: var(--primary-glow); }

/* ===== Card ===== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}
.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===== Auth Section ===== */
.auth-section {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.auth-display {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: .95rem;
}
.auth-display .masked-key {
    background: var(--primary-glow);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-family: 'Consolas', monospace;
    color: var(--primary);
    border: 1px solid rgba(14,165,233,.3);
}

/* ===== Forms ===== */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: .85rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 500;
}
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}
input[type="text"],
input[type="number"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: .95rem;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}
input[readonly] {
    opacity: .7;
    cursor: default;
}
textarea { resize: vertical; min-height: 70px; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}
.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-danger  { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: var(--surface-hover); }
.btn-sm { padding: 6px 12px; font-size: .8rem; }
.btn-icon {
    padding: 6px 10px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}
.btn-icon:hover { border-color: var(--primary); color: var(--primary); }

/* ===== Table ===== */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: .88rem;
}
thead { background: rgba(14,165,233,.08); }
th {
    text-align: left;
    padding: 12px 14px;
    font-weight: 600;
    color: var(--primary);
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    white-space: nowrap;
}
td {
    padding: 10px 14px;
    border-top: 1px solid var(--border);
    vertical-align: middle;
}
tbody tr { transition: var(--transition); }
tbody tr:hover { background: var(--surface-hover); }

/* ===== Badges ===== */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 600;
    white-space: nowrap;
}
.badge-processing  { background: #1e3a5f; color: #7dd3fc; }
.badge-inprogress  { background: #3b2f00; color: #fde68a; }
.badge-cancel      { background: #3b0f0f; color: #fca5a5; }
.badge-completed   { background: #0f2e1c; color: #6ee7b7; }
.badge-unpaid      { background: #3b1a00; color: #fdba74; }
.badge-paid        { background: #0f2e1c; color: #6ee7b7; }
.badge-admin       { background: #312e81; color: #a5b4fc; }
.badge-user        { background: #1e3a5f; color: #7dd3fc; }
.badge-active      { background: #0f2e1c; color: #6ee7b7; }
.badge-banned      { background: #3b0f0f; color: #fca5a5; }

/* ===== Tabs ===== */
.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0;
}
.tab-btn {
    padding: 10px 20px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
    font-family: inherit;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== Modal ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}
.modal-overlay.show { display: flex; }
.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0,0,0,.5);
    animation: modalIn .2s ease;
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(.95) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--primary);
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* ===== Toast ===== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: .9rem;
    font-weight: 500;
    color: #fff;
    box-shadow: 0 4px 20px rgba(0,0,0,.4);
    animation: toastIn .3s ease, toastOut .3s ease 2.7s forwards;
    max-width: 360px;
}
.toast-success { background: #059669; }
.toast-error   { background: #dc2626; }
.toast-info    { background: var(--primary); }
@keyframes toastIn  { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateX(40px); } }

/* ===== Lazy load sentinel ===== */
.lazy-sentinel {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: .85rem;
}

/* ===== Price hint ===== */
.price-hint {
    font-size: .8rem;
    color: var(--primary);
    margin-top: 4px;
}

/* ===== Utilities ===== */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.flex  { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* ===== Empty state ===== */
.empty-state {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
}
.empty-state svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: .4; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .container { padding: 16px 12px; }
    .card { padding: 16px; }
    .form-row { grid-template-columns: 1fr; }
    .auth-section { flex-direction: column; align-items: stretch; }
    .navbar { padding: 10px 16px; flex-wrap: wrap; gap: 8px; }
    .modal { padding: 20px; width: 95%; }
    table { font-size: .8rem; }
    th, td { padding: 8px 10px; }
}
