/* ========================================
   TRACKHOUSE RACING MOTOGP - MODERN DESIGN
   ======================================== */

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

:root {
    /* Trackhouse Brand Colors */
    --th-blue: #245BA3;
    --th-red: #DE2731;
    --th-black: #1A1A1A;
    --th-white: #FFFFFF;
    
    /* Dark Theme (Default) */
    --bg-primary: #0A0E1A;
    --bg-secondary: #141824;
    --bg-card: #1E2433;
    --bg-hover: #252B3D;
    
    /* Text Colors */
    --text-primary: #FFFFFF;
    --text-secondary: #A0AEC0;
    --text-muted: #718096;
    
    /* Accent Colors */
    --accent-blue: #4A90E2;
    --accent-green: #48BB78;
    --accent-yellow: #ECC94B;
    --accent-red: #F56565;
    
    /* Shadows & Effects */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px rgba(36, 91, 163, 0.4);
    
    /* Borders */
    --border-color: rgba(255, 255, 255, 0.1);
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 16px;
    --border-radius-xl: 24px;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
}

/* Light Theme */
body.light-theme {
    --bg-primary: #FFFFFF;
    --bg-secondary: #FFFFFF;
    --bg-card: #FFFFFF;
    --bg-hover: #F7FAFC;
    
    --text-primary: #1A202C;
    --text-secondary: #4A5568;
    --text-muted: #718096;
    
    --border-color: rgba(0, 0, 0, 0.12);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.15);
    --shadow-glow: 0 0 20px rgba(36, 91, 163, 0.2);
}

body.light-theme {
    background: linear-gradient(135deg, #FFFFFF 0%, #F7FAFC 100%);
}

body.light-theme::before {
    background: 
        radial-gradient(circle at 20% 50%, rgba(36, 91, 163, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(222, 39, 49, 0.03) 0%, transparent 50%);
}

/* ========================================
   GLOBAL STYLES
   ======================================== */

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, #0d1320 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Animated Background Gradient */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(36, 91, 163, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(222, 39, 49, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.screen {
    display: none;
    position: relative;
    z-index: 1;
}

.screen.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ========================================
   LOGIN SCREEN - MODERN REDESIGN
   ======================================== */

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    position: relative;
}

.login-box {
    background: rgba(30, 36, 51, 0.95);
    backdrop-filter: blur(20px);
    padding: 50px 40px;
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 450px;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.login-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--th-blue), var(--th-red));
}

.logo {
    text-align: center;
    margin-bottom: 40px;
}

.logo img {
    max-width: 280px;
    height: auto;
    filter: drop-shadow(0 4px 12px rgba(36, 91, 163, 0.3));
}

.logo p {
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 500;
    margin-top: 12px;
    letter-spacing: 0.5px;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
    letter-spacing: 0.3px;
}

.form-group label i {
    color: var(--th-blue);
    font-size: 16px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.05);
    border: 1.5px solid var(--border-color);
    border-radius: var(--border-radius-md);
    font-size: 15px;
    color: var(--text-primary);
    transition: all var(--transition-normal);
    font-family: inherit;
}

.form-group select {
    background: rgba(255, 255, 255, 0.1);
    cursor: pointer;
}

.form-group select option {
    background: #1E2433;
    color: #FFFFFF;
    padding: 10px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--th-blue);
    background: rgba(36, 91, 163, 0.08);
    box-shadow: 0 0 0 3px rgba(36, 91, 163, 0.15);
    transform: translateY(-1px);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-group small {
    display: block;
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 12px;
}

/* ========================================
   BUTTONS - MODERN STYLE
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    border: none;
    border-radius: var(--border-radius-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    text-decoration: none;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.3px;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--th-blue), #1a4a8a);
    color: var(--text-primary);
    box-shadow: 0 4px 15px rgba(36, 91, 163, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(36, 91, 163, 0.6);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, var(--th-red), #b91e26);
    color: var(--text-primary);
    box-shadow: 0 4px 15px rgba(222, 39, 49, 0.4);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(222, 39, 49, 0.6);
}

.btn:active {
    transform: translateY(0);
}

/* ========================================
   NAVBAR - GLASS MORPHISM
   ======================================== */

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    background: rgba(30, 36, 51, 0.9);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    padding: 8px 20px 8px 12px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.navbar-brand::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #0052A3, #DE2731);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.navbar-brand:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.08));
    border-color: rgba(36, 91, 163, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(36, 91, 163, 0.2);
}

