/* =====================================================
   SOK Visual Identity - Sveriges Olympiska Kommitté
   Based on Brand Guidelines
   ===================================================== */

/* CSS Custom Properties - SOK Color Palette */
:root {
    /* Blue Scale */
    --sok-blue-50: #DEE9FF;
    --sok-blue-100: #C0D5FF;
    --sok-blue-200: #C0D5FF;
    --sok-blue-300: #6A97F7;
    --sok-blue-400: #3D76FF;
    --sok-blue-500: #0153EF;
    --sok-blue-600: #052EEC;
    --sok-blue-700: #1520AA;
    --sok-blue-800: #040E5E;
    --sok-blue-900: #040727;
    
    /* Gold Scale (Accent) */
    --sok-gold-50: #FFF9ED;
    --sok-gold-100: #FFF3D3;
    --sok-gold-200: #FFEEAE;
    --sok-gold-300: #FFE570;
    --sok-gold-400: #F9DA09;
    --sok-gold-500: #E2C600;
    --sok-gold-600: #C8B100;
    --sok-gold-700: #B4A134;
    --sok-gold-800: #918536;
    --sok-gold-900: #746B3C;
    
    /* Silver Scale */
    --sok-silver-50: #F1F1F1;
    --sok-silver-100: #D4D4D4;
    --sok-silver-200: #B8B8B8;
    --sok-silver-300: #9D9D9D;
    --sok-silver-400: #838383;
    --sok-silver-500: #6A6A6A;
    --sok-silver-600: #545252;
    --sok-silver-700: #3C3B3B;
    --sok-silver-800: #252525;
    --sok-silver-900: #111111;
    
    /* Medal Colors */
    --sok-bronze: #A47E24;
    
    /* Semantic Colors */
    --sok-primary: var(--sok-blue-900);
    --sok-secondary: var(--sok-blue-600);
    --sok-accent: var(--sok-gold-400);
    --sok-background: var(--sok-blue-50);
    --sok-surface: #FFFFFF;
    --sok-text-light: #FFFFFF;
    --sok-text-dark: var(--sok-blue-900);
}

/* Reset and Base Styles */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--sok-text-dark);
    background-color: var(--sok-background);
}

/* Page Layout - MainLayout specific */
.page {
    display: flex;
    min-height: 100vh;
}

/* Sidebar - SOK Dark Blue */
.page .sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--sok-blue-900) 0%, var(--sok-blue-800) 100%);
    color: var(--sok-text-light);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.page main {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
}

.page .top-row {
    background: var(--sok-surface);
    padding: 1rem 2rem;
    box-shadow: 0 2px 8px rgba(4, 7, 39, 0.1);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    border-bottom: 3px solid var(--sok-accent);
}

.page .content {
    padding: 2rem;
    flex: 1;
}

/* Navigation Menu */
.nav-menu {
    padding: 1.5rem 0;
}

.nav-header {
    padding: 1rem 1.5rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.nav-logo {
    width: 60px;
    height: auto;
    border-radius: 8px;
}

.nav-header h3 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.9);
    text-align: center;
}

.nav-items {
    display: flex;
    flex-direction: column;
}

.nav-section {
    padding: 1rem 1.5rem 0.5rem;
}

.nav-section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--sok-gold-400);
    font-weight: 600;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background: rgba(255,255,255,0.08);
    color: white;
    border-left-color: var(--sok-gold-400);
}

.nav-link.active {
    background: rgba(255,255,255,0.12);
    color: white;
    border-left-color: var(--sok-gold-400);
}

.nav-icon {
    font-size: 1.25rem;
}

/* User Info in Top Bar */
.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info .role-badge {
    background: var(--sok-gold-400);
    color: var(--sok-blue-900);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-logout {
    background: transparent;
    border: 2px solid var(--sok-blue-600);
    color: var(--sok-blue-600);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: var(--sok-blue-600);
    color: white;
}

/* Login Page - SOK Branded */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--sok-blue-900) 0%, var(--sok-blue-800) 50%, var(--sok-blue-700) 100%);
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 1rem;
}

