/* ============================================
   TIR SPORTIF - COMPLETE DARK THEME
   ============================================ */

/* === Reset & Variables === */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --bg-body: #0d0f14;
    --bg-primary: #161a22;
    --bg-secondary: #1e2430;
    --bg-card: #1e2430;
    --bg-card-hover: #252d3a;
    --bg-input: #0d0f14;
    --bg-sidebar: #161a22;
    --bg-topbar: #161a22;
    --accent: #e8a020;
    --accent-hover: #f0b840;
    --accent2: #c07010;
    --accent-blue: #4090e8;
    --accent-blue-hover: #5aa0f0;
    --accent-green: #40c870;
    --accent-green-hover: #55d98d;
    --accent-yellow: #f0c040;
    --accent-red: #e84040;
    --accent-orange: #e8a020;
    --text-primary: #d4d8e0;
    --text-secondary: #8a90a0;
    --text-muted: #7a8090;
    --text-heading: #e8ecf0;
    --border-color: #2a3040;
    --border-light: #354050;
    --sidebar-w: 260px;
    --topbar-h: 64px;
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow: 0 4px 24px rgba(0,0,0,0.5);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.5);
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html { scroll-behavior: smooth; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; }
h1, h2, h3, h4, h5, h6 { color: var(--text-heading); line-height: 1.3; }

/* === Scrollbar === */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============================================
   AUTH PAGES (Login, Change password)
   ============================================ */
.auth-container {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; padding: 24px;
    background: radial-gradient(ellipse 60% 40% at 50% 0%, rgba(232,160,32,0.08) 0%, transparent 70%), var(--bg-body);
}
.auth-box {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    width: 100%; max-width: 420px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}
.auth-box::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent), var(--accent-blue), var(--accent));
}
.auth-box h1 {
    margin-bottom: 4px; color: var(--text-heading);
    font-size: 28px; font-weight: 700; letter-spacing: -0.5px;
}
.auth-box .subtitle { color: var(--text-muted); margin-bottom: 32px; font-size: 14px; }
.auth-box .logo-icon { font-size: 56px; color: var(--accent); margin-bottom: 20px; display: block; }

/* ============================================
   LAYOUT - Sidebar + Main
   ============================================ */
.app-container { display: flex; min-height: 100vh; }

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-sidebar);
    display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; height: 100vh;
    z-index: 200;
    transition: transform var(--transition);
    border-right: 1px solid var(--border-color);
    overflow: hidden;
}
.sidebar.collapsed { transform: translateX(calc(-1 * var(--sidebar-w))); }

.sidebar-header {
    padding: 20px 24px;
    display: flex; align-items: center; gap: 14px;
    border-bottom: 1px solid var(--border-color);
    min-height: 64px;
    background: linear-gradient(135deg, rgba(232,160,32,0.08), transparent);
}
.sidebar-header i.fa-crosshairs {
    font-size: 28px; color: var(--accent);
    filter: drop-shadow(0 0 8px rgba(232,160,32,0.4));
}
.sidebar-title {
    font-size: 20px; font-weight: 800; color: var(--text-heading);
    letter-spacing: -0.5px;
}
.sidebar-toggle {
    display: none; background: none; border: none;
    color: var(--text-secondary); cursor: pointer; font-size: 18px;
    margin-left: auto; padding: 4px;
}

/* Nav menu */
.nav-menu {
    list-style: none; flex: 1;
    padding: 16px 12px; overflow-y: auto;
    display: flex; flex-direction: column; gap: 2px;
}
.nav-link {
    display: flex; align-items: center; gap: 14px;
    padding: 11px 16px;
    color: var(--text-secondary);
    transition: all var(--transition);
    border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 500;
    position: relative;
}
.nav-link:hover {
    background: rgba(232,160,32,0.08);
    color: var(--text-primary);
}
.nav-link:hover i { color: var(--accent); }
.nav-link i {
    width: 22px; text-align: center;
    font-size: 16px; color: var(--text-muted);
    transition: color var(--transition);
}
.nav-link.active, .nav-link[aria-current="page"] {
    background: rgba(232,160,32,0.12);
    color: var(--accent);
}
.nav-link.active i { color: var(--accent); }
.nav-separator { height: 1px; background: var(--border-color); margin: 10px 16px; }