.navbar-brand:hover::before {
    opacity: 1;
}

.navbar-brand img {
    height: 40px;
    filter: drop-shadow(0 4px 12px rgba(36, 91, 163, 0.4));
    transition: transform 0.3s ease;
}

.navbar-brand:hover img {
    transform: scale(1.05);
}

.navbar-brand span {
    background: linear-gradient(135deg, #ffffff, #e8f0ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.navbar-center {
    display: flex;
    align-items: center;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    background: linear-gradient(135deg, rgba(36, 91, 163, 0.15), rgba(222, 39, 49, 0.1));
    padding: 10px 20px;
    border-radius: 12px;
    border: 1px solid rgba(36, 91, 163, 0.3);
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 20px;
}

.navbar-user span {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
}

.btn-theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.btn-theme-toggle:hover {
    background: rgba(36, 91, 163, 0.2);
    border-color: var(--th-blue);
    color: var(--th-blue);
    transform: rotate(180deg);
}

body.light-theme .btn-theme-toggle {
    background: rgba(0, 0, 0, 0.05);
}

/* ========================================
   DASHBOARD LAYOUT
   ======================================== */

.dashboard-container {
    display: flex;
    min-height: calc(100vh - 85px);
}

/* ========================================
   SIDEBAR - MODERN NAVIGATION
   ======================================== */

.sidebar {
    width: 280px;
    background: rgba(30, 36, 51, 0.6);
    backdrop-filter: blur(10px);
    border-right: 1px solid var(--border-color);
    padding: 30px 0;
    position: sticky;
    top: 85px;
    height: calc(100vh - 85px);
    overflow-y: auto;
}

.menu {
    list-style: none;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 16px 30px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-normal);
    font-weight: 500;
    font-size: 15px;
    border-left: 3px solid transparent;
    position: relative;
}

.menu-item i {
    font-size: 18px;
    width: 24px;
    transition: all var(--transition-normal);
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-left-color: var(--th-blue);
}

.menu-item:hover i {
    transform: scale(1.15);
    color: var(--th-blue);
}

.menu-item.active {
    background: rgba(36, 91, 163, 0.15);
    color: var(--text-primary);
    border-left-color: var(--th-blue);
    font-weight: 600;
}

.menu-item.active i {
    color: var(--th-blue);
}

.menu-item.active::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    background: var(--th-blue);
    border-radius: 2px 0 0 2px;
}

/* ========================================
   MAIN CONTENT AREA
   ======================================== */

.main-content {
    flex: 1;
    padding: 40px;
}

/* ========================================
   BREADCRUMBS
   ======================================== */

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    margin-bottom: 24px;
    font-size: 14px;
}

.breadcrumbs a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.breadcrumbs a:hover {
    color: var(--th-blue);
}

.breadcrumbs a:last-child {
    color: var(--text-primary);
    font-weight: 600;
    pointer-events: none;
}

.breadcrumbs a:not(:last-child)::after {
    content: "›";
    margin-left: 8px;
    color: rgba(255, 255, 255, 0.3);
    font-weight: 300;
}

.breadcrumbs i {
    font-size: 13px;
}

.content-section {
    display: none;
    animation: slideIn 0.4s ease;
}

.content-section.active {
    display: block;
}

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

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.section-header h2 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 15px;
    letter-spacing: -0.5px;
}

/* ========================================
   STATS GRID - MODERN CARDS
   ======================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: linear-gradient(135deg, rgba(36, 91, 163, 0.1), rgba(30, 36, 51, 0.8));
    backdrop-filter: blur(10px);
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(36, 91, 163, 0.2) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(40%, -40%);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(36, 91, 163, 0.3);
    border-color: var(--th-blue);
}

.stat-card i {
    font-size: 28px;
    color: var(--th-blue);
    margin-bottom: 8px;
    display: block;
}

.stat-card h3 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stat-card p {
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ========================================
   CHARTS & ANALYTICS
   ======================================== */

.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin: 32px 0;
}

