/* ============================================
   TRACKROOM DASHBOARD - Glassmorphism v4.0
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg-gradient: linear-gradient(135deg, #162d4a 0%, #1e3a5f 50%, #152840 100%);
    --bg-card: rgba(255, 255, 255, 0.06);
    --bg-input: rgba(0, 0, 0, 0.25);
    --bg-hover: rgba(255, 255, 255, 0.10);
    
    --accent: #00d4aa;
    --accent-hover: #00b894;
    --accent-glow: rgba(0, 212, 170, 0.3);
    
    --success: #00d4aa;
    --warning: #ffc107;
    --danger: #ff6b6b;
    --info: #74b9ff;
    
    --text: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
    
    --border: rgba(255, 255, 255, 0.1);
    --border-light: rgba(255, 255, 255, 0.05);
    
    --glass: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --blur: blur(20px);
    
    --sidebar-width: 260px;
}

html, body { height: 100%; }

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    display: flex;
    min-height: 100vh;
}

a { text-decoration: none; color: inherit; }

/* ========== SIDEBAR ========== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-card);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    border-right: 1px solid var(--border);
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 14px;
}

.sidebar-logo {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--accent), #00b894);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.sidebar-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
    list-style: none;
}

.nav-item { margin-bottom: 4px; }

.nav-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s ease;
}

.nav-item a svg {
    width: 20px;
    height: 20px;
    opacity: 0.7;
    flex-shrink: 0;
}

.nav-item a:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.nav-item a:hover svg { opacity: 1; }

.nav-item a.active {
    background: var(--accent);
    color: #0a2540;
    font-weight: 600;
}

.nav-item a.active svg { opacity: 1; }

.sidebar-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 20px;
}

.sidebar-footer a {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    transition: color 0.2s;
}

.sidebar-footer a:hover { color: var(--text); }

/* ========== MAIN CONTENT ========== */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 20px;
    min-height: 100vh;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

/* ========== TABS ========== */
.tabs {
    display: inline-flex;
    background: var(--bg-card);
    backdrop-filter: var(--blur);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 6px;
    gap: 4px;
}

.tab-link {
    padding: 10px 20px;
    border: none;
    background: transparent;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.tab-link:hover {
    color: var(--text);
    background: var(--bg-hover);
}

.tab-link.active {
    background: var(--accent);
    color: #0a2540;
    font-weight: 600;
}

/* ========== CARDS ========== */
.card {
    background: var(--bg-card);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
}

.card h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

/* ========== CHART ========== */
#chart-container {
    background: var(--bg-card);
    backdrop-filter: var(--blur);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 16px;
    height: 270px;
    margin-bottom: 16px;
}

/* ========== STATS GRID ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.info-card {
    background: var(--bg-card);
    backdrop-filter: var(--blur);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 16px;
    transition: all 0.2s ease;
}

.info-card:hover {
    background: var(--bg-hover);
    transform: translateY(-2px);
}

.info-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.info-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.info-card-icon svg { width: 18px; height: 18px; }

.info-card-header h3 {
    font-size: 13px;
    font-weight: 600;
}

.info-card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--border-light);
}

.stat-row:last-child { border-bottom: none; }
.stat-row span { color: var(--text-secondary); font-size: 12px; }
.stat-row strong { font-weight: 600; font-size: 13px; }
.details-text { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ========== TABLES ========== */
table { width: 100%; border-collapse: collapse; }

th {
    text-align: left;
    padding: 14px 16px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 14px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border-light);
}

tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }

th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]:hover { color: var(--accent); }
th[data-sort]::after { content: '↕'; margin-left: 6px; opacity: 0.3; font-size: 10px; }
th[data-sort].asc::after { content: '↑'; opacity: 1; color: var(--accent); }
th[data-sort].desc::after { content: '↓'; opacity: 1; color: var(--accent); }

/* ========== FORMS ========== */
input, select, textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

input::placeholder { color: var(--text-muted); }


/* ========== BUTTONS ========== */
button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s ease;
}

button[type="submit"], .btn-primary {
    background: linear-gradient(135deg, var(--accent), #00b894);
    color: #0a2540;
    box-shadow: 0 4px 20px var(--accent-glow);
}

button[type="submit"]:hover, .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px var(--accent-glow);
}

.btn-secondary {
    background: var(--bg-hover);
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-secondary:hover { background: var(--bg-card); }

.btn-danger {
    background: rgba(255, 107, 107, 0.2);
    border: 1px solid rgba(255, 107, 107, 0.3);
    color: var(--danger);
}

.btn-danger:hover { background: var(--danger); color: white; }

/* ========== PAGINATION ========== */
.pagination-controls {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.pagination-controls button {
    min-width: 40px;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 13px;
}

.pagination-controls button:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.pagination-controls button.active {
    background: var(--accent);
    color: #0a2540;
    border-color: var(--accent);
}

/* ========== LOGIN PAGE ========== */
.login-page-wrapper {
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-gradient);
    padding: 20px;
}

.login-form {
    background: var(--bg-card);
    backdrop-filter: var(--blur);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    text-align: center;
}

.login-form h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.login-form h2 .logo-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--accent), #00b894);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.login-form p {
    color: var(--text-muted);
    margin-bottom: 32px;
    font-size: 14px;
}

.login-form input { margin-bottom: 16px; }
.login-form button { width: 100%; padding: 14px; font-size: 15px; margin-top: 8px; }

.error {
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.2);
    color: var(--danger);
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 13px;
    margin-bottom: 20px;
}

/* ========== VIEWS ========== */
.content-view {
    display: none;
    animation: fadeIn 0.3s ease;
}

.content-view.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========== UTILITIES ========== */
.d-flex-between { display: flex; justify-content: space-between; align-items: center; }
.d-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.text-muted { color: var(--text-secondary); }

.controls-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.controls-container label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.controls-container select { width: auto; padding: 8px 14px; }

/* Date picker */
.date-range-picker-container {
    display: flex;
    gap: 20px;
    padding: 20px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 20px;
}

.date-input-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.date-input-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.date-input-group input { width: auto; }

/* Highlight animation */
.highlight { animation: pulse 1.5s ease; }

@keyframes pulse {
    0% { background: rgba(0, 212, 170, 0.2); }
    100% { background: transparent; }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1200px) {
    .d-grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 1024px) {
    :root { --sidebar-width: 220px; }
    .main-content { padding: 24px; }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; padding: 16px; }
    .content-header { flex-direction: column; align-items: stretch; }
    .tabs { overflow-x: auto; width: 100%; }
    .stats-grid { grid-template-columns: 1fr; }
}
