/* ═══════════════════════════════════════════════════════════
   NEXUS PROXY ENGINE — Stylesheet v2.0
   Theme: Dark Pro · Deep Space
   ─────────────────────────────────────────────────────────
   Sections:
     1.  Imports & Variables
     2.  Reset & Base
     3.  Scrollbar
     4.  Layout
     5.  Header
     6.  Status Pill
     7.  Main & Section titles
     8.  Stat Cards
     9.  Two-column grid & Cards
    10.  Type bars
    11.  Timer
    12.  Buttons
    13.  Controls & Filters
    14.  Proxy Table
    15.  Empty State
    16.  Toast
    17.  Footer & Spinner
    18.  Login Page
    19.  Animations
    20.  Responsive
═══════════════════════════════════════════════════════════ */

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

:root {
    /* Backgrounds */
    --bg:          #070b14;
    --bg-mesh:     radial-gradient(ellipse at 20% 50%, rgba(37,99,235,0.06) 0%, transparent 60%),
                   radial-gradient(ellipse at 80% 20%, rgba(139,92,246,0.04) 0%, transparent 50%),
                   radial-gradient(ellipse at 50% 100%, rgba(16,185,129,0.03) 0%, transparent 50%);
    --surface:     #0d1220;
    --surface-2:   #141929;
    --surface-3:   #1a2035;
    --glass:       rgba(13,18,32,0.8);

    /* Borders */
    --border:      rgba(255,255,255,0.06);
    --border-2:    rgba(255,255,255,0.1);
    --border-3:    rgba(255,255,255,0.15);

    /* Accent */
    --accent:      #2563eb;
    --accent-h:    #1d4ed8;
    --accent-dim:  rgba(37, 99, 235, 0.15);
    --accent-glow: rgba(37, 99, 235, 0.3);

    /* Semantic */
    --green:       #10b981;
    --green-dim:   rgba(16, 185, 129, 0.12);
    --green-glow:  rgba(16, 185, 129, 0.25);
    --red:         #ef4444;
    --red-dim:     rgba(239, 68, 68, 0.12);
    --yellow:      #f59e0b;
    --yellow-dim:  rgba(245, 158, 11, 0.12);
    --blue:        #3b82f6;
    --blue-dim:    rgba(59, 130, 246, 0.12);
    --cyan:        #06b6d4;
    --cyan-dim:    rgba(6, 182, 212, 0.12);
    --purple:      #8b5cf6;
    --purple-dim:  rgba(139, 92, 246, 0.12);
    --orange:      #f97316;
    --orange-dim:  rgba(249, 115, 22, 0.12);

    /* Text */
    --text:        #f0f4ff;
    --text-2:      #9aa5c4;
    --muted:       #4a5578;
    --muted-2:     #2d3654;

    /* Typography */
    --font:        'Inter', system-ui, sans-serif;
    --mono:        'JetBrains Mono', 'Fira Code', monospace;

    /* Shape */
    --radius:      12px;
    --radius-sm:   8px;
    --radius-xs:   5px;
    --radius-lg:   16px;

    /* Transitions */
    --t:           180ms ease;
    --t-slow:      400ms ease;
}