.chart-card {
    background: linear-gradient(135deg, rgba(20, 24, 36, 0.6), rgba(10, 14, 26, 0.8));
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    transition: all 0.3s ease;
}

.chart-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: rgba(36, 91, 163, 0.3);
}

.chart-card h3 {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chart-card h3 i {
    color: var(--th-blue);
    font-size: 18px;
}

.chart-card canvas {
    max-height: 300px;
}

#raceTimeline {
    max-height: 300px;
    overflow-y: auto;
}

.timeline-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 3px solid var(--th-blue);
    transition: all 0.2s ease;
}

.timeline-item:hover {
    background: rgba(36, 91, 163, 0.1);
    transform: translateX(5px);
}

.timeline-date {
    min-width: 90px;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
}

.timeline-race {
    flex: 1;
}

.timeline-race-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.timeline-race-location {
    font-size: 12px;
    color: var(--text-secondary);
}

.timeline-participants {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    padding: 4px 10px;
    background: rgba(36, 91, 163, 0.2);
    border-radius: 12px;
}

.timeline-participants i {
    color: var(--th-blue);
}

@media (max-width: 1200px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   FILTERS & SEARCH
   ======================================== */

.filters {
    display: flex;
    gap: 16px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 300px;
    position: relative;
}

.search-box i {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 16px;
}

.search-box input {
    width: 100%;
    padding: 14px 18px 14px 48px;
    background: rgba(255, 255, 255, 0.05);
    border: 1.5px solid var(--border-color);
    border-radius: var(--border-radius-md);
    color: var(--text-primary);
    font-size: 14px;
    transition: all var(--transition-normal);
}

.search-box input:focus {
    outline: none;
    border-color: var(--th-blue);
    background: rgba(36, 91, 163, 0.08);
    box-shadow: 0 0 0 3px rgba(36, 91, 163, 0.15);
}

.filters select {
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.05);
    border: 1.5px solid var(--border-color);
    border-radius: var(--border-radius-md);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all var(--transition-normal);
    min-width: 180px;
}

.filters select:focus {
    outline: none;
    border-color: var(--th-blue);
    background: rgba(36, 91, 163, 0.08);
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sort-controls label {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sort-controls select {
    min-width: 140px;
}

.btn-sort {
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1.5px solid var(--border-color);
    border-radius: var(--border-radius-md);
    color: var(--th-blue);
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-sort:hover {
    background: rgba(36, 91, 163, 0.1);
    border-color: var(--th-blue);
    transform: translateY(-1px);
}

.btn-sort i {
    font-size: 16px;
}

/* ========================================
   BADGES - MODERN DESIGN
   ======================================== */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.badge-primary {
    background: linear-gradient(135deg, var(--th-blue), #1a4a8a);
    color: var(--text-primary);
}

.badge-info {
    background: linear-gradient(135deg, var(--accent-blue), #2c7bc7);
    color: var(--text-primary);
}

.badge-success {
    background: linear-gradient(135deg, var(--accent-green), #38a169);
    color: var(--text-primary);
}

.badge-warning {
    background: linear-gradient(135deg, var(--accent-yellow), #d69e2e);
    color: var(--th-black);
}

.badge-danger {
    background: linear-gradient(135deg, var(--th-red), #b91e26);
    color: var(--text-primary);
}

/* ========================================
   MODALS - GLASS MORPHISM
   ======================================== */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 999;
    animation: fadeIn 0.3s ease;
}

.modal-overlay.active {
    display: block;
}

.modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(30, 36, 51, 0.98);
    backdrop-filter: blur(20px);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    animation: modalSlideIn 0.3s ease;
}

.modal.active {
    display: block;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -48%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.modal-content {
    padding: 0;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 28px 32px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, rgba(36, 91, 163, 0.1), transparent);
}

.modal-header h3 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    font-size: 18px;
    transition: all var(--transition-normal);
}

.close-btn:hover {
    background: rgba(222, 39, 49, 0.2);
    color: var(--th-red);
    transform: rotate(90deg);
}

.modal form {
    padding: 32px;
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 24px 32px;
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
}

/* Delete Confirmation Modal */
.delete-confirmation-modal {
    max-width: 500px;
}

.delete-confirmation-modal .modal-header h3 {
    color: var(--text-primary);
    font-size: 20px;
    display: flex;
    align-items: center;
}

.delete-confirmation-modal .btn-danger {
    background: linear-gradient(135deg, var(--th-red), #c72027);
    color: white;
    border: none;
    border-radius: var(--border-radius-md);
    font-weight: 600;
    transition: all var(--transition-normal);
}

.delete-confirmation-modal .btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(222, 39, 49, 0.3);
}

.delete-confirmation-modal .btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    font-weight: 600;
    transition: all var(--transition-normal);
}

.delete-confirmation-modal .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--text-secondary);
}

/* ========================================
   ERROR MESSAGES
   ======================================== */

.error-message {
    background: rgba(222, 39, 49, 0.1);
    border: 1px solid var(--th-red);
    color: var(--th-red);
    padding: 14px 18px;
    border-radius: var(--border-radius-md);
    margin-top: 16px;
    font-size: 14px;
    display: none;
    animation: shake 0.3s ease;
}

.error-message.active {
    display: block;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* ========================================
   SCROLLBAR STYLING
   ======================================== */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

::-webkit-scrollbar-thumb {
    background: rgba(36, 91, 163, 0.5);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--th-blue);
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 1024px) {
    .sidebar {
        width: 240px;
    }
    
    .main-content {
        padding: 30px 20px;
    }
}

@media (max-width: 768px) {
    .navbar {
        padding: 16px 20px;
    }
    
    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        height: 100vh;
        z-index: 200;
        transition: left var(--transition-normal);
    }
    
    .sidebar.active {
        left: 0;
    }
    
    .main-content {
        padding: 20px 16px;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .filters {
        flex-direction: column;
    }
    
    .search-box {
        min-width: 100%;
    }
}

/* ========================================
   LOADING ANIMATION
   ======================================== */

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.loading {
    animation: pulse 2s infinite;
}

/* ===== CALENDAR MODAL STYLES ===== */
#calendarModal .modal-content {
    max-width: 650px;
    width: 90%;
}

#calendarContent {
    padding: 20px;
}

