/* ═══════════════════════════════════════════════════════════════════════════
   Roumonitor — Global Stylesheet
   Dark theme, CSS Variables, no framework dependency.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Google Fonts are loaded in base.html.twig ── */

/* ── CSS Variables ─────────────────────────────────────────────────────────── */
:root {
    /* Background */
    --bg-base:      #0a0c14;
    --bg-card:      #111420;
    --bg-card-alt:  #161a28;
    --bg-hover:     #1a1f30;
    --bg-input:     #0d1020;

    /* Borders */
    --border:       #1e2438;
    --border-light: #252b40;

    /* Text */
    --text-primary: #e8eaf0;
    --text-muted:   #5a6280;
    --text-dim:     #3a4060;

    /* Accent — electric indigo */
    --accent:       #6c63ff;
    --accent-glow:  rgba(108, 99, 255, 0.25);
    --accent-soft:  rgba(108, 99, 255, 0.12);

    /* Semantic colors */
    --danger:       #ff4d6d;
    --danger-soft:  rgba(255, 77, 109, 0.15);
    --warning:      #f59e0b;
    --warning-soft: rgba(245, 158, 11, 0.15);
    --success:      #10b981;
    --success-soft: rgba(16, 185, 129, 0.15);
    --info:         #38bdf8;
    --info-soft:    rgba(56, 189, 248, 0.15);

    /* Roulette colors */
    --rou-red:      #e63946;
    --rou-red-soft: rgba(230, 57, 70, 0.18);
    --rou-black:    #2d2d3a;
    --rou-green:    #2dc653;

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

    /* Layout */
    --radius-sm:  6px;
    --radius:     10px;
    --radius-lg:  16px;
    --radius-xl:  22px;
    --max-w:      960px;

    /* Transitions */
    --transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family:      var(--font-sans);
    background-color: var(--bg-base);
    color:            var(--text-primary);
    line-height:      1.6;
    min-height:       100vh;
    -webkit-font-smoothing: antialiased;
}

[x-cloak] { display: none !important; }

/* ── Top Header (Mobile Optimized) ─────────────────────────────────────────── */
.top-header {
    position:         sticky;
    top:              0;
    z-index:          100;
    background:       rgba(10, 12, 20, 0.95);
    backdrop-filter:  blur(12px);
    border-bottom:    1px solid var(--border);
    padding:          0.75rem 1rem;
}

.header-inner {
    max-width:      var(--max-w);
    margin:         0 auto;
    display:        flex;
    align-items:    center;
    justify-content: space-between;
}

.header-brand {
    display:     flex;
    align-items: center;
    gap:         0.75rem;
    text-decoration: none;
}

.header-logo {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-soft);
    border: 1px solid var(--accent);
    color: var(--accent);
}

.header-title {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    line-height: 1.2;
}

.header-subtitle {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ── Dot Menu ──────────────────────────────────────────────────────────────── */
.dot-menu-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
}
.dot-menu-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

.dot-menu-panel {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    width: 200px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 0.35rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
    z-index: 999;
    display: flex;
    flex-direction: column;
}

.dot-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
    border: none;
    background: transparent;
    cursor: pointer;
    text-align: left;
    width: 100%;
}
.dot-menu-item:hover { background: var(--bg-hover); }
.dot-menu-item svg { opacity: 0.7; }

.dot-menu-divider {
    height: 1px;
    background: var(--border);
    margin: 0.25rem 0;
}

/* ── Layout ────────────────────────────────────────────────────────────────── */
.main-content { padding: 1.5rem 1rem 4rem; }

.container {
    max-width: var(--max-w);
    margin:    0 auto;
}

.footer {
    text-align:  center;
    padding:     1rem;
    font-size:   0.7rem;
    color:       var(--text-dim);
    border-top:  1px solid var(--border);
    display:     flex;
    gap:         0.75rem;
    justify-content: center;
    align-items: center;
}