/* ── 2. RESET & BASE ────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    background: var(--bg);
    background-image: var(--bg-mesh);
    background-attachment: fixed;
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
button { font-family: var(--font); }
input, textarea { font-family: var(--font); }

/* ── 3. SCROLLBAR ───────────────────────────────────────── */
::-webkit-scrollbar              { width: 4px; height: 4px; }
::-webkit-scrollbar-track        { background: transparent; }
::-webkit-scrollbar-thumb        { background: var(--muted-2); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover  { background: var(--muted); }

/* ── 4. LAYOUT ──────────────────────────────────────────── */
.app {
    display: grid;
    grid-template-rows: auto 1fr auto;
    min-height: 100vh;
}

/* ── 5. HEADER ──────────────────────────────────────────── */
header {
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    background: rgba(7, 11, 20, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.3px;
    color: var(--text);
}

.logo-icon {
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.logo-icon svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: #fff;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.logo-name {
    color: var(--text-2);
    font-weight: 400;
}

.logo-version {
    font-size: 10px;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-dim);
    border: 1px solid rgba(37, 99, 235, 0.3);
    border-radius: var(--radius-xs);
    padding: 2px 7px;
    margin-left: 4px;
    font-family: var(--mono);
    letter-spacing: 0.5px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── 6. STATUS PILL ─────────────────────────────────────── */
.status-pill {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 12px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
    background: var(--surface-2);
    border: 1px solid var(--border-2);
    transition: color var(--t), border-color var(--t), background var(--t);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--muted-2);
    transition: background var(--t), box-shadow var(--t);
    flex-shrink: 0;
}

.status-pill.online {
    color: var(--green);
    border-color: rgba(16, 185, 129, 0.25);
    background: rgba(16, 185, 129, 0.06);
}
.status-pill.running {
    color: var(--yellow);
    border-color: rgba(245, 158, 11, 0.25);
    background: rgba(245, 158, 11, 0.06);
}
.status-pill.fallback {
    color: var(--orange);
    border-color: rgba(249, 115, 22, 0.3);
    background: rgba(249, 115, 22, 0.08);
}
.status-pill.offline {
    color: var(--red);
    border-color: rgba(239, 68, 68, 0.25);
    background: rgba(239, 68, 68, 0.08);
}
.status-pill.online  .status-dot {
    background: var(--green);
    box-shadow: 0 0 6px var(--green-glow);
}
.status-pill.running .status-dot {
    background: var(--yellow);
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.5);
    animation: pulse-dot 1.5s ease infinite;
}
.status-pill.fallback .status-dot {
    background: var(--orange);
    box-shadow: 0 0 6px rgba(249, 115, 22, 0.45);
}
.status-pill.offline .status-dot {
    background: var(--red);
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.45);
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.6; transform: scale(1.3); }
}

/* ── 7. MAIN & SECTION TITLES ───────────────────────────── */
main {
    padding: 28px;
    max-width: 1440px;
    margin: 0 auto;
    width: 100%;
}

.section-title {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ── 8. STAT CARDS ──────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.stats-grid-bottom {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    position: relative;
    overflow: hidden;
    transition: border-color var(--t), transform var(--t), box-shadow var(--t);
    cursor: default;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--c, var(--accent));
    opacity: 0.8;
    border-radius: var(--radius) var(--radius) 0 0;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: -40px;
    right: -20px;
    width: 80px;
    height: 80px;
    background: var(--c, var(--accent));
    opacity: 0.04;
    border-radius: 50%;
    pointer-events: none;
    transition: opacity var(--t-slow);
}

.stat-card:hover {
    border-color: var(--border-2);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.stat-card:hover::after { opacity: 0.09; }

.stat-card.green  { --c: var(--green); }
.stat-card.blue   { --c: var(--blue); }
.stat-card.cyan   { --c: var(--cyan); }
.stat-card.yellow { --c: var(--yellow); }
.stat-card.purple { --c: var(--purple); }
.stat-card.red    { --c: var(--red); }
.stat-card.orange { --c: var(--orange); }

.stat-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.stat-value {
    font-family: var(--mono);
    font-size: 30px;
    font-weight: 600;
    color: var(--text);
    line-height: 1;
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}

.stat-sub {
    font-size: 11px;
    color: var(--muted);
    font-weight: 400;
}

/* ── 9. TWO-COL GRID & CARDS ────────────────────────────── */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    transition: border-color var(--t);
}

.card:hover { border-color: var(--border-2); }

.card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.2px;
}

.card-title .icon {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-3);
    border: 1px solid var(--border-2);
    border-radius: var(--radius-xs);
    color: var(--text-2);
    font-size: 13px;
    flex-shrink: 0;
}

.card-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* ── 10. TYPE BARS ──────────────────────────────────────── */
.type-bars {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.type-bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.type-badge {
    min-width: 60px;
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: var(--radius-xs);
    text-align: center;
    flex-shrink: 0;
    letter-spacing: 0.5px;
}

.type-badge.http   { background: var(--blue-dim);   color: var(--blue);   border: 1px solid rgba(59,130,246,0.2); }
.type-badge.socks5 { background: var(--cyan-dim);   color: var(--cyan);   border: 1px solid rgba(6,182,212,0.2); }
.type-badge.socks4 { background: var(--yellow-dim); color: var(--yellow); border: 1px solid rgba(245,158,11,0.2); }

.bar-track {
    flex: 1;
    height: 5px;
    background: var(--surface-3);
    border-radius: 3px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 1000ms cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--accent);
}

