/* =====================================================
   BASE.CSS - Gemeinsame Basis-Styles für alle Seiten
   ===================================================== */

:root {
    /* === Hauptfarben - Moderneres Teal-Farbschema === */
    --primary: #0D4F5C;
    --primary-dark: #083642;
    --primary-light: #1A6B7A;
    --secondary: #4ECDC4;
    --secondary-light: #7EDDD6;
    --accent: #FF6B6B;

    /* === Semantische Farben === */
    --success: #2ECC71;
    --success-light: #D5F5E3;
    --warning: #F39C12;
    --warning-light: #FEF5E7;
    --danger: #E74C3C;
    --danger-light: #FDEDEC;
    --info: #3498DB;
    --info-light: #EBF5FB;

    /* === Neutrale Farben === */
    --white: #FFFFFF;
    --gray-50: #F8FAFC;
    --gray-100: #F1F5F9;
    --gray-200: #E2E8F0;
    --gray-300: #CBD5E1;
    --gray-400: #94A3B8;
    --gray-500: #64748B;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1E293B;
    --gray-900: #0F172A;

    /* === Legacy-Variablen für Kompatibilität === */
    --light: #E8F4F6;
    --dark: #0D4F5C;
    --gray: #64748B;
    --border: #E2E8F0;

    /* === Schatten === */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --card-shadow: var(--shadow-md);

    /* === Abstände (8px Raster) === */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;

    /* === Border Radius === */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* === Übergänge === */
    --transition-fast: 150ms ease;
    --transition: 250ms ease;
    --transition-slow: 350ms ease;
}

/* === Grundlegende Resets === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 50%, var(--secondary) 100%);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--gray-800);
    line-height: 1.6;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === Typografie === */
h1, h2, h3, h4, h5, h6 {
    color: var(--gray-800);
    font-weight: 700;
    margin-top: 0;
    margin-bottom: var(--space-4);
    letter-spacing: -0.02em;
    line-height: 1.3;
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.375rem; }
h4 { font-size: 1.125rem; }

/* === Gemeinsame Button-Styles === */
.btn {
    padding: var(--space-4) var(--space-6);
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: var(--white);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #27AE60 100%);
    color: var(--white);
    box-shadow: var(--shadow-md);
}

.btn-success:hover {
    background: linear-gradient(135deg, #27AE60 0%, #1E8449 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-block {
    width: 100%;
}

.btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn.loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 8px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* === Navbar === */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
    padding: var(--space-4) 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--gray-200);
}

.nav-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--space-6);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

.nav-brand i {
    font-size: 1.5rem;
    color: var(--secondary);
}

.nav-back {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--gray-600);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9375rem;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.nav-back:hover {
    background: var(--gray-100);
    color: var(--primary);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    color: var(--gray-700);
    font-weight: 500;
}

.nav-user > i {
    font-size: 1.75rem;
    color: var(--secondary);
}

.btn-logout {
    background: transparent;
    border: 2px solid var(--gray-300);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    color: var(--gray-600);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.btn-logout:hover {
    background-color: var(--danger-light);
    border-color: var(--danger);
    color: var(--danger);
}

/* === Container === */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: var(--space-8) var(--space-6);
}

/* === Footer === */
.footer {
    text-align: center;
    padding: var(--space-6);
    color: var(--white);
    font-size: 0.875rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    margin-top: var(--space-12);
}

/* === Alerts === */
.alert {
    padding: var(--space-4);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-6);
    font-size: 0.9375rem;
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.alert-error {
    background-color: var(--danger-light);
    border-left: 4px solid var(--danger);
    color: var(--danger);
}

.alert-success {
    background-color: var(--success-light);
    border-left: 4px solid var(--success);
    color: #1E7E4E;
}

/* === Badges === */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-full);
    font-size: 0.8125rem;
    font-weight: 600;
}

.badge-lesson {
    background: rgba(78, 205, 196, 0.2);
    color: var(--secondary-light);
    border: 1px solid rgba(78, 205, 196, 0.4);
}

.badge-title {
    background: rgba(255, 255, 255, 0.15);
    color: var(--white);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.badge-easy {
    background: var(--success-light);
    color: #1E7E4E;
}

.badge-medium {
    background: var(--warning-light);
    color: #B7791F;
}

.badge-hard {
    background: var(--danger-light);
    color: var(--danger);
}

/* === Progress Bars === */
.progress-bar-large {
    height: 12px;
    background-color: var(--gray-100);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: var(--space-5);
}

.progress-bar-small {
    flex: 1;
    height: 6px;
    background-color: var(--gray-100);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: var(--radius-full);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 0.75rem;
    font-weight: 700;
    min-width: fit-content;
    padding: 0 var(--space-3);
}

/* === Accessibility === */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    padding: 8px 16px;
    background: var(--primary);
    color: var(--light);
    z-index: 9999;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 0;
}

.btn:focus-visible,
.btn-lesson:focus-visible,
.auth-link:focus-visible {
    outline: 3px solid var(--secondary);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* === Custom Scrollbar === */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

::selection {
    background: var(--secondary);
    color: var(--white);
}

/* === Utility Classes === */
.text-muted { color: var(--gray-500); }
.text-primary { color: var(--primary); }
.text-secondary { color: var(--secondary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }

.mt-4 { margin-top: var(--space-4); }
.mb-4 { margin-bottom: var(--space-4); }
.mt-8 { margin-top: var(--space-8); }
.mb-8 { margin-bottom: var(--space-8); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

/* === Responsive Base === */
@media (max-width: 768px) {
    .container {
        padding: var(--space-5) var(--space-4);
    }

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

    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
}