.calendar-single-view {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.calendar-navigation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.calendar-month-year {
    font-size: 24px;
    font-weight: 700;
    color: #0052A3;
    margin: 0;
    text-align: center;
    flex: 1;
}

.calendar-nav-btn {
    background: #0052A3;
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 82, 163, 0.3);
    flex-shrink: 0;
}

.calendar-nav-btn:hover {
    background: #003d7a;
    transform: scale(1.08);
}

.calendar-nav-btn:active {
    transform: scale(0.95);
}

.month-card-single {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    border: 1px solid #e2e8f0;
}

.weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 10px;
}

.weekday {
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    color: white;
    padding: 10px 4px;
    background: #0052A3;
    border-radius: 6px;
}

.days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.day-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    transition: all 0.15s ease;
    cursor: default;
}

.day-cell.empty {
    background: transparent;
    border: none;
}

.day-cell.is-past {
    background: #fafafa;
    color: #cbd5e1;
    border-color: #f1f5f9;
}

.day-cell.is-today {
    background: #0052A3;
    border: 2px solid #0052A3;
    box-shadow: 0 0 0 3px rgba(0, 82, 163, 0.15);
}

.day-cell.is-today .day-num {
    color: white;
    font-weight: 800;
}

.day-num {
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
}

@media (max-width: 768px) {
    #calendarModal .modal-content {
        width: 95%;
        max-width: 500px;
    }
    
    #calendarContent {
        padding: 15px;
    }
    
    .calendar-month-year {
        font-size: 20px;
    }
    
    .calendar-nav-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .month-card-single {
        padding: 15px;
    }
    
    .weekday {
        font-size: 10px;
        padding: 8px 2px;
    }
    
    .day-cell {
        padding: 6px;
    }
    
    .day-num {
        font-size: 13px;
    }
}

/* ===== NOTIFICATIONS ===== */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 24px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification i {
    font-size: 20px;
}