/* Sidebar footer */
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    background: rgba(0,0,0,0.15);
}
.user-info {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 10px;
    color: var(--text-secondary); font-size: 13px;
}
.user-info i { font-size: 20px; color: var(--accent); }
.logout-link { font-size: 13px; color: var(--text-muted) !important; }
.logout-link:hover { color: var(--accent) !important; }

/* --- Main content --- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    transition: margin-left var(--transition);
    min-height: 100vh;
    display: flex; flex-direction: column;
    background: var(--bg-body);
}
.main-content.expanded { margin-left: 0; }

/* Top bar */
.top-bar {
    padding: 0 28px;
    display: flex; align-items: center; gap: 16px;
    min-height: var(--topbar-h);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-topbar);
    position: sticky; top: 0; z-index: 50;
    backdrop-filter: blur(12px);
}
.mobile-toggle {
    display: none; background: none; border: none;
    color: var(--text-primary); cursor: pointer; font-size: 22px;
    padding: 4px 8px; border-radius: var(--radius-sm);
}
.mobile-toggle:hover { background: var(--bg-card); }
.page-title {
    font-size: 20px; font-weight: 700; flex: 1;
    color: var(--text-heading); letter-spacing: -0.3px;
}
.top-actions { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }

/* Content area */
.content { padding: 28px; flex: 1; max-width: 1400px; width: 100%; }

/* Overlay for mobile sidebar */
.sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.6); z-index: 150;
    backdrop-filter: blur(2px);
}
.sidebar-overlay.visible { display: block; }

/* === Responsive === */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(calc(-1 * var(--sidebar-w))); }
    .sidebar.open { transform: translateX(0); }
    .sidebar.collapsed { transform: translateX(calc(-1 * var(--sidebar-w))); }
    .sidebar-toggle { display: block; }
    .mobile-toggle { display: flex; }
    .main-content { margin-left: 0 !important; }
    .content { padding: 20px; }
}
@media (max-width: 600px) {
    .content { padding: 16px; }
    .top-bar { padding: 0 16px; }
    .top-actions { gap: 6px; }
    .top-actions .btn-sm span { display: none; }
}

/* ============================================
   FORMS
   ============================================ */
.form-group { margin-bottom: 20px; }
.form-group label {
    display: block; margin-bottom: 8px;
    font-size: 13px; color: var(--text-secondary);
    font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.5px;
}
.form-control {
    width: 100%; padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px; font-family: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(232,160,32,0.15);
}
.form-control::placeholder { color: var(--text-muted); }
select.form-control {
    appearance: none; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235a6577' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}
textarea.form-control { resize: vertical; min-height: 100px; line-height: 1.5; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
@media (max-width: 600px) {
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px; padding: 11px 22px;
    border-radius: var(--radius-sm); border: none;
    cursor: pointer; font-size: 14px;
    font-weight: 600; font-family: inherit;
    transition: all var(--transition);
    text-decoration: none; white-space: nowrap;
    line-height: 1.4;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #c0392b);
    color: white;
    box-shadow: 0 2px 8px rgba(232,160,32,0.3);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-hover), var(--accent));
    color: white;
    box-shadow: 0 4px 16px rgba(232,160,32,0.4);
    transform: translateY(-1px);
}
.btn-secondary {
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--border-light);
}
.btn-success {
    background: linear-gradient(135deg, var(--accent-green), #27ae60);
    color: white;
    box-shadow: 0 2px 8px rgba(46,204,113,0.3);
}
.btn-success:hover {
    background: linear-gradient(135deg, var(--accent-green-hover), var(--accent-green));
    color: white;
}
.btn-danger {
    background: var(--accent-red); color: white;
    box-shadow: 0 2px 8px rgba(231,76,60,0.3);
}
.btn-danger:hover { background: #c0392b; color: white; }
.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-xs { padding: 4px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px 10px; }
.btn i { font-size: 13px; }

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    transition: border-color var(--transition);
}
.card:hover { border-color: var(--border-light); }
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px; gap: 12px;
}
.card-title {
    font-size: 16px; font-weight: 700; color: var(--text-heading);
    display: flex; align-items: center; gap: 10px;
}
.card-title i { color: var(--accent); font-size: 15px; }
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

