/* AdShield v2 — Premium UI */

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

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

:root {
    --bg:        #060810;
    --bg2:       #0c0f1a;
    --bg3:       #111520;
    --bg4:       #161b28;
    --border:    #1a2035;
    --border2:   #222840;
    --text:      #eaecf5;
    --text2:     #6b7494;
    --text3:     #3d4560;
    --accent:    #5b8af9;
    --accent2:   #3d6ee0;
    --green:     #22d47a;
    --red:       #f05252;
    --amber:     #f6a623;
    --teal:      #0fbfad;
    --purple:    #b06ef3;
    --radius:    8px;
    --radius-lg: 12px;
    --font:      'Inter', -apple-system, 'Segoe UI', sans-serif;
    --mono:      'JetBrains Mono', 'Fira Code', monospace;
    --shadow-sm: 0 2px 8px rgba(0,0,0,.4);
    --shadow:    0 8px 32px rgba(0,0,0,.6);
    --glow:      0 0 0 2px rgba(91,138,249,.25);
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    background-image:
        radial-gradient(ellipse 80% 40% at 50% -10%, rgba(91,138,249,.07) 0%, transparent 60%);
}

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

.sidebar {
    width: 228px;
    min-height: 100vh;
    background: var(--bg2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
}

.main {
    margin-left: 228px;
    flex: 1;
    padding: 30px 36px;
    max-width: 100%;
}

/* ── Sidebar Logo ── */
.sidebar-logo {
    padding: 22px 18px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 11px;
}

.sidebar-logo .logo-icon {
    width: 34px; height: 34px;
    background: linear-gradient(135deg, #5b8af9 0%, #b06ef3 100%);
    border-radius: 9px;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 15px;
    color: #fff;
    box-shadow: 0 0 16px rgba(91,138,249,.35);
    letter-spacing: -.02em;
}

.sidebar-logo span {
    font-weight: 700;
    font-size: 15px;
    letter-spacing: -.02em;
    background: linear-gradient(90deg, #eaecf5, #9ba3c0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ── Nav ── */
.nav { padding: 10px 8px; flex: 1; overflow-y: auto; }

.nav a {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 12px;
    color: var(--text2);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius);
    transition: all .15s ease;
    margin-bottom: 2px;
    position: relative;
}

.nav a:hover {
    color: var(--text);
    background: rgba(255,255,255,.04);
}

.nav a.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(91,138,249,.2), rgba(176,110,243,.1));
    border: 1px solid rgba(91,138,249,.2);
    box-shadow: 0 2px 12px rgba(91,138,249,.1);
}

.nav a .ico {
    width: 18px;
    text-align: center;
    font-style: normal;
    font-size: 14px;
    flex-shrink: 0;
}

.nav-section {
    padding: 14px 12px 4px;
    font-size: 10px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text3);
    font-weight: 600;
}

.sidebar-footer {
    padding: 14px 18px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text3);
}

.sidebar-footer a { color: var(--text3); text-decoration: none; transition: color .15s; }
.sidebar-footer a:hover { color: var(--red); }

/* ── Topbar ── */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.topbar h1 {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -.03em;
    background: linear-gradient(90deg, var(--text), #8b93b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ── Stat cards ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    position: relative;
    overflow: hidden;
    transition: border-color .2s, transform .2s;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.06), transparent);
}

.stat-card:hover { border-color: var(--border2); transform: translateY(-1px); }
.stat-card .label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--text3); margin-bottom: 10px; }
.stat-card .value { font-size: 30px; font-weight: 800; line-height: 1; letter-spacing: -.03em; }
.stat-card .sub { font-size: 11px; color: var(--text3); margin-top: 6px; }
.stat-card.green  .value { color: var(--green); text-shadow: 0 0 20px rgba(34,212,122,.3); }
.stat-card.red    .value { color: var(--red);   text-shadow: 0 0 20px rgba(240,82,82,.3); }
.stat-card.amber  .value { color: var(--amber); text-shadow: 0 0 20px rgba(246,166,35,.3); }
.stat-card.accent .value { color: var(--accent);text-shadow: 0 0 20px rgba(91,138,249,.3); }

/* ── Cards ── */
.card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 20px;
    position: relative;
}

.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.05), transparent);
    pointer-events: none;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 13px;
    background: rgba(255,255,255,.015);
}

.card-header .live-dot {
    width: 7px; height: 7px;
    background: var(--green);
    border-radius: 50%;
    display: inline-block;
    margin-right: 7px;
    animation: pulse 2s ease-in-out infinite;
    box-shadow: 0 0 8px var(--green);
}

@keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.4;transform:scale(.8)} }

/* ── Tables ── */
table { width: 100%; border-collapse: collapse; }

th, td { padding: 10px 16px; text-align: left; }