.notification-success {
    background: linear-gradient(135deg, #48BB78, #38A169);
    color: white;
}

.notification-error {
    background: linear-gradient(135deg, #F56565, #E53E3E);
    color: white;
}

.notification-info {
    background: linear-gradient(135deg, #4299E1, #3182CE);
    color: white;
}

/* ========================================
   GLOBAL SEARCH MODAL
   ======================================== */

.search-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 14, 26, 0.85);
    backdrop-filter: blur(8px);
    z-index: 10001;
    align-items: flex-start;
    justify-content: center;
    padding-top: 100px;
    animation: fadeIn 0.2s ease;
}

.search-modal.active {
    display: flex;
}

.search-modal-content {
    width: 100%;
    max-width: 640px;
    background: linear-gradient(135deg, rgba(20, 24, 36, 0.95), rgba(10, 14, 26, 0.98));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    animation: slideDown 0.3s ease;
}

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

.search-input-wrapper {
    display: flex;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    gap: 16px;
}

.search-input-wrapper i {
    color: var(--th-blue);
    font-size: 20px;
}

.search-input-wrapper input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 500;
}

.search-input-wrapper input::placeholder {
    color: var(--text-muted);
}

.search-shortcut {
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-muted);
    font-family: monospace;
}

.search-results {
    max-height: 400px;
    overflow-y: auto;
    padding: 8px;
}

.search-results::-webkit-scrollbar {
    width: 8px;
}

.search-results::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.search-results::-webkit-scrollbar-thumb {
    background: rgba(36, 91, 163, 0.5);
    border-radius: 4px;
}

.search-results::-webkit-scrollbar-thumb:hover {
    background: rgba(36, 91, 163, 0.7);
}

.search-category {
    padding: 12px 16px 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.search-result-item:hover,
.search-result-item.selected {
    background: rgba(36, 91, 163, 0.15);
    border-color: rgba(36, 91, 163, 0.3);
}

.search-result-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.search-result-icon.race {
    background: rgba(222, 39, 49, 0.2);
    color: #DE2731;
}

.search-result-icon.user {
    background: rgba(36, 91, 163, 0.2);
    color: #245BA3;
}

.search-result-icon.document {
    background: rgba(76, 175, 80, 0.2);
    color: #4CAF50;
}

.search-result-content {
    flex: 1;
    min-width: 0;
}

.search-result-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-title mark,
.search-result-subtitle mark {
    background: rgba(222, 39, 49, 0.3);
    color: #DE2731;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 700;
}

.search-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.search-empty i {
    font-size: 48px;
    color: rgba(36, 91, 163, 0.3);
    margin-bottom: 16px;
}

.search-empty p {
    margin: 8px 0 0;
}

.search-footer {
    padding: 12px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
}

.search-hints {
    display: flex;
    gap: 20px;
    font-size: 12px;
    color: var(--text-muted);
}

.search-hints span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.search-hints kbd {
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    font-size: 11px;
    font-family: monospace;
}

@media (max-width: 768px) {
    .search-modal {
        padding-top: 20px;
    }
    
    .search-modal-content {
        max-width: calc(100% - 32px);
    }
    
    .search-hints {
        display: none;
    }
}

/* ========================================
   ACTIVITY LOGS
   ======================================== */

.logs-container {
    background: var(--bg-card);
    border-radius: var(--border-radius-md);
    overflow: hidden;
}

.log-item {
    display: grid;
    grid-template-columns: 180px 120px 1fr 200px 150px;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    align-items: center;
    transition: background var(--transition-fast);
}

.log-item:hover {
    background: var(--bg-hover);
}

.log-item:last-child {
    border-bottom: none;
}

.log-time {
    color: var(--text-muted);
    font-size: 13px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.log-time .date {
    font-weight: 500;
    color: var(--text-secondary);
}

.log-time .time {
    font-size: 12px;
}

.log-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    width: fit-content;
}

.log-action.login {
    background: rgba(72, 187, 120, 0.15);
    color: #48BB78;
}

.log-action.logout {
    background: rgba(160, 174, 192, 0.15);
    color: #A0AEC0;
}

.log-action.upload {
    background: rgba(74, 144, 226, 0.15);
    color: #4A90E2;
}

.log-action.download {
    background: rgba(236, 201, 75, 0.15);
    color: #ECC94B;
}

.log-action.delete {
    background: rgba(245, 101, 101, 0.15);
    color: #F56565;
}

.log-action.edit,
.log-action.create_race,
.log-action.edit_race {
    background: rgba(159, 122, 234, 0.15);
    color: #9F7AEA;
}

.log-action.delete_race {
    background: rgba(245, 101, 101, 0.15);
    color: #F56565;
}

.log-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.log-user i {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-hover);
    border-radius: 50%;
    color: var(--accent-blue);
}