/* ============================================
   STAT CARDS (Dashboard)
   ============================================ */
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}
.stat-card::after {
    content: '';
    position: absolute; top: 0; right: 0;
    width: 80px; height: 80px;
    background: radial-gradient(circle, rgba(232,160,32,0.06), transparent);
    border-radius: 50%;
    transform: translate(20px, -20px);
}
.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
    border-color: var(--border-light);
}
.stat-card .stat-icon {
    font-size: 28px; color: var(--accent);
    margin-bottom: 12px; opacity: 0.8;
}
.stat-card .stat-value {
    font-size: 36px; font-weight: 800;
    color: var(--text-heading);
    letter-spacing: -1px;
    line-height: 1.1;
}
.stat-card .stat-label {
    font-size: 13px; color: var(--text-muted);
    margin-top: 6px; text-transform: uppercase;
    letter-spacing: 0.5px; font-weight: 600;
}

/* ============================================
   TABLES
   ============================================ */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-sm);
}
table { width: 100%; border-collapse: collapse; }
th {
    padding: 12px 18px; text-align: left;
    background: var(--bg-body);
    color: var(--text-muted);
    font-weight: 700; font-size: 11px;
    text-transform: uppercase; letter-spacing: 1px;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}
td {
    padding: 14px 18px; font-size: 14px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}
tr { transition: background var(--transition); }
tr:hover td {
    background: rgba(232,160,32,0.04);
    color: var(--text-primary);
}
tr:last-child td { border-bottom: none; }

/* ============================================
   ALERTS
   ============================================ */
.alert {
    padding: 14px 18px; border-radius: var(--radius-sm);
    margin-bottom: 20px; font-size: 14px;
    display: flex; align-items: center; gap: 10px;
    border: 1px solid transparent;
    font-weight: 500;
}
.alert i { font-size: 16px; flex-shrink: 0; }
.alert-error {
    background: rgba(231,76,60,0.12);
    border-color: rgba(231,76,60,0.3);
    color: #ff6b6b;
}
.alert-success {
    background: rgba(46,204,113,0.12);
    border-color: rgba(46,204,113,0.3);
    color: #69f0ae;
}
.alert-warning {
    background: rgba(243,156,18,0.12);
    border-color: rgba(243,156,18,0.3);
    color: #ffd93d;
}
.alert-info {
    background: rgba(26,115,232,0.12);
    border-color: rgba(26,115,232,0.3);
    color: #64b5f6;
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-flex; align-items: center;
    padding: 4px 12px; border-radius: 20px;
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.badge-primary { background: rgba(26,115,232,0.15); color: var(--accent-blue); }
.badge-success { background: rgba(46,204,113,0.15); color: var(--accent-green); }
.badge-warning { background: rgba(232,160,32,0.15); color: var(--accent); }
.badge-danger { background: rgba(231,76,60,0.15); color: var(--accent-red); }

/* ============================================
   UPLOAD ZONE
   ============================================ */
.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    padding: 48px 24px; text-align: center;
    cursor: pointer; transition: all var(--transition);
    position: relative;
    background: var(--bg-input);
}
.upload-zone:hover, .upload-zone.drag-over {
    border-color: var(--accent);
    background: rgba(232,160,32,0.04);
}
.upload-zone:hover i { color: var(--accent); transform: translateY(-4px); }
.upload-zone i {
    font-size: 52px; color: var(--text-muted);
    margin-bottom: 16px; display: block;
    transition: all var(--transition);
}
.upload-zone p { color: var(--text-secondary); margin-bottom: 4px; }
.upload-zone p strong { color: var(--text-primary); }
.upload-zone input[type="file"] {
    position: absolute; inset: 0; opacity: 0; cursor: pointer;
}

/* ============================================
   SCORE INPUT
   ============================================ */