.bar-fill.http   { background: linear-gradient(90deg, var(--blue), #60a5fa); }
.bar-fill.socks5 { background: linear-gradient(90deg, var(--cyan), #22d3ee); }
.bar-fill.socks4 { background: linear-gradient(90deg, var(--yellow), #fcd34d); }

.type-count {
    min-width: 52px;
    text-align: right;
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-2);
}

/* ── 11. TIMER ──────────────────────────────────────────── */
.timer-display {
    text-align: center;
    padding: 10px 0 18px;
}

.timer-value {
    font-family: var(--mono);
    font-size: 48px;
    font-weight: 300;
    color: var(--text);
    letter-spacing: 4px;
    line-height: 1;
    background: linear-gradient(135deg, var(--text) 0%, var(--text-2) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.timer-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--muted);
    margin-top: 8px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.timer-bar-track {
    width: 100%;
    height: 3px;
    background: var(--surface-3);
    border-radius: 2px;
    margin-top: 18px;
    overflow: hidden;
}

.timer-bar-fill {
    height: 100%;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--accent), var(--purple));
    transition: width 1s linear;
}

.last-run {
    font-size: 11px;
    color: var(--muted);
    text-align: center;
    margin-top: 12px;
}

.timer-action {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    text-align: center;
}

/* ── 12. BUTTONS ────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 16px;
    height: 34px;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background var(--t), border-color var(--t), color var(--t),
                transform 120ms ease, box-shadow var(--t);
    white-space: nowrap;
    line-height: 1;
    letter-spacing: -0.1px;
    text-decoration: none;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.btn-primary:hover {
    background: var(--accent-h);
    border-color: var(--accent-h);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.5);
}
.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
    box-shadow: none;
}

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

.btn-ghost:hover {
    background: var(--surface-3);
    border-color: var(--border-3);
    color: var(--text);
}

.btn-danger {
    background: transparent;
    border-color: var(--border-2);
    color: var(--text-2);
}

.btn-danger:hover {
    border-color: rgba(239, 68, 68, 0.4);
    color: var(--red);
    background: rgba(239, 68, 68, 0.06);
}

.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }

/* Les liens stylisés en bouton doivent hériter du display */
a.btn { display: inline-flex; text-decoration: none; }

/* ── 13. CONTROLS & FILTERS ─────────────────────────────── */
.controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.filter-group {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0 12px;
    height: 28px;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    background: transparent;
    border: 1px solid var(--border-2);
    color: var(--muted);
    transition: all var(--t);
}

.filter-btn:hover {
    color: var(--text-2);
    border-color: var(--border-3);
    background: var(--surface-3);
}

.filter-btn.active {
    background: var(--accent-dim);
    border-color: rgba(37, 99, 235, 0.35);
    color: var(--blue);
}

.search-box {
    flex: 1;
    min-width: 160px;
    height: 32px;
    background: var(--surface-3);
    border: 1px solid var(--border-2);
    border-radius: var(--radius-sm);
    padding: 0 12px;
    color: var(--text);
    font-family: var(--mono);
    font-size: 12px;
    outline: none;
    transition: border-color var(--t), box-shadow var(--t);
}

.search-box:focus {
    border-color: rgba(37, 99, 235, 0.5);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.search-box::placeholder  { color: var(--muted); }

.filter-actions { display: flex; gap: 6px; }

/* ── 14. PROXY TABLE ────────────────────────────────────── */
.table-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 24px;
    transition: border-color var(--t);
}

.table-card:hover { border-color: var(--border-2); }

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

.table-count {
    font-size: 12px;
    color: var(--muted);
    font-family: var(--mono);
    background: var(--surface-3);
    border: 1px solid var(--border-2);
    padding: 2px 10px;
    border-radius: 99px;
}

.proxy-table-wrap {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 460px;
}

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

thead th {
    padding: 9px 14px;
    text-align: left;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--muted);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1;
    white-space: nowrap;
}

tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    transition: background var(--t);
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover      { background: var(--surface-3); }

tbody td {
    padding: 9px 14px;
    font-size: 12px;
}

.td-index {
    color: var(--muted);
    font-family: var(--mono);
    font-size: 10px;
    width: 40px;
}

.proxy-addr {
    font-family: var(--mono);
    color: var(--text);
    font-size: 12px;
}

/* Badges */
.latency-badge, .anon-badge, .type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-xs);
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.latency-badge.fast   { background: var(--green-dim);  color: var(--green);  border: 1px solid rgba(16,185,129,0.2); }
.latency-badge.medium { background: var(--yellow-dim); color: var(--yellow); border: 1px solid rgba(245,158,11,0.2); }
.latency-badge.slow   { background: var(--red-dim);    color: var(--red);    border: 1px solid rgba(239,68,68,0.2); }

.anon-badge.elite       { background: var(--purple-dim); color: var(--purple); border: 1px solid rgba(139,92,246,0.2); }
.anon-badge.anonymous   { background: var(--cyan-dim);   color: var(--cyan);   border: 1px solid rgba(6,182,212,0.2); }
.anon-badge.transparent { background: var(--surface-3);  color: var(--muted);  border: 1px solid var(--border-2); }

.copy-btn {
    background: none;
    border: 1px solid transparent;
    cursor: pointer;
    color: var(--muted);
    font-size: 11px;
    font-family: var(--font);
    font-weight: 600;
    padding: 3px 8px;
    border-radius: var(--radius-xs);
    transition: color var(--t), background var(--t), border-color var(--t);
}

.copy-btn:hover {
    color: var(--text-2);
    background: var(--surface-3);
    border-color: var(--border-2);
}

.table-overflow {
    text-align: center;
    color: var(--muted);
    padding: 14px;
    font-size: 12px;
    background: var(--bg);
    border-top: 1px solid var(--border);
    font-family: var(--mono);
}

.row-flag {
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.row-flag.fresh {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: var(--green);
}

.row-flag.stale {
    background: rgba(249, 115, 22, 0.12);
    border: 1px solid rgba(249, 115, 22, 0.2);
    color: var(--orange);
}

/* ── 15. EMPTY STATE ────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 64px 24px;
    color: var(--muted);
}

.empty-state .icon {
    font-size: 36px;
    display: block;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state p {
    font-size: 13px;
    color: var(--muted);
    max-width: 240px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ── 16. TOAST ──────────────────────────────────────────── */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 9999;
    pointer-events: none;
}

.toast {
    padding: 11px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border-2);
    border-left: 3px solid var(--accent);
    max-width: 300px;
    animation: toastIn 0.25s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    pointer-events: all;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    backdrop-filter: blur(12px);
}

.toast.success { border-left-color: var(--green); }
.toast.error   { border-left-color: var(--red); }
.toast.info    { border-left-color: var(--accent); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(20px) scale(0.95); }
    to   { opacity: 1; transform: translateX(0) scale(1); }
}

