/* ========================================
   JobDeutsch – Theme Erweiterungen
   Dark Mode, Glassmorphism, Cookie-Banner,
   Legal Pages, Micro-Interactions, TTS
   ======================================== */

/* ========================================
   DARK MODE VARIABLES
   ======================================== */
[data-theme="dark"] {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #1e3a5f;
    --secondary: #38bdf8;
    --accent: #fbbf24;
    --accent-light: #3f3820;
    --success: #34d399;
    --success-light: #064e3b;
    --warning: #fbbf24;
    --warning-light: #3f3820;
    --danger: #f87171;
    --danger-light: #450a0a;
    --teal: #2dd4bf;
    --teal-dark: #14b8a6;
    --teal-light: #134e4a;
    --navy: #0f172a;
    --navy-light: #1e293b;
    --gray-50: #0f172a;
    --gray-100: #1e293b;
    --gray-200: #334155;
    --gray-300: #475569;
    --gray-400: #64748b;
    --gray-500: #94a3b8;
    --gray-600: #cbd5e1;
    --gray-700: #e2e8f0;
    --gray-800: #f1f5f9;
    --gray-900: #f8fafc;
    --white: #0f172a;
}

[data-theme="dark"] body {
    background: var(--white);
    color: var(--gray-700);
}

[data-theme="dark"] .navbar {
    background: rgba(15, 23, 42, 0.92);
    border-bottom-color: var(--gray-200);
}

[data-theme="dark"] .hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #134e4a 100%);
}

[data-theme="dark"] .hero-bg {
    background: 
        radial-gradient(circle at 20% 50%, rgba(59,130,246,0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(45,212,191,0.06) 0%, transparent 50%);
}

[data-theme="dark"] .section-alt {
    background: var(--gray-100);
}

[data-theme="dark"] .feature-card,
[data-theme="dark"] .module-card,
[data-theme="dark"] .pricing-card {
    background: var(--gray-100);
    border-color: var(--gray-200);
}

[data-theme="dark"] .feature-card:hover,
[data-theme="dark"] .module-card:hover {
    border-color: var(--gray-300);
}

[data-theme="dark"] .app-card,
[data-theme="dark"] .qr-badge {
    background: var(--gray-100);
}

[data-theme="dark"] .teacher-dashboard-preview {
    background: var(--gray-100);
    border-color: var(--gray-200);
}

[data-theme="dark"] .dash-card {
    background: var(--gray-50);
}

[data-theme="dark"] .phone-frame {
    background: var(--gray-800);
}

[data-theme="dark"] .phone-body {
    background: var(--gray-100);
}

[data-theme="dark"] .phone-card {
    background: var(--gray-50);
}

[data-theme="dark"] .modal {
    background: var(--gray-100);
}

[data-theme="dark"] .modal-close {
    color: var(--gray-600);
}

[data-theme="dark"] .user-menu {
    background: var(--gray-100);
    border-color: var(--gray-200);
}

[data-theme="dark"] .footer {
    background: var(--gray-50);
    border-color: var(--gray-200);
}

[data-theme="dark"] .tab-btn {
    background: var(--gray-100);
    border-color: var(--gray-200);
    color: var(--gray-600);
}

[data-theme="dark"] .tab-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

[data-theme="dark"] .exam-card,
[data-theme="dark"] .scenario-select,
[data-theme="dark"] .chat-box {
    background: var(--gray-100);
    border-color: var(--gray-200);
}

[data-theme="dark"] .chat-content {
    background: var(--gray-50);
}

[data-theme="dark"] .interview-page {
    background: var(--gray-50);
}

[data-theme="dark"] .evaluation-box {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--gray-100) 100%);
}

[data-theme="dark"] .newsletter-input {
    background: var(--gray-100);
    border-color: var(--gray-200);
    color: var(--gray-700);
}

[data-theme="dark"] .newsletter-input::placeholder {
    color: var(--gray-500);
}