.footer-env {
    background:  var(--warning-soft);
    color:       var(--warning);
    padding:     0.1rem 0.4rem;
    border-radius: 4px;
    font-size:   0.65rem;
    font-weight: 700;
    letter-spacing: 0.06em;
}

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.card {
    background:    var(--bg-card);
    border:        1px solid var(--border);
    border-radius: var(--radius-lg);
    padding:       1.25rem;
}

.card--alt   { background: var(--bg-card-alt); }
.card--hover { cursor: pointer; transition: border-color var(--transition), transform var(--transition); }
.card--hover:hover { border-color: var(--border-light); transform: translateY(-1px); }

.card-title {
    font-size:   0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color:       var(--text-muted);
    margin-bottom: 1rem;
    display:     flex;
    align-items: center;
    gap:         0.5rem;
}

/* ── Tab Navigation ────────────────────────────────────────────────────────── */
.tab-nav {
    display:        flex;
    gap:            0.375rem;
    margin-bottom:  1.25rem;
    overflow-x:     auto;
    padding-bottom: 2px;
    scrollbar-width: none;
}
.tab-nav::-webkit-scrollbar { display: none; }

.tab-btn {
    padding:        0.5rem 1rem;
    border-radius:  var(--radius);
    font-size:      0.75rem;
    font-weight:    700;
    white-space:    nowrap;
    cursor:         pointer;
    border:         1px solid var(--border);
    background:     var(--bg-card);
    color:          var(--text-muted);
    transition:     all var(--transition);
    display:        flex;
    align-items:    center;
    gap:            0.4rem;
}

.tab-btn:hover { color: var(--text-primary); border-color: var(--border-light); }

.tab-btn--active {
    background:  var(--accent);
    color:       #fff;
    border-color: var(--accent);
    box-shadow:  0 0 16px var(--accent-glow);
}

.tab-dot {
    width:         8px;
    height:        8px;
    border-radius: 50%;
    background:    currentColor;
    flex-shrink:   0;
}

.tab-dot--pulse { animation: pulse 1.8s infinite; }

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.5; transform: scale(0.75); }
}

/* ── Summary Bar ───────────────────────────────────────────────────────────── */
.summary-bar {
    display:       flex;
    align-items:   center;
    gap:           1.5rem;
    padding:       1rem 1.25rem;
    background:    var(--bg-card);
    border:        1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 1.25rem;
    flex-wrap:     wrap;
}

.summary-stat { display: flex; flex-direction: column; gap: 0.125rem; }

.summary-label {
    font-size:   0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color:       var(--text-muted);
}

.summary-value {
    font-size:   1.4rem;
    font-weight: 800;
    font-family: var(--font-mono);
    letter-spacing: -0.03em;
    color:       var(--text-primary);
}

.summary-last { margin-left: auto; display: flex; flex-direction: column; align-items: center; gap: 0.25rem; }

/* ── Number Badges ─────────────────────────────────────────────────────────── */
.number-badge {
    display:       inline-flex;
    align-items:   center;
    justify-content: center;
    width:         2rem;
    height:        2rem;
    border-radius: 50%;
    font-family:   var(--font-mono);
    font-size:     0.8rem;
    font-weight:   700;
    cursor:        pointer;
    transition:    transform var(--transition), box-shadow var(--transition);
    border:        1px solid transparent;
    flex-shrink:   0;
}

.number-badge:hover { transform: scale(1.1); }

.number-badge--red {
    background: var(--rou-red-soft);
    color:      var(--rou-red);
    border-color: rgba(230, 57, 70, 0.3);
}

.number-badge--black {
    background: rgba(45, 45, 58, 0.6);
    color:      #a0a8c0;
    border-color: rgba(255,255,255,0.08);
}

.number-badge--green {
    background: rgba(45, 198, 83, 0.15);
    color:      var(--rou-green);
    border-color: rgba(45, 198, 83, 0.3);
}

.number-badge--lg { width: 2.75rem; height: 2.75rem; font-size: 1.1rem; border-radius: 50%; }
.number-badge--sm { width: 1.5rem; height: 1.5rem; font-size: 0.6rem; border-radius: 50%; }

