/* ==========================================
   AEC Design System - Lightweight & Accessible
   Optimized for performance and older hardware
   Version: 1.1 - Enhanced Typography
   ========================================== */

/* Google Fonts Import - Poppins */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

/* ==========================================
   CSS Variables & Design Tokens
   ========================================== */
:root {
    /* Color System - AEC Brand Colors */
    --primary: #8FD14F;
    --primary-light: #A8E06A;
    --primary-dark: #7AB83F;
    --accent: #E63946;
    --accent-light: #FF6B6B;
    --accent-dark: #D62828;
    
    /* Base Colors - Simplified for Performance */
    --base: #FFFFFF;
    --base-translucent: rgba(255, 255, 255, 0.95);
    --background: #F8F9FA;
    --background-light: #FEFEFE;
    
    /* Text Colors */
    --text-dark: #2D3748;
    --text-medium: #4A5568;
    --text-light: #718096;
    --text-muted: #A0AEC0;
    
    /* Spacing System */
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 1.5rem;
    --space-lg: 2rem;
    --space-xl: 3rem;
    --space-2xl: 4rem;
    --space-3xl: 3rem;  /* 48px - Large section spacing */
    
    /* Typography Scale */
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 2rem;
    --font-size-4xl: 2.5rem;
    
    /* Transitions - Optimized for Performance */
    --transition: all 200ms ease;
    --transition-fast: all 100ms ease;
    
    /* Shadows - Simplified for Better Performance */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 15px rgba(0, 0, 0, 0.1);
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;
    
    /* Container Widths */
    --container-sm: 640px;
    --container-md: 768px;
    --container-lg: 1024px;
    --container-xl: 1280px;
    
    /* Additional Colors for AEC */
    --committee-primary: #2C3E50;
    --committee-secondary: #34495E;
    --committee-accent: #3498DB;
    --risk-low: #27AE60;
    --risk-medium: #F39C12;
    --risk-high: #E74C3C;
    --risk-critical: #C0392B;
    --success-green: #2ECC71;
    --warning-yellow: #F1C40F;
    --danger-red: #E74C3C;
    --info-blue: #3498DB;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--text-dark);
    background: var(--background);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Simple Background Pattern - No Animation for Performance */
.bg-pattern {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.03;
    background: linear-gradient(45deg, var(--primary) 25%, transparent 25%),
                linear-gradient(-45deg, var(--primary) 25%, transparent 25%),
                linear-gradient(45deg, transparent 75%, var(--primary) 75%),
                linear-gradient(-45deg, transparent 75%, var(--primary) 75%);
    background-size: 60px 60px;
    pointer-events: none;
}

/* ==========================================
   Typography System
   ========================================== */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: var(--space-md);
    color: var(--text-dark);
}

/* Apply letter-spacing to actual h1-h6 elements */
h1 {
    font-size: var(--font-size-4xl);
    font-weight: 700;
    letter-spacing: -0.025em;
}

h2 {
    font-size: var(--font-size-3xl);
    font-weight: 600;
    letter-spacing: -0.015em;
}

.h1 {
    font-size: var(--font-size-4xl);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: var(--space-lg);
    color: var(--primary);
    letter-spacing: -0.025em;
}

.h2 {
    font-size: var(--font-size-3xl);
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: var(--space-md);
    color: var(--text-dark);
    letter-spacing: -0.015em;
}

.h3 {
    font-size: var(--font-size-2xl);
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: var(--space-sm);
    color: var(--text-dark);
}

.h4 {
    font-size: var(--font-size-xl);
    font-weight: 500;
    margin-bottom: var(--space-sm);
    color: var(--text-medium);
}

.body-lg {
    font-size: var(--font-size-lg);
    font-weight: 400;
    color: var(--text-medium);
    margin-bottom: var(--space-md);
}

.body {
    font-size: var(--font-size-base);
    font-weight: 400;
    color: var(--text-medium);
    margin-bottom: var(--space-sm);
}

.caption {
    font-size: var(--font-size-sm);
    font-weight: 400;
    color: var(--text-light);
}

p {
    margin-bottom: var(--space-md);
}

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--primary);
}

/* ==========================================
   Layout Components
   ========================================== */
.container {
    width: 100%;
    max-width: var(--container-xl);
    margin: 0 auto;
    padding: 0 var(--space-md);
}

.section {
    padding: var(--space-2xl) 0;
}

/* Consistent section title spacing */
.section-title,
h2.section-title {
    margin-top: var(--space-3xl);
    margin-bottom: var(--space-2xl);
    color: var(--text-dark);
}

