/**
 * ==============================================
 * AyAcademy Global CSS
 * ==============================================
 * 
 * Diese Datei enthält ALLE globalen Styles für die gesamte App.
 * Wird auf JEDER Seite eingebunden.
 * 
 * WICHTIG FÜR LLMs/Vibe Coding:
 * - Änderungen an globalen Styles NUR hier machen
 * - CSS-Variablen hier definiert, überall verfügbar
 * - Bottom-Nav, Footer, Sidebar-Offsets sind hier zentral
 * 
 * Struktur:
 *   1. CSS-Variablen (Design Tokens)
 *   2. CSS Reset / Base Styles
 *   3. Typography
 *   4. Layout (Main Content, Sidebar-Offsets)
 *   5. Mobile Header
 *   6. Bottom Navigation (Mobile)
 *   7. Footer Styles
 *   8. Utilities
 * ==============================================
 */

/* ==============================================
   1. CSS-VARIABLEN (Design Tokens)
   ============================================== */
:root {
    /* Farben - Marke */
    --ay-dark-navy: #050816;
    --ay-off-white: #F7FAFF;
    --ay-soft-grey: #E1E5F0;
    --ay-mid-grey: #6B7280;
    
    /* Farben - Akzent (Learn/Primary) */
    --learn-primary: #C5FF4F;
    --learn-dark: #6B8E23;
    --learn-gradient: linear-gradient(135deg, #C5FF4F 0%, #A8E063 100%);
    
    /* Farben - Status */
    --error-color: #ef4444;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    
    /* Farben - Cards/UI */
    --card-bg: rgba(255, 255, 255, 0.03);
    --card-border: rgba(255, 255, 255, 0.08);
    
    /* Farben - Prompt-Typen */
    --type-video: #ff6b6b;
    --type-image: #4ecdc4;
    --type-text: #a78bfa;
    
    /* Typography */
    --font-main: 'Fustat', sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', monospace;
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 72px;
    --bottom-nav-height: 70px;
    --header-height: 64px;
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 100px;
}

/* ==============================================
   2. CSS RESET / BASE STYLES
   ============================================== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-main);
    background: var(--ay-dark-navy);
    color: white;
    min-height: 100vh;
    line-height: 1.6;
}

::selection {
    background: var(--learn-primary);
    color: var(--ay-dark-navy);
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

img, video {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ==============================================
   3. TYPOGRAPHY
   ============================================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
}

/* ==============================================
   4. LAYOUT (Main Content, Sidebar-Offsets)
   ============================================== */

/* App Container */
.app-container {
    min-height: 100vh;
}

/* Main Content - Desktop mit Sidebar-Offset */
.main-content {
    margin-left: var(--sidebar-width, 260px);
    margin-right: 0;
    padding: 2rem 3rem;
    min-height: 100vh;
    transition: margin-left var(--transition-base);
}

/* Mobile: Kein Sidebar-Offset */
@media (max-width: 1024px) {
    .main-content {
        margin-left: 0 !important;
        padding: 1.5rem;
        padding-bottom: calc(var(--bottom-nav-height) + 2rem);
    }
}

/* Account Page Layout */
.account-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin-left: var(--sidebar-width, 260px);
    margin-right: 0;
    transition: margin-left var(--transition-base);
}

@media (max-width: 1024px) {
    .account-page {
        margin-left: 0 !important;
        padding-bottom: calc(var(--bottom-nav-height) + 1rem);
    }
}

/* ==============================================
   5. MOBILE HEADER
   ============================================== */
.mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--card-border);
}

@media (max-width: 1024px) {
    .mobile-header {
        display: flex;
    }
}

.menu-btn {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 8px;
}

.menu-btn span {
    width: 24px;
    height: 2px;
    background: white;
    border-radius: 2px;
}

.mobile-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.125rem;
}

.mobile-logo img {
    width: 28px;
    height: 28px;
}

/* ==============================================
   6. BOTTOM NAVIGATION (Mobile)
   ============================================== */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 150;
    background: rgba(5, 8, 22, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--card-border);
    padding: 0.5rem 0 calc(0.5rem + env(safe-area-inset-bottom, 0px));
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 1024px) {
    .bottom-nav {
        display: flex;
    }
}

.bottom-nav.hidden {
    transform: translateY(100%);
    opacity: 0;
}

.bottom-nav-inner {
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    transition: all var(--transition-fast);
    text-decoration: none;
    position: relative;
}

.bottom-nav-item svg {
    width: 24px;
    height: 24px;
    transition: transform var(--transition-fast);
}

.bottom-nav-item:hover {
    color: rgba(255, 255, 255, 0.8);
}

.bottom-nav-item:hover svg {
    transform: scale(1.1);
}

.bottom-nav-item.active {
    color: var(--learn-primary);
}

.bottom-nav-item.active::before {
    content: '';
    position: absolute;
    top: -0.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background: var(--learn-primary);
    border-radius: 0 0 3px 3px;
}

.bottom-nav-item.active svg {
    transform: scale(1.1);
}

/* Badge für Anzahl */
.bottom-nav-badge {
    position: absolute;
    top: 0;
    right: 0.5rem;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: var(--learn-primary);
    color: var(--ay-dark-navy);
    font-size: 0.5625rem;
    font-weight: 800;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Profil Button Styling */
.bottom-nav-item.profile svg {
    width: 22px;
    height: 22px;
}

/* ==============================================
   7. FOOTER STYLES
   ============================================== */
.site-footer {
    margin-left: var(--sidebar-width, 260px);
    margin-right: 0;
    padding: 1.5rem 3rem;
    border-top: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    transition: margin-left var(--transition-base);
}

@media (max-width: 1024px) {
    .site-footer {
        margin-left: 0 !important;
        padding: 1.5rem;
        padding-bottom: calc(var(--bottom-nav-height) + 1.5rem);
        flex-direction: column;
        text-align: center;
    }
}

.footer-links {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

@media (max-width: 1024px) {
    .footer-links {
        justify-content: center;
    }
}

.footer-link {
    font-size: 0.8125rem;
    color: var(--ay-mid-grey);
    transition: color var(--transition-fast);
}

.footer-link:hover {
    color: white;
}

.footer-copy {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
}

/* ==============================================
   8. HEADER (Fixiert, für Seiten wie Prompts/News)
   ============================================== */
.header {
    position: fixed;
    top: 0;
    left: var(--sidebar-width, 260px);
    right: 0;
    z-index: 100;
    background: rgba(5, 8, 22, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--card-border);
    padding: 1rem 2rem;
    transition: left var(--transition-base);
}

@media (max-width: 1024px) {
    .header {
        left: 0 !important;
    }
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.875rem;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.back-btn:hover {
    color: white;
}

.back-btn svg {
    width: 18px;
    height: 18px;
}

/* Hide auth controls on mobile - use bottom nav instead */
@media (max-width: 1024px) {
    .auth-controls {
        display: none !important;
    }
}

.header-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
}

.header-title svg {
    width: 24px;
    height: 24px;
    color: var(--learn-primary);
}

/* ==============================================
   9. UTILITIES
   ============================================== */

/* Overlay */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 90;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

@media (max-width: 1024px) {
    .overlay {
        display: none !important;
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--ay-mid-grey);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: white;
}

/* Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Accessibility - Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    html {
        scroll-behavior: auto;
    }
}

/* Print Styles */
@media print {
    .bottom-nav,
    .desktop-sidebar,
    .sidebar-overlay {
        display: none !important;
    }
    
    .main-content,
    .account-page,
    .site-footer {
        margin-left: 0 !important;
    }
}