/* ── Progress / Absence Bar ────────────────────────────────────────────────── */
.absence-bar {
    height:        5px;
    border-radius: 99px;
    background:    var(--border);
    overflow:      hidden;
    margin-top:    0.375rem;
}

.absence-bar__fill {
    height:        100%;
    border-radius: 99px;
    background:    var(--success);
    transition:    width 0.4s ease, background 0.4s ease;
}

.absence-bar__fill--warn    { background: var(--warning); }
.absence-bar__fill--danger  { background: var(--danger); }
.absence-bar__fill--record  { background: linear-gradient(90deg, var(--danger), #ff00ff); }

/* ── Grid Layouts ──────────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 0.5rem; }

@media (max-width: 640px) {
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
}

/* ── Modal Overlay ─────────────────────────────────────────────────────────── */
.modal-overlay {
    position:   fixed;
    inset:      0;
    z-index:    200;
    background: rgba(5, 7, 14, 0.8);
    backdrop-filter: blur(4px);
    display:    flex;
    align-items: center;
    justify-content: center;
    padding:    1rem;
}

.modal-box {
    background:    var(--bg-card);
    border:        1px solid var(--border-light);
    border-radius: var(--radius-xl);
    width:         100%;
    max-width:     420px;
    max-height:    85vh;
    overflow-y:    auto;
    box-shadow:    0 24px 64px rgba(0,0,0,0.7);
    animation:     modalIn 0.2s ease;
}

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

.modal-header {
    padding:         1rem 1.25rem;
    border-bottom:   1px solid var(--border);
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    position:        sticky;
    top:             0;
    background:      var(--bg-card);
    border-radius:   var(--radius-xl) var(--radius-xl) 0 0;
}

.modal-close {
    width:         28px;
    height:        28px;
    border-radius: 50%;
    background:    var(--bg-hover);
    border:        none;
    color:         var(--text-muted);
    cursor:        pointer;
    font-size:     1rem;
    display:       flex;
    align-items:   center;
    justify-content: center;
    transition:    background var(--transition);
}
.modal-close:hover { background: var(--danger-soft); color: var(--danger); }

.modal-body { padding: 1.25rem; }

/* ── Utility ───────────────────────────────────────────────────────────────── */
.text-muted   { color: var(--text-muted); }
.text-dim     { color: var(--text-dim); }
.text-accent  { color: var(--accent); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-success { color: var(--success); }
.text-center  { text-align: center; }
.text-sm      { font-size: 0.8rem; }
.text-xs      { font-size: 0.7rem; }
.font-mono    { font-family: var(--font-mono); }
.font-bold    { font-weight: 700; }

.py-8  { padding-top: 2rem; padding-bottom: 2rem; }
.mb-4  { margin-bottom: 1rem; }
.mb-3  { margin-bottom: 0.75rem; }
.mb-2  { margin-bottom: 0.5rem; }
.mt-1  { margin-top: 0.25rem; }
.mt-2  { margin-top: 0.5rem; }
.mt-3  { margin-top: 0.75rem; }
.gap-2 { gap: 0.5rem; }

.page-title {
    font-size:      1.5rem;
    font-weight:    800;
    letter-spacing: -0.03em;
    margin-bottom:  1.25rem;
}

.badge {
    display:       inline-flex;
    padding:       0.15rem 0.5rem;
    border-radius: 99px;
    font-size:     0.65rem;
    font-weight:   700;
    letter-spacing: 0.04em;
}

.badge--danger  { background: var(--danger-soft);  color: var(--danger); }
.badge--warning { background: var(--warning-soft); color: var(--warning); }
.badge--success { background: var(--success-soft); color: var(--success); }
.badge--info    { background: var(--info-soft);    color: var(--info); }
.badge--accent  { background: var(--accent-soft);  color: var(--accent); }

/* Danger score gradient helper classes — set via JS/PHP */
.score-safe   { --score-color: var(--success); }
.score-warn   { --score-color: var(--warning); }
.score-danger { --score-color: var(--danger); }
.score-record { --score-color: #ff00ff; }

/* Scrollbar */
::-webkit-scrollbar       { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 99px; }