/* First section title should not have top margin */
.section-title:first-child,
h2.section-title:first-child,
section:first-of-type .section-title,
section:first-of-type h2.section-title {
    margin-top: 0;
}

/* Additional spacing between major sections */
section + section {
    margin-top: var(--space-3xl);
}

/* ==========================================
   Unified Section Spacing System
   ========================================== */
/* Standard page section with consistent spacing */
.page-section {
    margin-top: var(--space-3xl);
    margin-bottom: var(--space-2xl);
}

/* First section on page should not have top margin */
.page-section:first-child,
.page-section:first-of-type {
    margin-top: 0;
}

/* Ensure sections with specific classes also get proper spacing */
.onboarding-tile,
.triangle-conflict,
.week-navigator,
.roles-section,
.waarom-hoe-wat,
.ai-prompts,
.continuity-timeline,
.deadline-section,
.resources-section,
.feedback-flow {
    margin-top: var(--space-3xl);
    margin-bottom: var(--space-2xl);
}

/* First section should not have top margin */
.onboarding-tile:first-of-type {
    margin-top: 0;
}

.grid {
    display: grid;
    gap: var(--space-lg);
}

.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* ==========================================
   Button System - Simplified for Performance
   ========================================== */

/* Universal button styles - apply to ALL buttons with stronger specificity */
button,
input[type="button"],
input[type="submit"],
input[type="reset"],
.btn {
    font-family: 'Poppins', sans-serif !important;
    font-weight: 500;
    letter-spacing: 0.025em;
}

/* Force button consistency - catch any missed buttons */
button:not([class*="no-style"]),
input[type="button"]:not([class*="no-style"]),
input[type="submit"]:not([class*="no-style"]) {
    font-family: 'Poppins', sans-serif !important;
    font-weight: 500;
    letter-spacing: 0.025em;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-lg);
    border: none;
    border-radius: var(--radius-lg);
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    font-size: var(--font-size-base);
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    min-height: 48px; /* Accessibility */
    letter-spacing: 0.025em;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-accent {
    background: var(--accent);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-accent:hover {
    background: var(--accent-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-glass {
    background: var(--base-translucent);
    color: var(--text-dark);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: var(--shadow-sm);
}

.btn-glass:hover {
    background: var(--base);
    box-shadow: var(--shadow-md);
}

.btn-ghost {
    background: transparent;
    color: var(--text-medium);
    border: 2px solid var(--primary);
}

.btn-ghost:hover {
    background: var(--primary);
    color: white;
}

/* ==========================================
   Card System - Optimized
   ========================================== */
.card {
    background: var(--base-translucent);
    border-radius: var(--radius-xl);
    padding: var(--space-lg);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card-feature {
    padding: var(--space-xl);
    text-align: center;
}

.card-content {
    padding: var(--space-md);
}

/* ==========================================
   Navigation - Simplified
   ========================================== */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--base-translucent);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    padding: var(--space-sm) 0;
    box-shadow: var(--shadow-sm);
}

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

.nav-brand {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.02em;
}

.nav-links {
    display: flex;
    gap: var(--space-lg);
    list-style: none;
}

.nav-link {
    color: var(--text-medium);
    text-decoration: none;
    font-weight: 500;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.nav-link:hover {
    color: var(--primary);
    background: rgba(143, 209, 79, 0.1);
}

.nav-tab {
    padding: var(--space-sm) var(--space-lg);
    background: transparent;
    border: 2px solid var(--primary);
    border-radius: var(--radius-md);
    color: var(--text-dark);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    font-weight: 500;
    font-family: 'Poppins', sans-serif;
    font-size: var(--font-size-base);
}

.nav-tab:hover {
    background: var(--primary);
    color: white;
}

.nav-tab.active {
    background: var(--primary);
    color: white;
}

/* ==========================================
   Form Elements - Accessible
   ========================================== */
.form-group {
    margin-bottom: var(--space-md);
}

.form-label {
    display: block;
    font-weight: 500;
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-xs);
    color: var(--text-dark);
    letter-spacing: 0.025em;
}

.form-input {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    border: 2px solid rgba(143, 209, 79, 0.2);
    border-radius: var(--radius-lg);
    background: white;
    font-family: 'Poppins', sans-serif;
    font-size: var(--font-size-base);
    font-weight: 400;
    transition: var(--transition);
    min-height: 48px;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(143, 209, 79, 0.1);
}

/* ==========================================
   Badges and Status Indicators
   ========================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--font-size-sm);
    font-weight: 500;
    border-radius: var(--radius-full);
    background: var(--primary);
    color: white;
}

.badge-accent {
    background: var(--accent);
}

.badge-ghost {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.badge-success {
    background: var(--success-green);
}

.badge-warning {
    background: var(--warning-yellow);
    color: var(--text-dark);
}

.badge-danger {
    background: var(--danger-red);
}

.badge-info {
    background: var(--info-blue);
}

/* Risk-specific badges */
.badge-risk-low {
    background: var(--risk-low);
}

.badge-risk-medium {
    background: var(--risk-medium);
    color: var(--text-dark);
}

.badge-risk-high {
    background: var(--risk-high);
}

.badge-risk-critical {
    background: var(--risk-critical);
}

/* ==========================================
   Alerts - Accessible
   ========================================== */
.alert {
    padding: var(--space-md);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-md);
    border: 1px solid transparent;
}

.alert-success {
    background: rgba(143, 209, 79, 0.1);
    border-color: var(--primary);
    color: var(--primary-dark);
}

.alert-error {
    background: rgba(230, 57, 70, 0.1);
    border-color: var(--accent);
    color: var(--accent-dark);
}

.alert-warning {
    background: rgba(241, 196, 15, 0.1);
    border-color: var(--warning-yellow);
    color: #B7950B;
}

.alert-info {
    background: rgba(52, 152, 219, 0.1);
    border-color: var(--info-blue);
    color: #2874A6;
}

/* ==========================================
   Progress Indicators
   ========================================== */
.progress {
    width: 100%;
    height: 8px;
    background: rgba(143, 209, 79, 0.2);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: var(--radius-full);
    transition: width 300ms ease;
}

/* ==========================================
   Utility Classes
   ========================================== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mb-0 { margin-bottom: 0; }
.mb-xs { margin-bottom: var(--space-xs); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.mt-0 { margin-top: 0; }
.mt-xs { margin-top: var(--space-xs); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

.p-0 { padding: 0; }
.p-xs { padding: var(--space-xs); }
.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }
.p-xl { padding: var(--space-xl); }

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================
   Enhanced Interactions - Performance Optimized
   ========================================== */
.wave-accent {
    position: relative;
    overflow: hidden;
}

.wave-accent::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 600ms ease;
}