/* ── 17. FOOTER & SPINNER ───────────────────────────────── */
footer {
    padding: 14px 28px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: rgba(7,11,20,0.6);
    backdrop-filter: blur(8px);
}

.footer-left  { display: flex; align-items: center; gap: 16px; }
.footer-url   { font-family: var(--mono); color: var(--muted-2); font-size: 10px; }

.spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 1.5px solid rgba(255, 255, 255, 0.12);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.65s linear infinite;
    flex-shrink: 0;
    vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── 18. LOGIN PAGE ─────────────────────────────────────── */
body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
    background-image:
        radial-gradient(ellipse at 30% 40%, rgba(37,99,235,0.12) 0%, transparent 55%),
        radial-gradient(ellipse at 75% 65%, rgba(139,92,246,0.08) 0%, transparent 45%);
}

.login-wrap {
    width: 100%;
    max-width: 380px;
    padding: 16px;
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border-2);
    border-radius: var(--radius-lg);
    padding: 36px;
    box-shadow: 0 24px 80px rgba(0,0,0,0.6),
                0 0 0 1px rgba(255,255,255,0.04) inset;
}

.login-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 30px;
}

.login-logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.login-logo-icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: #fff;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.login-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
    letter-spacing: -0.3px;
}

.login-subtitle {
    font-size: 12px;
    color: var(--muted);
    margin-top: 3px;
}