[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group select {
    background: var(--gray-50);
    border-color: var(--gray-200);
    color: var(--gray-700);
}

[data-theme="dark"] .highlight-box {
    background: var(--accent-light);
}

[data-theme="dark"] .qr-placeholder {
    background: var(--gray-50);
}

[data-theme="dark"] .loading-modules {
    color: var(--gray-500);
}

[data-theme="dark"] .section-navy {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

[data-theme="dark"] .section-teal {
    background: linear-gradient(135deg, #134e4a 0%, #0f172a 100%);
}

/* ========================================
   GLASSMORPHISM COMPONENTS
   ======================================== */
.glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .glass {
    background: rgba(15, 23, 42, 0.7);
    border-color: rgba(255, 255, 255, 0.08);
}

.glass-card {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-xl);
    padding: 32px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .glass-card {
    background: rgba(30, 41, 59, 0.6);
    border-color: rgba(255, 255, 255, 0.08);
}

/* ========================================
   DARK MODE TOGGLE
   ======================================== */
.theme-toggle {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--gray-300);
    border-radius: 12px;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: background 0.3s ease;
    flex-shrink: 0;
}

.theme-toggle::after {
    content: '🌙';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

[data-theme="dark"] .theme-toggle {
    background: var(--primary);
}

[data-theme="dark"] .theme-toggle::after {
    content: '☀️';
    transform: translateX(20px);
}

/* ========================================
   COOKIE BANNER
   ======================================== */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    background: var(--gray-900);
    color: var(--gray-100);
    padding: 20px 24px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.cookie-banner.show {
    transform: translateY(0);
}

.cookie-banner-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.cookie-banner-text {
    flex: 1;
    font-size: 14px;
    line-height: 1.6;
    min-width: 280px;
}

.cookie-banner-text a {
    color: var(--secondary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.cookie-banner-text a:hover {
    color: var(--primary);
}

.cookie-banner-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.cookie-btn {
    padding: 10px 20px;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition);
    white-space: nowrap;
}

.cookie-btn-accept {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.cookie-btn-accept:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.cookie-btn-decline {
    background: transparent;
    color: var(--gray-400);
    border-color: var(--gray-700);
}

.cookie-btn-decline:hover {
    background: rgba(255,255,255,0.05);
    color: var(--gray-200);
}

.cookie-btn-settings {
    background: transparent;
    color: var(--gray-400);
    border-color: transparent;
    text-decoration: underline;
    padding: 10px 12px;
}

.cookie-btn-settings:hover {
    color: var(--gray-200);
}

@media (max-width: 640px) {
    .cookie-banner-inner {
        flex-direction: column;
        align-items: flex-start;
    }
    .cookie-banner-actions {
        width: 100%;
        justify-content: stretch;
    }
    .cookie-btn {
        flex: 1;
        text-align: center;
    }
}

/* ========================================
   LEGAL PAGES
   ======================================== */
.legal-page {
    padding: 120px 0 80px;
    min-height: calc(100vh - 200px);
}

.legal-content {
    max-width: 800px;
    margin: 0 auto;
}

.legal-content h1 {
    font-size: 36px;
    font-weight: 800;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.legal-updated {
    font-size: 14px;
    color: var(--gray-500);
    margin-bottom: 48px;
}

.legal-section {
    margin-bottom: 40px;
}

.legal-section h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 16px;
}

.legal-card {
    background: var(--gray-50);
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid var(--gray-200);
}

.legal-card p,
.legal-card li {
    font-size: 15px;
    line-height: 1.7;
    color: var(--gray-600);
    margin-bottom: 8px;
}

.legal-card ul {
    list-style: disc;
    padding-left: 20px;
}

.legal-card li {
    margin-bottom: 6px;
}

.legal-card a {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.legal-card a:hover {
    color: var(--primary-dark);
}

/* ========================================
   ENHANCED ANIMATIONS
   ======================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.3);
    }
    50% {
        box-shadow: 0 0 0 12px rgba(37, 99, 235, 0);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease forwards;
}

.animate-fade-in-scale {
    animation: fadeInScale 0.5s ease forwards;
}

.animate-slide-left {
    animation: slideInLeft 0.6s ease forwards;
}

.animate-slide-right {
    animation: slideInRight 0.6s ease forwards;
}

.pulse-glow {
    animation: pulse-glow 2s ease infinite;
}

/* Stagger children animations */
.stagger-children > * {
    opacity: 0;
    animation: fadeInUp 0.5s ease forwards;
}

.stagger-children > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.3s; }

/* ========================================
   TEXT-TO-SPEECH BUTTON
   ======================================== */
.tts-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--primary-light);
    color: var(--primary);
    border: none;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

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

.tts-btn.speaking {
    background: var(--accent-light);
    color: var(--accent);
    animation: pulse-glow 1.5s ease infinite;
}

/* ========================================
   CONFETTI CANVAS
   ======================================== */
#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
}

/* ========================================
   SOUND TOGGLE
   ======================================== */
.sound-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    z-index: 100;
}

.sound-toggle:hover {
    transform: scale(1.1);
    background: var(--primary-dark);
}

.sound-toggle.muted {
    background: var(--gray-400);
}

/* ========================================
   SCROLL PROGRESS BAR
   ======================================== */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
    z-index: 10001;
    transition: width 0.1s linear;
}

/* ========================================
   ENHANCED BUTTON EFFECTS
   ======================================== */
.btn-shine {
    position: relative;
    overflow: hidden;
}

.btn-shine::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 ease;
}

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

/* ========================================
   CARD HOVER LIFT
   ======================================== */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

/* ========================================
   BADGE ANIMATION
   ======================================== */
@keyframes badge-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.badge-animated {
    animation: badge-pulse 2s ease infinite;
}

/* ========================================
   SKELETON LOADING
   ======================================== */
.skeleton {
    background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius);
}

[data-theme="dark"] .skeleton {
    background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-300) 50%, var(--gray-200) 75%);
    background-size: 200% 100%;
}

/* ========================================
   TOOLTIP
   ======================================== */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-6px);
    padding: 6px 12px;
    background: var(--gray-800);
    color: white;
    font-size: 12px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 1000;
}

[data-tooltip]:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(-2px);
}

/* ========================================
   SCROLLBAR STYLING
   ======================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--gray-300) var(--gray-100);
}

/* ========================================
   SELECTION COLOR
   ======================================== */
::selection {
    background: var(--primary-light);
    color: var(--primary);
}

[data-theme="dark"] ::selection {
    background: var(--primary-dark);
    color: white;
}

/* ========================================
   FOCUS VISIBLE
   ======================================== */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ========================================
   REDUCED MOTION
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .stagger-children > * {
        opacity: 1;
        animation: none;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */
@media print {
    .navbar,
    .cookie-banner,
    .theme-toggle,
    .sound-toggle,
    .scroll-progress {
        display: none !important;
    }
    
    .legal-page {
        padding: 20px 0;
    }
}