.login-card {
    background: var(--sok-surface);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
    overflow: hidden;
}

.login-header {
    background: var(--sok-blue-900);
    color: var(--sok-text-light);
    padding: 2rem;
    text-align: center;
    position: relative;
}

.login-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--sok-gold-400);
}

.login-logo {
    width: 80px;
    height: auto;
    margin: 0 auto 1rem;
    border-radius: 8px;
}

.login-header h1 {
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.login-header p {
    margin: 0;
    opacity: 0.8;
    font-size: 0.9rem;
}

.login-card form {
    padding: 2rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--sok-blue-900);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--sok-silver-200);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--sok-blue-600);
    box-shadow: 0 0 0 3px rgba(5, 46, 236, 0.1);
}

.remember-me {
    display: flex;
    align-items: center;
}

.remember-forgot {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.forgot-link {
    color: var(--sok-blue-600);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.2s;
}

.forgot-link:hover {
    color: var(--sok-blue-700);
    text-decoration: underline;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: var(--sok-blue-900);
}

/* Primary Button - SOK Style */
.btn-primary {
    background: var(--sok-blue-600);
    color: white;
    border: none;
    padding: 0.875rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: var(--sok-blue-700);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(5, 46, 236, 0.3);
}

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

.btn-block {
    width: 100%;
}

/* Secondary Button */
.btn-secondary {
    background: transparent;
    color: var(--sok-blue-600);
    border: 2px solid var(--sok-blue-600);
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--sok-blue-600);
    color: white;
}

/* Accent Button (Gold) */
.btn-accent {
    background: var(--sok-gold-400);
    color: var(--sok-blue-900);
    border: none;
    padding: 0.875rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-accent:hover {
    background: var(--sok-gold-500);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(249, 218, 9, 0.4);
}

.login-footer {
    padding: 0 2rem 2rem;
    text-align: center;
}

.demo-credentials {
    background: var(--sok-blue-50);
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    color: var(--sok-blue-800);
    text-align: left;
    border-left: 4px solid var(--sok-gold-400);
}

/* Alert Messages */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-info {
    background: var(--sok-blue-50);
    color: var(--sok-blue-800);
    border: 1px solid var(--sok-blue-200);
}

/* Validation */
.validation-error {
    color: #dc2626;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--sok-blue-600);
}

/* Cards - SOK Style */
.card {
    background: var(--sok-surface);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(4, 7, 39, 0.08);
    overflow: hidden;
}

.card-header {
    background: var(--sok-blue-900);
    color: white;
    padding: 1rem 1.5rem;
    border-bottom: 3px solid var(--sok-gold-400);
}

.card-header h2,
.card-header h3 {
    margin: 0;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--sok-surface);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(4, 7, 39, 0.08);
    display: flex;
    align-items: center;
    gap: 1rem;
    border-left: 4px solid var(--sok-blue-600);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(4, 7, 39, 0.12);
}

.stat-card.gold {
    border-left-color: var(--sok-gold-400);
}

.stat-card.silver {
    border-left-color: var(--sok-silver-400);
}

.stat-card.bronze {
    border-left-color: var(--sok-bronze);
}

.stat-icon {
    font-size: 2.5rem;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--sok-blue-900);
    line-height: 1;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--sok-silver-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Tables */
.table-container {
    background: var(--sok-surface);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(4, 7, 39, 0.08);
    overflow: hidden;
}

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

.table th {
    background: var(--sok-blue-900);
    color: white;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.table td {
    padding: 1rem;
    border-bottom: 1px solid var(--sok-silver-100);
}

.table tr:hover td {
    background: var(--sok-blue-50);
}

/* Hamburger Button */
.hamburger-btn {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 10;
}

.hamburger-btn span {
    width: 100%;
    height: 3px;
    background: var(--sok-blue-900);
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(4, 7, 39, 0.7);
    z-index: 998;
}

/* Sidebar close button */
.sidebar-close {
    display: none;
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    width: 40px;
    height: 40px;
    text-align: center;
    line-height: 36px;
    border-radius: 50%;
    transition: all 0.2s;
}

.sidebar-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Mobile top bar user info */
.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
}