/* Divider */
.login-divider {
    height: 1px;
    background: var(--border);
    margin-bottom: 28px;
}

/* Form */
.form-group { margin-bottom: 18px; }

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: 7px;
    letter-spacing: 0.2px;
}

.form-input-wrap { position: relative; }

.form-input {
    width: 100%;
    height: 40px;
    padding: 0 40px 0 14px;
    background: var(--surface-2);
    border: 1px solid var(--border-2);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--mono);
    font-size: 14px;
    outline: none;
    transition: border-color var(--t), box-shadow var(--t);
}

.form-input:focus {
    border-color: rgba(37, 99, 235, 0.6);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.form-input.shake {
    animation: shake 0.38s ease;
    border-color: var(--red) !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12) !important;
}

@keyframes shake {
    0%, 100%  { transform: translateX(0); }
    20%, 60%  { transform: translateX(-7px); }
    40%, 80%  { transform: translateX(7px); }
}

.eye-btn {
    position: absolute;
    right: 0;
    top: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    transition: color var(--t);
}

.eye-btn:hover { color: var(--text-2); }

.btn-login {
    width: 100%;
    height: 40px;
    background: linear-gradient(135deg, var(--accent) 0%, #1d4ed8 100%);
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    color: #fff;
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--t);
    margin-top: 8px;
    letter-spacing: -0.1px;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
}

.btn-login:hover:not(:disabled) {
    box-shadow: 0 6px 24px rgba(37, 99, 235, 0.55);
    transform: translateY(-1px);
}
.btn-login:active         { transform: scale(0.98); }
.btn-login:disabled       { opacity: 0.45; cursor: not-allowed; box-shadow: none; transform: none; }
.btn-login.success {
    background: linear-gradient(135deg, var(--green) 0%, #059669 100%);
    border-color: var(--green);
    box-shadow: 0 4px 16px var(--green-glow);
}

.error-msg {
    display: none;
    margin-top: 14px;
    padding: 10px 14px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-sm);
    color: var(--red);
    font-size: 12px;
    text-align: center;
    animation: fadeIn 0.2s ease;
}

.error-msg.show { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.attempts-info {
    margin-top: 10px;
    font-size: 11px;
    color: var(--muted);
    text-align: center;
    min-height: 1.4em;
}

.attempts-info.warn   { color: var(--yellow); }
.attempts-info.danger { color: var(--red); }

.login-footer {
    margin-top: 28px;
    text-align: center;
    font-size: 11px;
    color: var(--muted-2);
}

/* ── 19. ANIMATIONS ─────────────────────────────────────── */
.fade-in {
    animation: fadeIn 0.3s ease forwards;
}

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

.stat-value.updated {
    animation: countUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Skeleton loader */
.skeleton {
    background: linear-gradient(90deg,
        var(--surface-2) 25%,
        var(--surface-3) 50%,
        var(--surface-2) 75%);
    background-size: 200% 100%;
    animation: skeleton-wave 1.5s ease infinite;
    border-radius: 4px;
    color: transparent !important;
}

@keyframes skeleton-wave {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── 20. RESPONSIVE ─────────────────────────────────────── */
@media (max-width: 1100px) {
    .stats-grid,
    .stats-grid-bottom { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 900px) {
    .two-col { grid-template-columns: 1fr; }
    .stats-grid,
    .stats-grid-bottom { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    header { padding: 0 16px; }
    main   { padding: 16px; }

    /* Sur mobile, masquer le badge de version dans le logo */
    .logo-version { display: none; }

    .stats-grid,
    .stats-grid-bottom { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-value        { font-size: 24px; }

    .controls { flex-direction: column; align-items: stretch; }
    .filter-group { flex-wrap: wrap; }
    .search-box { min-width: unset; }
    .filter-actions { justify-content: stretch; }
    .filter-actions .btn { flex: 1; }

    footer { flex-direction: column; gap: 4px; align-items: flex-start; }
    .footer-url { display: none; }
}