.score-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
}
.score-input {
    width: 100%; padding: 10px; text-align: center;
    background: var(--bg-input);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-heading);
    font-size: 18px; font-weight: 700;
    font-family: 'SF Mono', 'Fira Code', monospace;
    transition: all var(--transition);
}
.score-input:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px rgba(232,160,32,0.15);
}
.series-header {
    display: flex; align-items: center; justify-content: space-between;
    margin: 24px 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}
.series-header h3, .series-header h4 { font-size: 16px; }
.series-total {
    font-weight: 800; color: var(--accent);
    font-size: 22px; font-family: 'SF Mono', 'Fira Code', monospace;
}

/* ============================================
   IMPACT ANALYSIS
   ============================================ */
.analysis-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
}
@media (max-width: 900px) { .analysis-container { grid-template-columns: 1fr; } }

.target-viewer {
    position: relative; background: #000;
    border-radius: var(--radius); overflow: hidden;
    border: 1px solid var(--border-color);
}
.target-viewer img { width: 100%; height: auto; display: block; }

.impact-list { max-height: 500px; overflow-y: auto; }
.impact-item {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 8px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    transition: background var(--transition);
}
.impact-item:hover { background: rgba(232,160,32,0.04); }
.impact-item:last-child { border-bottom: none; }
.impact-score {
    font-size: 24px; font-weight: 800; min-width: 48px;
    text-align: center; color: var(--accent);
    font-family: 'SF Mono', 'Fira Code', monospace;
}
.impact-details { flex: 1; }