.user-info .user-name {
    display: inline;
    font-weight: 500;
    color: var(--sok-blue-900);
}

/* Page Headers */
.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--sok-blue-900);
    margin: 0 0 0.5rem 0;
}

.page-header p {
    color: var(--sok-silver-500);
    margin: 0;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-primary {
    background: var(--sok-blue-600);
    color: white;
}

.badge-gold {
    background: var(--sok-gold-400);
    color: var(--sok-blue-900);
}

.badge-silver {
    background: var(--sok-silver-200);
    color: var(--sok-silver-800);
}

.badge-bronze {
    background: var(--sok-bronze);
    color: white;
}

/* Responsive Styles */
@media (max-width: 768px) {
    /* Show hamburger button */
    .hamburger-btn {
        display: flex;
    }

    /* Hide sidebar by default on mobile */
    .page .sidebar {
        position: fixed;
        left: -280px;
        width: 280px;
        z-index: 999;
        transition: left 0.3s ease;
    }

    /* Show sidebar when open */
    .page.sidebar-open .sidebar {
        left: 0;
    }

    /* Show overlay when sidebar is open */
    .page.sidebar-open .sidebar-overlay {
        display: block;
    }

    /* Show close button on mobile */
    .sidebar-close {
        display: block;
    }

    /* Remove margin on main content */
    .page main {
        margin-left: 0;
    }

    .page .content {
        padding: 1rem;
    }

    /* Adjust top bar */
    .page .top-row {
        padding: 0.75rem 1rem;
        justify-content: flex-start;
        gap: 1rem;
    }

    /* Hide username on very small screens */
    .user-info .user-name {
        display: none;
    }

    /* Smaller role badge on mobile */
    .user-info .role-badge {
        font-size: 0.65rem;
        padding: 0.2rem 0.5rem;
    }

    /* Smaller logout button on mobile */
    .btn-logout {
        padding: 0.4rem 0.75rem;
        font-size: 0.875rem;
    }
}

@media (max-width: 480px) {
    /* Even smaller adjustments for phones */
    .page .top-row {
        padding: 0.5rem 0.75rem;
    }

    .user-info {
        gap: 0.5rem;
    }

    .user-info .role-badge {
        display: none;
    }

    .page .content {
        padding: 0.75rem;
    }

    /* Adjust stats grids on small screens */
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .stat-icon {
        font-size: 1.75rem;
    }
}

/* Utility Classes */
.text-gold { color: var(--sok-gold-400); }
.text-blue { color: var(--sok-blue-600); }
.text-dark { color: var(--sok-blue-900); }
.bg-gold { background-color: var(--sok-gold-400); }
.bg-blue { background-color: var(--sok-blue-600); }
.bg-dark { background-color: var(--sok-blue-900); }

/* =====================================================
   Mobile-First Responsive Enhancements
   ===================================================== */

/* Ensure smooth scrolling and prevent horizontal overflow */
html {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

/* Better touch targets globally */
@media (max-width: 768px) {
    /* Page header adjustments */
    .page-header h1 {
        font-size: 1.5rem;
    }

    /* Ensure tables scroll horizontally */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table th, .table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
    }

    /* Stats grid: 2 columns on tablet */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .stat-icon {
        font-size: 1.75rem;
    }
}

@media (max-width: 480px) {
    /* Stats grid: full width on phones */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .stat-card {
        padding: 0.875rem;
        gap: 0.75rem;
    }

    .stat-value {
        font-size: 1.35rem;
    }

    .stat-icon {
        font-size: 1.5rem;
    }

    /* Smaller page headers on phones */
    .page-header h1 {
        font-size: 1.35rem;
    }

    .page-header p {
        font-size: 0.875rem;
    }
}
