/* ===================================================================
   Dragon VPN — Control Panel
   Aesthetic: deep dark cyberpunk, dragon-ember accent, cyber-teal
   =================================================================== */

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

:root {
    --bg:        #0A0E16;
    --bg-grid:   #10151F;
    --surface:   #121A28;
    --surface-2: #182131;
    --surface-3: #1E293B;
    --border:    #263145;
    --border-2:  #33405A;

    --text:      #E8EEF6;
    --muted:     #8593A8;
    --faint:     #5A6579;

    --ember:     #FF5630;
    --ember-2:   #FF8A3D;
    --flame:     linear-gradient(135deg, #FF5630 0%, #FF8A3D 100%);
    --teal:      #22D3EE;
    --teal-dim:  #0E7490;

    --green:     #2DD4A7;
    --red:       #F0506B;
    --amber:     #F5A524;

    --radius:    12px;
    --radius-sm: 8px;
    --shadow:    0 8px 30px rgba(0,0,0,.4);
    --glow-ember: 0 0 18px rgba(255,86,48,.35);

    --sidebar-w: 244px;
}

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

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    background-image:
        linear-gradient(var(--bg-grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
    background-size: 44px 44px;
    background-position: -1px -1px;
}

a { color: var(--teal); text-decoration: none; }
a:hover { color: #67E8F9; }

h1,h2,h3,h4 { font-family: 'Rajdhani', sans-serif; font-weight: 700; letter-spacing: .3px; }

/* ---------- Auth / Login ---------- */
.auth-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
}
.auth-card {
    width: 100%; max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px 32px;
    box-shadow: var(--shadow);
    position: relative; overflow: hidden;
}
.auth-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: var(--flame);
}
.auth-logo { display: flex; align-items: center; gap: 12px; justify-content: center; margin-bottom: 6px; }
.auth-logo img { width: 46px; height: 46px; }
.auth-logo .name { font-family: 'Rajdhani'; font-size: 26px; font-weight: 700; }
.auth-logo .name b { color: var(--ember); }
.auth-sub { text-align: center; color: var(--muted); margin-bottom: 28px; font-size: 13px; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w); flex-shrink: 0;
    background: linear-gradient(180deg, #0D131E 0%, #0A0E16 100%);
    border-right: 1px solid var(--border);
    padding: 20px 14px;
    position: fixed; top: 0; bottom: 0; left: 0;
    display: flex; flex-direction: column;
    z-index: 40;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 22px; }
.brand img { width: 34px; height: 34px; }
.brand .txt { font-family: 'Rajdhani'; font-size: 20px; font-weight: 700; line-height: 1; }
.brand .txt b { color: var(--ember); }
.brand .txt span { display: block; font-size: 9px; letter-spacing: 2px; color: var(--faint); font-family: 'Inter'; font-weight: 600; margin-top: 3px; }

.nav-label { font-size: 10px; letter-spacing: 1.5px; color: var(--faint); text-transform: uppercase; padding: 14px 10px 6px; font-weight: 600; }
.nav-item {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 12px; border-radius: var(--radius-sm);
    color: var(--muted); font-weight: 500; font-size: 13.5px;
    transition: all .15s; margin-bottom: 2px;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active {
    background: linear-gradient(90deg, rgba(255,86,48,.16), rgba(255,86,48,.03));
    color: #fff;
    box-shadow: inset 2px 0 0 var(--ember);
}
.nav-item.active svg { color: var(--ember); }
.sidebar-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); }

.main {
    flex: 1; margin-left: var(--sidebar-w); min-width: 0;
    display: flex; flex-direction: column;
}
.topbar {
    height: 62px; border-bottom: 1px solid var(--border);
    background: rgba(10,14,22,.85); backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 26px; position: sticky; top: 0; z-index: 30;
}
.topbar .page-title { font-size: 19px; }
.topbar .right { display: flex; align-items: center; gap: 16px; }
.admin-chip { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.admin-chip .avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--flame); display: grid; place-items: center;
    font-weight: 700; color: #fff; font-family: 'Rajdhani';
}
.content { padding: 26px; flex: 1; }