.wave-accent:hover::before {
    left: 100%;
}

/* ==========================================
   Dashboard Components - AEC Specific
   ========================================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: var(--space-xl);
    margin-bottom: var(--space-2xl);
}

.dashboard-card {
    background: var(--base);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.card-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    padding: var(--space-md) var(--space-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    margin: 0;
    font-size: var(--font-size-lg);
}

.week-badge, .date-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    font-weight: 600;
}

.card-body {
    padding: var(--space-lg);
}

/* ==========================================
   Responsive Design
   ========================================== */
@media (max-width: 768px) {
    :root {
        --font-size-4xl: 2rem;
        --font-size-3xl: 1.5rem;
        --space-lg: 1rem;
        --space-xl: 2rem;
        --space-2xl: 3rem;
    }

    .container {
        padding: 0 var(--space-sm);
    }

    .nav-content {
        flex-direction: column;
        gap: var(--space-sm);
    }

    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: var(--space-sm);
    }

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================
   Print Styles - Teacher Portal Friendly
   ========================================== */
@media print {
    .navbar,
    .btn,
    .bg-pattern {
        display: none;
    }

    .card {
        background: white;
        border: 1px solid #ccc;
        box-shadow: none;
        page-break-inside: avoid;
    }

    .h1,
    .h2,
    .h3 {
        color: #000;
    }

    body {
        background: white;
        color: #000;
    }
}

/* ==========================================
   Accessibility Enhancements
   ========================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}

/* Focus Indicators */
.btn:focus,
.form-input:focus,
.nav-link:focus,
.nav-tab:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* High Contrast Support */
@media (prefers-contrast: high) {
    :root {
        --text-dark: #000;
        --text-medium: #333;
        --background: #fff;
        --base: #fff;
        --base-translucent: #fff;
    }

    .card {
        background: #fff;
        border: 2px solid #000;
    }
}

/* ==========================================
   Performance Optimizations
   ========================================== */
.card,
.btn,
.form-input {
    will-change: auto; /* Only animate what's necessary */
}

/* Simplified hover states for better performance */
@media (hover: hover) {
    .card:hover,
    .btn:hover {
        transition: var(--transition);
    }
}

@media (hover: none) {
    .card:hover,
    .btn:hover {
        transform: none;
    }
}

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--primary);
    color: white;
    padding: var(--space-sm) var(--space-md);
    z-index: 1000;
    text-decoration: none;
    border-radius: var(--radius-md);
}

.skip-link:focus {
    top: var(--space-md);
}