.log-user-info {
    display: flex;
    flex-direction: column;
}

.log-user-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.log-user-role {
    font-size: 12px;
    color: var(--text-muted);
}

.log-details {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.log-ip {
    font-family: monospace;
    font-size: 12px;
    color: var(--text-muted);
    text-align: right;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
    padding: 16px;
}

.pagination button {
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.pagination button:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination button.active {
    background: var(--th-blue);
    color: white;
    border-color: var(--th-blue);
}

@media (max-width: 1024px) {
    .log-item {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .log-ip {
        text-align: left;
    }
}

/* ========================================
   PDF PREVIEW MODAL
   ======================================== */

.pdf-modal .modal-content {
    max-width: 90vw;
    max-height: 90vh;
    width: 1200px;
    display: flex;
    flex-direction: column;
}

.pdf-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    gap: 20px;
    flex-wrap: wrap;
}

.pdf-controls,
.pdf-pagination,
.pdf-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

#zoomLevel {
    min-width: 50px;
    text-align: center;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 14px;
}

.pdf-pagination span {
    color: var(--text-secondary);
    font-size: 14px;
    white-space: nowrap;
}

.pdf-viewer-container {
    flex: 1;
    overflow: auto;
    background: var(--bg-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
}

#pdfCanvas {
    max-width: 100%;
    height: auto;
    box-shadow: var(--shadow-lg);
    background: white;
}

.pdf-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--text-secondary);
}

.pdf-loading i {
    font-size: 48px;
    margin-bottom: 16px;
    color: var(--th-blue);
}

.pdf-loading p {
    font-size: 16px;
}

/* PDF Preview Button */
.btn-preview {
    background: rgba(74, 144, 226, 0.15);
    color: #4A90E2;
    border: 1px solid rgba(74, 144, 226, 0.3);
}

.btn-preview:hover {
    background: rgba(74, 144, 226, 0.25);
    border-color: rgba(74, 144, 226, 0.5);
}

@media (max-width: 768px) {
    .pdf-modal .modal-content {
        width: 95vw;
        max-width: 95vw;
    }
    
    .pdf-toolbar {
        flex-direction: column;
        gap: 12px;
        padding: 12px;
    }
    
    .pdf-controls,
    .pdf-pagination,
    .pdf-actions {
        width: 100%;
        justify-content: center;
    }
    
    .pdf-viewer-container {
        padding: 10px;
    }
}

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */

.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    min-width: 300px;
    max-width: 500px;
    padding: 16px 20px;
    background: var(--bg-card);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: auto;
    animation: slideIn 0.3s ease;
    border-left: 4px solid var(--th-blue);
}

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

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

.toast.warning {
    border-left-color: var(--accent-yellow);
}

.toast.info {
    border-left-color: var(--accent-blue);
}

.toast-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
    font-size: 14px;
    font-weight: bold;
}

.toast.success .toast-icon {
    background: rgba(72, 187, 120, 0.2);
    color: var(--accent-green);
}

.toast.error .toast-icon {
    background: rgba(245, 101, 101, 0.2);
    color: var(--accent-red);
}

.toast.warning .toast-icon {
    background: rgba(236, 201, 75, 0.2);
    color: var(--accent-yellow);
}

.toast.info .toast-icon {
    background: rgba(74, 144, 226, 0.2);
    color: var(--accent-blue);
}

.toast-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.toast-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.toast-message {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.toast-close {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
    flex-shrink: 0;
    font-size: 18px;
}

.toast-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.toast.removing {
    animation: slideOut 0.3s ease forwards;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

@media (max-width: 768px) {
    .toast-container {
        top: 16px;
        right: 16px;
        left: 16px;
        align-items: stretch;
    }
    
    .toast {
        min-width: unset;
        max-width: unset;
    }
}