/* ---------- Cards ---------- */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
}
.card-head {
    padding: 16px 20px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-head h3 { font-size: 16px; }
.card-body { padding: 20px; }
.card-body.flush { padding: 0; }

/* ---------- Stat cards ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit,minmax(210px,1fr)); gap: 16px; margin-bottom: 24px; }
.stat {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 18px 20px; position: relative; overflow: hidden;
}
.stat::after {
    content: ''; position: absolute; right: -20px; top: -20px; width: 80px; height: 80px;
    background: radial-gradient(circle, rgba(255,86,48,.12), transparent 70%);
}
.stat .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
.stat .value { font-family: 'Rajdhani'; font-size: 32px; font-weight: 700; margin-top: 6px; line-height: 1; }
.stat .icon { position: absolute; right: 18px; bottom: 16px; opacity: .35; }
.stat .icon svg { width: 26px; height: 26px; color: var(--ember); }
.stat.teal .icon svg { color: var(--teal); }
.stat.green .icon svg { color: var(--green); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
    text-align: left; padding: 13px 18px; color: var(--muted);
    font-size: 11px; letter-spacing: .8px; text-transform: uppercase; font-weight: 600;
    border-bottom: 1px solid var(--border); background: var(--surface-2);
    white-space: nowrap;
}
tbody td { padding: 14px 18px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
.mono { font-family: 'JetBrains Mono', monospace; font-size: 12.5px; color: var(--muted); }

/* ---------- Badges ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 600;
    border: 1px solid transparent;
}
.badge.free    { background: rgba(34,211,238,.12); color: var(--teal); border-color: rgba(34,211,238,.25); }
.badge.premium { background: rgba(255,86,48,.12); color: var(--ember-2); border-color: rgba(255,86,48,.3); }
.badge.active  { background: rgba(45,212,167,.12); color: var(--green); border-color: rgba(45,212,167,.28); }
.badge.inactive{ background: rgba(90,101,121,.14); color: var(--faint); border-color: rgba(90,101,121,.3); }
.badge.pending { background: rgba(245,165,36,.12); color: var(--amber); border-color: rgba(245,165,36,.3); }
.badge.completed { background: rgba(45,212,167,.12); color: var(--green); }
.badge.failed  { background: rgba(240,80,107,.12); color: var(--red); }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot.on  { background: var(--green); box-shadow: 0 0 8px var(--green); animation: pulse 2s infinite; }
.dot.off { background: var(--faint); }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 16px 20px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field label .req { color: var(--ember); }
.field .hint { font-size: 11.5px; color: var(--faint); margin-top: 5px; }
input, select, textarea {
    width: 100%; background: var(--bg); border: 1px solid var(--border-2);
    border-radius: var(--radius-sm); padding: 11px 13px; color: var(--text);
    font-family: inherit; font-size: 13.5px; transition: border .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--ember);
    box-shadow: 0 0 0 3px rgba(255,86,48,.14);
}
input::placeholder, textarea::placeholder { color: var(--faint); }
textarea { resize: vertical; min-height: 84px; font-family: 'JetBrains Mono', monospace; font-size: 12.5px; }
select { cursor: pointer; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 8px; justify-content: center;
    padding: 10px 18px; border-radius: var(--radius-sm); border: 1px solid transparent;
    font-family: 'Rajdhani', sans-serif; font-weight: 600; font-size: 15px; letter-spacing: .3px;
    cursor: pointer; transition: all .15s; text-decoration: none; white-space: nowrap;
}
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--flame); color: #fff; box-shadow: var(--glow-ember); }
.btn-primary:hover { filter: brightness(1.08); color: #fff; }
.btn-ghost { background: var(--surface-2); color: var(--text); border-color: var(--border-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger { background: rgba(240,80,107,.14); color: var(--red); border-color: rgba(240,80,107,.3); }
.btn-danger:hover { background: rgba(240,80,107,.22); color: var(--red); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }

.actions { display: flex; gap: 8px; align-items: center; }
.icon-btn {
    width: 32px; height: 32px; border-radius: var(--radius-sm);
    display: grid; place-items: center; background: var(--surface-2);
    border: 1px solid var(--border); cursor: pointer; color: var(--muted); transition: all .15s;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-2); }
.icon-btn.danger:hover { color: var(--red); border-color: var(--red); }
.icon-btn svg { width: 15px; height: 15px; }

/* ---------- Flash / alerts ---------- */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 18px; font-size: 13.5px; border: 1px solid transparent; display:flex; gap:10px; align-items:center;}
.alert.success { background: rgba(45,212,167,.1); color: var(--green); border-color: rgba(45,212,167,.25); }
.alert.error   { background: rgba(240,80,107,.1); color: var(--red); border-color: rgba(240,80,107,.25); }

/* ---------- Toggle switch ---------- */
.switch { position: relative; display: inline-block; width: 42px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute; inset: 0; background: var(--surface-3); border: 1px solid var(--border-2);
    border-radius: 24px; cursor: pointer; transition: .2s;
}
.slider::before {
    content: ''; position: absolute; height: 16px; width: 16px; left: 3px; top: 3px;
    background: var(--muted); border-radius: 50%; transition: .2s;
}
.switch input:checked + .slider { background: rgba(255,86,48,.25); border-color: var(--ember); }
.switch input:checked + .slider::before { transform: translateX(18px); background: var(--ember); }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty svg { width: 48px; height: 48px; color: var(--faint); margin-bottom: 14px; }
.empty h4 { font-size: 17px; color: var(--text); margin-bottom: 6px; }

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(6,9,15,.72); backdrop-filter: blur(3px);
    display: none; align-items: flex-start; justify-content: center; z-index: 100; padding: 40px 20px; overflow-y: auto;
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--surface); border: 1px solid var(--border-2);
    border-radius: var(--radius); width: 100%; max-width: 720px;
    box-shadow: var(--shadow); animation: slideUp .2s ease;
}
@keyframes slideUp { from{transform:translateY(14px);opacity:0} to{transform:translateY(0);opacity:1} }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display:flex; align-items:center; justify-content:space-between; }
.modal-head h3 { font-size: 17px; }
.modal-body { padding: 22px; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

.section-title { font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: var(--ember); font-weight: 700; margin: 22px 0 4px; grid-column: 1/-1; font-family:'Rajdhani'; }
.section-title:first-child { margin-top: 0; }

/* ---------- Mobile ---------- */
.menu-toggle { display: none; background: none; border: none; color: var(--text); cursor: pointer; }
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); transition: transform .25s; box-shadow: var(--shadow); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .menu-toggle { display: grid; place-items: center; }
    .form-grid { grid-template-columns: 1fr; }
    .content { padding: 18px; }
    .backdrop { display:none; position:fixed; inset:0; background:rgba(0,0,0,.5); z-index:35; }
    .backdrop.open { display:block; }
}