th {
    color: var(--text3);
    font-weight: 600;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: .07em;
    border-bottom: 1px solid var(--border);
    background: rgba(255,255,255,.018);
    white-space: nowrap;
}

td {
    font-size: 12.5px;
    border-bottom: 1px solid rgba(26,32,53,.8);
    color: var(--text2);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,.022); color: var(--text); }

/* ── Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px;
    border-radius: 100px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .03em;
}

.badge-allow  { background: rgba(34,212,122,.1);  color: #4ade80; border: 1px solid rgba(34,212,122,.2); }
.badge-block  { background: rgba(240,82,82,.1);   color: #f87171; border: 1px solid rgba(240,82,82,.2); }
.badge-bot    { background: rgba(246,166,35,.1);  color: #fbbf24; border: 1px solid rgba(246,166,35,.2); }
.badge-vpn    { background: rgba(91,138,249,.1);  color: #93b4fc; border: 1px solid rgba(91,138,249,.2); }
.badge-dc     { background: rgba(15,191,173,.1);  color: #2dd4bf; border: 1px solid rgba(15,191,173,.2); }
.badge-manual { background: rgba(107,116,148,.08);color: var(--text2); border: 1px solid var(--border); }

/* ── Forms ── */
.form-row { display: flex; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.form-group { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 160px; }
.form-group label { font-size: 11.5px; font-weight: 600; color: var(--text2); letter-spacing: .02em; }

input[type=text], input[type=email], input[type=password], input[type=url], input[type=color],
select, textarea {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 9px 12px;
    font-size: 13px;
    font-family: var(--font);
    width: 100%;
    transition: border-color .15s, box-shadow .15s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--glow);
}

input::placeholder, textarea::placeholder { color: var(--text3); }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all .18s;
    text-decoration: none;
    font-family: var(--font);
    white-space: nowrap;
    letter-spacing: -.01em;
}

.btn:hover { filter: brightness(1.12); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { filter: brightness(.92); transform: translateY(0); box-shadow: none; }

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: #fff;
    box-shadow: 0 2px 12px rgba(91,138,249,.3);
}

.btn-danger {
    background: linear-gradient(135deg, #f05252, #c53030);
    color: #fff;
    box-shadow: 0 2px 12px rgba(240,82,82,.25);
}

.btn-ghost {
    background: var(--bg3);
    color: var(--text);
    border-color: var(--border);
}

.btn-sm { padding: 5px 11px; font-size: 12px; }

/* ── Score bar ── */
.score-bar { display: flex; align-items: center; gap: 8px; }
.score-bar-track { flex: 1; height: 3px; background: var(--bg4); border-radius: 2px; overflow: hidden; }
.score-bar-fill { height: 100%; border-radius: 2px; }
.score-0  .score-bar-fill { background: var(--green); }
.score-50 .score-bar-fill { background: var(--amber); }
.score-80 .score-bar-fill { background: var(--red); }

/* ── Pagination ── */
.pagination {
    display: flex;
    gap: 4px;
    padding: 14px 18px;
    justify-content: flex-end;
    border-top: 1px solid var(--border);
}

.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px; height: 30px;
    border-radius: 7px;
    font-size: 12px;
    text-decoration: none;
    color: var(--text2);
    background: var(--bg3);
    border: 1px solid var(--border);
    transition: all .15s;
    font-weight: 500;
}

.pagination a:hover { color: var(--text); border-color: var(--accent); }
.pagination .current {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 0 12px rgba(91,138,249,.3);
}

/* ── Login ── */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    background-image:
        radial-gradient(ellipse 60% 50% at 50% -5%, rgba(91,138,249,.1) 0%, transparent 70%),
        radial-gradient(ellipse 40% 30% at 80% 110%, rgba(176,110,243,.06) 0%, transparent 60%);
}

.login-box {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    width: 390px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.login-box::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(91,138,249,.4), rgba(176,110,243,.3), transparent);
}

.login-box h2 { font-size: 22px; font-weight: 800; margin-bottom: 4px; letter-spacing: -.03em; }
.login-box .sub { color: var(--text2); font-size: 13px; margin-bottom: 26px; }

/* ── Alerts ── */
.alert { padding: 11px 15px; border-radius: var(--radius); font-size: 13px; margin-bottom: 16px; font-weight: 500; }
.alert-error   { background: rgba(240,82,82,.08);  color: #fca5a5; border: 1px solid rgba(240,82,82,.2); }
.alert-success { background: rgba(34,212,122,.08); color: #86efac; border: 1px solid rgba(34,212,122,.2); }

/* ── Responsive ── */
@media (max-width: 768px) {
    .sidebar { width: 200px; }
    .main { margin-left: 200px; padding: 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
    .sidebar { display: none; }
    .main { margin-left: 0; }
}