.confidence-bar {
    height: 5px; border-radius: 3px;
    background: var(--border-color); margin-top: 6px;
    overflow: hidden;
}
.confidence-fill { height: 100%; border-radius: 3px; transition: width 0.5s; }
.conf-high { background: linear-gradient(90deg, var(--accent-green), #55d98d); }
.conf-medium { background: linear-gradient(90deg, #f39c12, #fdcb6e); }
.conf-low { background: linear-gradient(90deg, var(--accent-red), #ff7675); }

/* ============================================
   CANVAS ANNOTATION
   ============================================ */
.annotation-canvas-container {
    position: relative; display: inline-block;
    border-radius: var(--radius); overflow: hidden;
    border: 1px solid var(--border-color);
}
.annotation-canvas-container canvas { display: block; cursor: crosshair; }
.annotation-toolbar {
    display: flex; gap: 10px; padding: 14px 16px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    flex-wrap: wrap; align-items: center;
    border: 1px solid var(--border-color);
}
.annotation-toolbar .btn.active {
    box-shadow: 0 0 0 2px var(--accent);
}
#debug-panel table td {
    padding: 2px 8px 2px 0; border-bottom: 1px solid #333;
}

/* ============================================
   CHARTS
   ============================================ */
.chart-container { position: relative; height: 320px; margin: 16px 0; }

/* ============================================
   LOADING & SPINNER
   ============================================ */
.spinner {
    display: inline-block; width: 22px; height: 22px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.8);
    display: flex; align-items: center; justify-content: center;
    z-index: 10000; flex-direction: column; gap: 20px;
    backdrop-filter: blur(6px);
}
.loading-overlay .spinner { width: 52px; height: 52px; border-width: 4px; }
.loading-overlay p { color: white; font-size: 18px; font-weight: 600; }
.loading-overlay p:last-child { color: var(--text-muted); font-size: 14px; font-weight: 400; }

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center; padding: 60px 24px;
    color: var(--text-muted);
}
.empty-state i {
    font-size: 64px; margin-bottom: 20px;
    display: block; opacity: 0.3;
}
.empty-state p {
    font-size: 16px; margin-bottom: 8px;
    color: var(--text-muted);
}

/* ============================================
   UTILITIES
   ============================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted) !important; }
.text-accent { color: var(--accent) !important; }
.text-success { color: var(--accent-green) !important; }
.fw-bold { font-weight: 700; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }

.w-100 { width: 100%; }
.rounded { border-radius: var(--radius); }

/* Score highlight box */
.score-highlight {
    text-align: center;
    padding: 24px;
    background: linear-gradient(135deg, rgba(232,160,32,0.08), rgba(26,115,232,0.08));
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}
.score-highlight .label {
    font-size: 12px; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 1px;
    font-weight: 700; margin-bottom: 4px;
}
.score-highlight .value {
    font-size: 52px; font-weight: 800;
    color: var(--accent);
    font-family: 'SF Mono', 'Fira Code', monospace;
    line-height: 1;
}

/* Profile image */
.profile-img {
    width: 100px; height: 100px;
    border-radius: 50%; object-fit: cover;
    border: 3px solid var(--accent);
    margin-bottom: 16px;
}

/* Grid for training thumbnails */
.thumb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
}
.thumb-card {
    position: relative;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: all var(--transition);
}
.thumb-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}
.thumb-card img {
    width: 100%; height: 120px; object-fit: cover;
    display: block;
}
.thumb-card .thumb-info {
    padding: 10px; font-size: 12px;
    display: flex; align-items: center; gap: 6px;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.card, .stat-card {
    animation: fadeIn 0.3s ease-out;
}
/* ============================================
   DASHBOARD FILTER BAR STYLES
   To be appended to style.css on VPS
   ============================================ */

/* Dashboard filter bar */
.dashboard-filter-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.filter-label i {
    margin-right: 4px;
    color: var(--accent);
}

.filter-select-wrapper {
    position: relative;
}

.filter-select {
    appearance: none;
    -webkit-appearance: none;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    padding: 8px 36px 8px 12px;
    min-width: 220px;
    cursor: pointer;
    transition: var(--transition);
}

.filter-select:hover {
    border-color: var(--accent);
}

.filter-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(232, 160, 32, 0.15);
}

.filter-arrow {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 11px;
    pointer-events: none;
}

.btn-filter-clear {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn-filter-clear:hover {
    color: var(--accent-red);
    border-color: var(--accent-red);
    background: rgba(232, 64, 64, 0.08);
}

.filter-active-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    background: rgba(232, 160, 32, 0.1);
    border: 1px solid rgba(232, 160, 32, 0.25);
    border-radius: 20px;
    margin-left: auto;
}

.filter-active-badge i {
    font-size: 11px;
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard-filter-bar {
        flex-wrap: wrap;
        gap: 10px;
    }
    .filter-select {
        min-width: 180px;
    }
    .filter-active-badge {
        margin-left: 0;
        width: 100%;
        justify-content: center;
    }
}
/* ============================================
   RESPONSIVE FIXES - Mobile
   ============================================ */

/* Fix #1: Sidebar hidden blocks clicks on hamburger button
   Sidebar at z-index 200 intercepts clicks even when off-screen.
   Disable pointer-events when collapsed, re-enable when open. */
@media (max-width: 1024px) {
    .sidebar {
        pointer-events: none;
    }
    .sidebar.open {
        pointer-events: auto;
    }
    /* Overlay also needs pointer-events toggled */
    .sidebar-overlay {
        pointer-events: none;
    }
    .sidebar-overlay.visible {
        pointer-events: auto;
    }
}

/* Fix #2: Cards and tables overflow on narrow screens
   Cards need overflow:hidden so table-container scroll works within them.
   Reduce card padding on mobile for more content space. */
@media (max-width: 600px) {
    .card {
        padding: 14px;
        overflow: hidden;
    }
    th {
        padding: 10px 10px;
        font-size: 10px;
        letter-spacing: 0.5px;
    }
    td {
        padding: 10px 10px;
        font-size: 13px;
    }
    /* Ensure table-container can always scroll */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -14px;
        padding: 0 14px;
    }
}

/* Fix #3: Canvas target tiny/invisible on mobile
   The canvas parent (.canvas-panel) gets height:auto from grid,
   making clientHeight too small. Give canvas-panel a min-height
   based on viewport width so the canvas has room to render. */
@media (max-width: 900px) {
    .canvas-panel {
        min-height: calc(100vw - 24px);
    }
}

@media (max-width: 600px) {
    .canvas-panel {
        min-height: calc(100vw - 16px);
        padding: 8px;
    }
    /* Reduce score totals size */
    .score-totals {
        gap: 6px;
    }
    .total-box {
        padding: 8px;
    }
    .total-box .label {
        font-size: 9px;
    }
    .total-box .value {
        font-size: 1.1rem;
    }
}
