/* --- 1. Import a Modern Font --- */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@300;400;500;700&display=swap');

/* --- 2. Zen Learning — Japanisch-inspirierte Farbpalette --- */
:root {
    /* Primaerfarben — Ai-Iro (Indigo) */
    --zen-indigo: #2B4C7E;
    --zen-indigo-light: #3D6098;
    --zen-indigo-dark: #1E3A5F;

    /* Akzentfarben */
    --zen-sakura: #E8A0B4;
    --zen-matcha: #7A9A5A;
    --zen-matcha-light: #C5D5A8;
    --zen-vermillion: #D14B3D;

    /* Neutrale Toene */
    --zen-washi: #F5F0E8;
    --zen-sumi: #2C2C2C;
    --zen-sumi-light: #5A5A5A;
    --zen-stone: #D4CFC5;

    /* Funktionale Zuordnung (Abwaertskompatibel) */
    --primary-color: var(--zen-indigo);
    --secondary-color: var(--zen-sakura);
    --text-color: var(--zen-sumi);
    --text-light: var(--zen-sumi-light);
    --background-color: var(--zen-washi);
    --card-background: #ffffff;
    --border-color: var(--zen-stone);
    --premium-color: #f5a623;
    --free-color: var(--zen-matcha);
    --color-success: var(--zen-matcha);
    --color-error: var(--zen-vermillion);

    /* Spacing Scale (8px-Basis) */
    --space-1: 0.25rem;  --space-2: 0.5rem;
    --space-3: 0.75rem;  --space-4: 1rem;
    --space-6: 1.5rem;   --space-8: 2rem;
    --space-12: 3rem;    --space-16: 4rem;

    /* Border Radius */
    --radius-sm: 6px;   --radius-md: 12px;
    --radius-lg: 16px;  --radius-xl: 24px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.12);
}

/* --- 3. Apply Global Styles --- */
body {
    font-family: 'Noto Sans JP', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 500;
}

/* --- Make the website much wider --- */
.container {
    max-width: 1800px !important; /* Much wider than Bootstrap's default 1140px */
    padding-left: 2rem !important;
    padding-right: 2rem !important;
}

.container-fluid {
    max-width: 2000px !important; /* Ultra-wide for maximum screen usage */
    margin: 0 auto !important;
    padding-left: 2rem !important;
    padding-right: 2rem !important;
}

/* Wider content areas for lesson pages */
.lesson-header-card,
.lesson-content-card,
.lesson-navigation-top,
.lesson-navigation-bottom,
.page-overview {
    max-width: none !important;
}

/* Make the main content area use almost full width */
.col-12 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
}

/* --- 4. Style Common Elements (Buttons & Badges) --- */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
}

.btn-primary:hover {
    background-color: var(--zen-indigo-light);
    border-color: var(--zen-indigo-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Micro-Interaction: Button-Feedback beim Klick */
.btn:active { transform: scale(0.96) !important; }

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

.badge.bg-warning {
    background-color: var(--premium-color) !important;
    color: white;
}

/* Homepage Styles */
.welcome-card {
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px); /* Creates the frosted glass effect */
    border-radius: 1rem;
    padding: 3rem;
    max-width: 650px;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.welcome-card h1 {
    font-weight: 700;
    color: var(--text-color);
}

/* Modern Welcome Card Styles */
.modern-welcome-card {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 3rem 2.5rem;
    max-width: 800px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1), 0 8px 25px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.modern-welcome-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 24px 24px 0 0;
}

/* Welcome Header */
.welcome-header {
    margin-bottom: 2rem;
}

.welcome-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem auto;
    box-shadow: 0 8px 25px rgba(74, 144, 226, 0.3);
}

.welcome-icon i {
    font-size: 2.5rem;
    color: white;
}

.welcome-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 1rem;
    line-height: 1.2;
}

.welcome-subtitle {
    font-size: 1.125rem;
    color: var(--text-light);
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto;
}

/* Welcome Stats */
.welcome-stats {
    margin: 2.5rem 0;
}

.stats-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    background: rgba(74, 144, 226, 0.05);
    border-radius: 16px;
    padding: 2rem;
    border: 1px solid rgba(74, 144, 226, 0.1);
}

.stat-item {
    text-align: center;
    flex: 1;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
    margin-bottom: 0.5rem;
    display: block;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-light);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-divider {
    width: 1px;
    height: 40px;
    background: rgba(74, 144, 226, 0.2);
    flex-shrink: 0;
}

/* Welcome Actions */
.welcome-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin: 2rem 0;
}

.welcome-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border: 2px solid transparent;
    min-width: 200px;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.welcome-btn::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;
}

.welcome-btn:hover::before {
    left: 100%;
}

.welcome-btn:hover {
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.welcome-btn i {
    font-size: 1.1rem;
}

.welcome-btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #3a7bd5);
    color: white;
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3);
}

.welcome-btn-primary:hover {
    color: white;
    box-shadow: 0 8px 25px rgba(74, 144, 226, 0.4);
}

.welcome-btn-secondary {
    background: linear-gradient(135deg, #6c757d, #5a6268);
    color: white;
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
}

.welcome-btn-secondary:hover {
    color: white;
    box-shadow: 0 8px 25px rgba(108, 117, 125, 0.4);
}

.welcome-btn-success {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.welcome-btn-success:hover {
    color: white;
    box-shadow: 0 8px 25px rgba(40, 167, 69, 0.4);
}

/* Guest Info */
.guest-info {
    margin: 2rem 0;
}

.info-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    background: rgba(23, 162, 184, 0.1);
    border: 1px solid rgba(23, 162, 184, 0.2);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: left;
    max-width: 500px;
    margin: 0 auto;
}

.info-card i {
    color: #17a2b8;
    font-size: 1.25rem;
    margin-top: 0.25rem;
    flex-shrink: 0;
}

.info-content strong {
    color: var(--text-color);
    display: block;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.info-content p {
    color: var(--text-light);
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Login Link */
.login-link {
    color: var(--text-light);
    font-size: 0.95rem;
}

.login-link-btn {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    margin-left: 0.5rem;
    transition: color 0.2s ease;
}

.login-link-btn:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

/* Features Preview */
.features-preview {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    padding-top: 2rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    margin-top: 2rem;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-light);
    font-size: 0.875rem;
    font-weight: 500;
}

.feature-item i {
    color: var(--primary-color);
    font-size: 1rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .modern-welcome-card {
        padding: 1.25rem 0.75rem;
        margin: 0.25rem;
        border-radius: 16px;
        max-width: 98%;
    }
    
    .welcome-header {
        margin-bottom: 1rem;
    }
    
    .welcome-icon {
        width: 50px;
        height: 50px;
        margin-bottom: 0.75rem;
    }
    
    .welcome-icon i {
        font-size: 1.75rem;
    }
    
    .welcome-title {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
        line-height: 1.2;
    }
    
    .welcome-subtitle {
        font-size: 0.9rem;
        line-height: 1.3;
    }
    
    .welcome-stats {
        margin: 1rem 0;
    }
    
    .stats-container {
        flex-direction: column;
        gap: 0.75rem;
        padding: 0.75rem;
        border-radius: 12px;
    }
    
    .stat-item {
        flex: none;
        min-width: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
    }
    
    .stat-number {
        font-size: 1.5rem;
        margin-bottom: 0;
        flex-shrink: 0;
    }
    
    .stat-label {
        font-size: 0.8rem;
        line-height: 1.2;
        text-align: left;
    }
    
    .stat-divider {
        display: none;
    }
    
    .welcome-actions {
        margin: 1rem 0;
        gap: 0.5rem;
    }
    
    .welcome-btn {
        padding: 0.625rem 1rem;
        font-size: 0.85rem;
        min-width: 0;
        flex: 1;
        max-width: none;
    }
    
    .login-link {
        margin-top: 0.75rem;
    }
}

@media (max-width: 576px) {
    .modern-welcome-card {
        padding: 1.25rem 0.75rem;
        margin: 0.25rem;
        border-radius: 12px;
    }
    
    .welcome-icon {
        width: 50px;
        height: 50px;
        margin-bottom: 0.75rem;
    }
    
    .welcome-icon i {
        font-size: 1.75rem;
    }
    
    .welcome-title {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
        line-height: 1.2;
    }
    
    .welcome-subtitle {
        font-size: 0.85rem;
        line-height: 1.3;
    }
    
    .welcome-stats {
        margin: 1.25rem 0;
    }
    
    .stats-container {
        padding: 0.75rem;
        gap: 0.75rem;
    }
    
    .stat-number {
        font-size: 1.25rem;
    }
    
    .stat-label {
        font-size: 0.7rem;
    }
    
    .welcome-actions {
        margin: 1.25rem 0;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .welcome-btn {
        padding: 0.625rem 1rem;
        font-size: 0.85rem;
        width: 100%;
    }
    
    .info-card {
        padding: 0.875rem;
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }
    
    .info-content strong {
        font-size: 0.85rem;
        margin-bottom: 0.25rem;
    }
    
    .info-content p {
        font-size: 0.75rem;
        line-height: 1.4;
    }
    
    .login-link {
        font-size: 0.85rem;
        margin-top: 1rem;
    }
    
    .features-preview {
        margin-top: 1.25rem;
        padding-top: 1.25rem;
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
    
    .feature-item {
        font-size: 0.75rem;
    }
}

/* Ultra-compact for very small screens */
@media (max-width: 400px) {
    .modern-welcome-card {
        padding: 1rem 0.5rem;
        margin: 0.125rem;
    }
    
    .welcome-title {
        font-size: 1.25rem;
    }
    
    .welcome-subtitle {
        font-size: 0.8rem;
    }
    
    .stats-container {
        padding: 0.5rem;
        gap: 0.5rem;
    }
    
    .stat-number {
        font-size: 1.1rem;
    }
    
    .stat-label {
        font-size: 0.65rem;
    }
    
    .welcome-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .info-card {
        padding: 0.75rem;
    }
    
    .info-content strong {
        font-size: 0.8rem;
    }
    
    .info-content p {
        font-size: 0.7rem;
    }
}

/* Lesson Card Styles */
.lesson-card {
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.lesson-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.1);
}

.lesson-card.locked {
    opacity: 0.8;
}

.lesson-card .progress-bar {
    background-color: var(--secondary-color);
}

/* Individual Lesson Page Styles */
.lesson-header-card {
    background-color: var(--card-background);
    border-radius: 12px;
    border: none;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.content-item {
    background-color: var(--card-background);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-color); /* Adds a nice accent */
    border-radius: 8px;
    padding: 1.5rem !important;
    transition: box-shadow 0.2s ease;
}

.content-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.content-item .mark-complete-btn {
    border-radius: 20px; /* Pill-shaped button */
}

/* Make the main lesson card distinct */
.lesson-content-card {
    background-color: transparent;
    border: none;
}

/* Filter card styling */
.filter-card {
    background-color: var(--card-background);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Enhanced Navigation Bar */
.enhanced-navbar {
    background: linear-gradient(135deg, var(--zen-indigo-dark) 0%, var(--zen-indigo) 50%, var(--zen-indigo-light) 100%);
    padding: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    position: relative;
    z-index: 1000;
}

.enhanced-navbar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="navgrain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="0.5" fill="white" opacity="0.05"/><circle cx="75" cy="75" r="0.5" fill="white" opacity="0.05"/><circle cx="50" cy="10" r="0.3" fill="white" opacity="0.05"/></pattern></defs><rect width="100" height="100" fill="url(%23navgrain)"/></svg>');
    pointer-events: none;
}

.navbar-container {
    max-width: 1800px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 70px;
    position: relative;
    z-index: 10;
}

/* Brand Section */
.navbar-brand-section {
    display: flex;
    align-items: center;
}

.enhanced-navbar-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    color: white;
    transition: all 0.3s ease;
}

.enhanced-navbar-brand:hover {
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
}

.brand-icon {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-name {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.brand-tagline {
    font-size: 0.75rem;
    opacity: 0.9;
    font-weight: 300;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    gap: 0.25rem;
}

.hamburger-line {
    width: 25px;
    height: 2px;
    background: white;
    transition: all 0.3s ease;
    border-radius: 1px;
}

.mobile-menu-toggle:hover .hamburger-line {
    background: rgba(255, 255, 255, 0.8);
}

/* Navigation Content */
.navbar-content-wrapper {
    display: flex;
    align-items: center;
    gap: 2rem;
    flex: 1;
    justify-content: space-between;
    margin-left: 2rem;
}

/* Mobile Navigation Menu */
.mobile-nav-menu {
    display: none;
}

.navbar-nav-section {
    display: flex;
    align-items: center;
}

.nav-links {
    display: flex;
    gap: 1rem;
}

.enhanced-nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    color: white;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.enhanced-nav-link:hover {
    color: white;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.enhanced-nav-link i {
    font-size: 0.9rem;
}

/* User Section */
/* --- Gamification: Streak & XP Badges --- */
.user-gamification {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.streak-badge, .xp-badge {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: default;
    transition: transform 0.2s;
}

.streak-badge:hover, .xp-badge:hover {
    transform: scale(1.08);
}

.streak-badge {
    background: linear-gradient(135deg, #ff6b35, #f7931a);
    color: white;
}

.streak-badge i { color: #ffe066; }

.xp-badge {
    background: linear-gradient(135deg, var(--zen-indigo), var(--zen-indigo-light));
    color: white;
}

.xp-badge i { color: #ffd700; }

@keyframes streakPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

.streak-badge.streak-new {
    animation: streakPulse 0.6s ease;
}

/* XP Fly Animation */
.xp-fly {
    position: fixed;
    font-size: 1.2rem;
    font-weight: 700;
    color: #ffd700;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
    pointer-events: none;
    z-index: 9999;
    animation: xpFlyUp 1.2s ease-out forwards;
}

@keyframes xpFlyUp {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    60% { opacity: 1; transform: translateY(-60px) scale(1.3); }
    100% { opacity: 0; transform: translateY(-100px) scale(0.8); }
}

/* --- Progress Bar Shimmer --- */
.progress-bar::after,
.sidebar-progress-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

.progress-bar, .sidebar-progress-fill {
    position: relative;
    overflow: hidden;
}

@keyframes shimmer {
    from { transform: translateX(-100%); }
    to { transform: translateX(100%); }
}

.navbar-user-section {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.user-avatar {
    width: 35px;
    height: 35px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.9rem;
}

.user-details {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.user-name {
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1;
}

.user-subscription {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    opacity: 0.9;
    font-weight: 500;
}

.user-subscription.premium {
    color: #ffd700;
}

.user-subscription.free {
    color: rgba(255, 255, 255, 0.8);
}

/* Action Buttons */
.nav-actions {
    display: flex;
    gap: 0.75rem;
}

.nav-action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.nav-action-btn:hover {
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.admin-btn {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-color: rgba(255, 255, 255, 0.2);
}

.admin-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

.upgrade-btn {
    background: #28a745;
    color: white;
    border-color: #28a745;
}

.upgrade-btn:hover {
    background: #218838;
    color: white;
}

.downgrade-btn {
    background: #ffc107;
    color: #212529;
    border-color: #ffc107;
}

.downgrade-btn:hover {
    background: #e0a800;
    color: #212529;
}

.login-btn {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-color: rgba(255, 255, 255, 0.2);
}

.login-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

.register-btn {
    background: white;
    color: var(--primary-color);
    border-color: white;
}

.register-btn:hover {
    background: rgba(255, 255, 255, 0.9);
    color: var(--primary-color);
}

.logout-btn {
    background: rgba(220, 53, 69, 0.8);
    color: white;
    border-color: rgba(220, 53, 69, 0.8);
}

.logout-btn:hover {
    background: #dc3545;
    color: white;
}

/* Responsive Design for Navigation */
/* ── Navbar Dropdown (Alpine.js, unter 992px) ── */

/* Hamburger-Animation (X-Form wenn offen) */
.hamburger-open-1 { transform: rotate(45deg) translate(5px, 5px); }
.hamburger-open-2 { opacity: 0; }
.hamburger-open-3 { transform: rotate(-45deg) translate(5px, -5px); }

/* Dropdown-Animation */
.nav-dropdown-enter { transition: opacity 0.2s ease-out, transform 0.2s ease-out; }
.nav-dropdown-enter-start { opacity: 0; transform: translateY(-8px); }
.nav-dropdown-enter-end { opacity: 1; transform: translateY(0); }
.nav-dropdown-leave { transition: opacity 0.15s ease-in, transform 0.15s ease-in; }
.nav-dropdown-leave-start { opacity: 1; transform: translateY(0); }
.nav-dropdown-leave-end { opacity: 0; transform: translateY(-8px); }

@media (max-width: 991px) {
    .mobile-menu-toggle {
        display: flex;
    }

    /* Desktop-Wrapper wird zum Dropdown */
    .navbar-content-wrapper {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        background: linear-gradient(135deg, var(--zen-indigo-dark) 0%, var(--zen-indigo) 100%);
        padding: 1.25rem 1.5rem;
        margin-left: 0;
        gap: 1rem;
        border-top: 1px solid rgba(255,255,255,0.1);
        box-shadow: 0 8px 24px rgba(0,0,0,0.2);
        z-index: 999;
    }

    .navbar-nav-section,
    .navbar-user-section {
        width: 100%;
        justify-content: center;
    }

    .nav-links {
        flex-direction: column;
        width: 100%;
        gap: 0.25rem;
    }

    .enhanced-nav-link {
        justify-content: flex-start;
        width: 100%;
        padding: 0.7rem 1rem;
        border-radius: 8px;
    }
    .enhanced-nav-link:hover {
        background: rgba(255,255,255,0.1);
    }

    .navbar-user-section {
        border-top: 1px solid rgba(255,255,255,0.1);
        padding-top: 1rem;
        flex-direction: column;
        gap: 0.75rem;
    }

    .nav-actions {
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
    }

    .user-info {
        justify-content: center;
        width: 100%;
    }
}

/* Desktop: Wrapper immer sichtbar (Alpine x-show Override) */
@media (min-width: 992px) {
    .navbar-content-wrapper {
        display: flex !important;
    }
}

@media (max-width: 768px) {
    .navbar-container {
        padding: 0 1rem;
        min-height: 60px;
    }
    .brand-text { display: none; }
    .brand-icon { width: 40px; height: 40px; font-size: 1.25rem; }
}

@media (max-width: 576px) {
    .user-details { display: none; }
    .user-info { padding: 0.5rem; width: auto; }
}

/* Form improvements */
.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(74, 144, 226, 0.25);
}

.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(74, 144, 226, 0.25);
}

/* Alert improvements */
.alert {
    border-radius: 8px;
    border: none;
}

/* Progress bar improvements */
.progress {
    border-radius: 10px;
    background-color: var(--border-color);
}

.progress-bar {
    border-radius: 10px;
    background: linear-gradient(90deg, var(--zen-matcha), var(--zen-indigo-light));
    position: relative;
    overflow: hidden;
}

/* Shimmer-Effekt auf Fortschrittsbalken */
.progress-bar::after {
    content: '';
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
    animation: progressShimmer 2.5s infinite;
}
@keyframes progressShimmer {
    from { transform: translateX(-100%); }
    to { transform: translateX(100%); }
}

/* Badge improvements */
.badge {
    font-weight: 500;
    padding: 0.5em 0.75em;
}

/* Card improvements */
.card {
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.card-header {
    background-color: var(--background-color);
    border-bottom: 1px solid var(--border-color);
    border-radius: 12px 12px 0 0 !important;
}

/* Button improvements */
.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
}

.btn:hover {
    transform: translateY(-1px);
}

/* Text improvements */
.text-muted {
    color: var(--text-light) !important;
}

/* Interactive content styling */
.quiz-question {
    background-color: var(--background-color);
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.quiz-question .question-header h5 {
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Content type specific styling */
.text-content-container {
    background-color: var(--background-color);
    border-radius: 8px;
    padding: 1.5rem;
}

.content-title {
    color: var(--primary-color);
    font-weight: 600;
}

/* Media content styling */
.ratio iframe {
    border-radius: 8px;
}

audio {
    border-radius: 8px;
}

/* Admin Modal Improvements */
#pageEditorModal .modal-content {
    max-width: 1400px !important;
    width: 95% !important;
}

#lessonContentModal .modal-content {
    max-width: 1200px !important;
    width: 90% !important;
}

#addContentModal .modal-content {
    max-width: 900px !important;
    width: 85% !important;
}

/* Modal Header Improvements */
.modal-header h4 {
    font-size: 1.5rem !important;
    font-weight: 600 !important;
    margin: 0 !important;
    color: var(--text-color) !important;
}

.modal-header {
    padding: 1.5rem 2rem !important;
    border-bottom: 2px solid var(--border-color) !important;
}

/* Page Editor Modal Specific Improvements */
#pageEditorModal .modal-body {
    padding: 2rem !important;
}

#pageEditorModal h5 {
    font-size: 1.25rem !important;
    font-weight: 600 !important;
    color: var(--primary-color) !important;
    margin-bottom: 1.5rem !important;
}

/* Reorder Button Improvements - FORCE BLACK WITH HOVER EFFECTS */
button.reorder-btn,
.btn.reorder-btn,
#pageEditorModal .reorder-btn,
#pageEditorModal button.reorder-btn,
#pageEditorModal .btn.reorder-btn {
    min-width: 40px !important;
    height: 35px !important;
    border: 2px solid #000000 !important;
    background-color: #000000 !important;
    background: #000000 !important;
    color: #ffffff !important;
    font-size: 14px !important;
    font-weight: bold !important;
    border-radius: 6px !important;
    transition: all 0.3s ease-in-out !important;
    margin: 2px 0 !important;
    cursor: pointer !important;
}

button.reorder-btn:hover,
.btn.reorder-btn:hover,
#pageEditorModal .reorder-btn:hover,
#pageEditorModal button.reorder-btn:hover,
#pageEditorModal .btn.reorder-btn:hover {
    background-color: #4a90e2 !important;
    background: #4a90e2 !important;
    border-color: #4a90e2 !important;
    color: #ffffff !important;
    transform: scale(1.1) translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.4) !important;
}

button.reorder-btn:active,
.btn.reorder-btn:active,
#pageEditorModal .reorder-btn:active,
#pageEditorModal button.reorder-btn:active,
#pageEditorModal .btn.reorder-btn:active {
    transform: scale(1.05) translateY(0px) !important;
    box-shadow: 0 2px 6px rgba(74, 144, 226, 0.3) !important;
}

button.reorder-btn:disabled,
.btn.reorder-btn:disabled,
#pageEditorModal .reorder-btn:disabled,
#pageEditorModal button.reorder-btn:disabled,
#pageEditorModal .btn.reorder-btn:disabled {
    background-color: #f8f9fa !important;
    background: #f8f9fa !important;
    border-color: #e9ecef !important;
    color: #6c757d !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
    opacity: 0.6 !important;
}

/* Additional force for any button with onclick containing moveContentInPage */
button[onclick*="moveContentInPage"] {
    background-color: #000000 !important;
    background: #000000 !important;
    border: 2px solid #000000 !important;
    color: #ffffff !important;
    transition: all 0.3s ease-in-out !important;
}

button[onclick*="moveContentInPage"]:hover {
    background-color: #4a90e2 !important;
    background: #4a90e2 !important;
    border-color: #4a90e2 !important;
    color: #ffffff !important;
    transform: scale(1.1) translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.4) !important;
}

button[onclick*="moveContentInPage"]:active {
    transform: scale(1.05) translateY(0px) !important;
    box-shadow: 0 2px 6px rgba(74, 144, 226, 0.3) !important;
}

.order-number {
    font-weight: 600 !important;
    font-size: 16px !important;
    color: var(--text-color) !important;
    padding: 4px 0 !important;
}

/* Action Buttons Improvements */
.btn-sm {
    padding: 0.4rem 0.8rem !important;
    font-size: 0.85rem !important;
    margin-right: 0.25rem !important;
    border-radius: 5px !important;
}

.btn-sm:last-child {
    margin-right: 0 !important;
}

/* Table Improvements for Page Editor */
#pageEditorModal table th {
    background-color: var(--background-color) !important;
    font-weight: 600 !important;
    font-size: 0.9rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    padding: 1rem !important;
    border-bottom: 2px solid var(--border-color) !important;
}

#pageEditorModal table td {
    padding: 1rem !important;
    vertical-align: middle !important;
}

#pageEditorModal table tbody tr:hover {
    background-color: #f8f9fa !important;
}

/* Column Width Adjustments for Page Editor */
#pageEditorModal table th:nth-child(1), /* ORDER */
#pageEditorModal table td:nth-child(1) {
    width: 80px !important;
    min-width: 80px !important;
}

#pageEditorModal table th:nth-child(2), /* TYPE */
#pageEditorModal table td:nth-child(2) {
    width: 120px !important;
    min-width: 120px !important;
}

#pageEditorModal table th:nth-child(3), /* TITLE */
#pageEditorModal table td:nth-child(3) {
    width: auto !important;
    min-width: 200px !important;
}

#pageEditorModal table th:nth-child(4), /* OPTIONAL */
#pageEditorModal table td:nth-child(4) {
    width: 100px !important;
    min-width: 100px !important;
}

#pageEditorModal table th:nth-child(5), /* ACTIONS */
#pageEditorModal table td:nth-child(5) {
    width: 280px !important;
    min-width: 280px !important;
}

/* Action Buttons Container */
#pageEditorModal table td:nth-child(5) {
    white-space: nowrap !important;
}

#pageEditorModal table td:nth-child(5) .btn {
    display: inline-block !important;
    margin-right: 0.5rem !important;
}

#pageEditorModal table td:nth-child(5) .btn:last-child {
    margin-right: 0 !important;
}

/* Content Title Styling */
.content-title {
    font-weight: 600 !important;
    font-size: 1rem !important;
    color: var(--text-color) !important;
    margin-bottom: 0.25rem !important;
}

/* Badge Improvements */
.badge {
    font-size: 0.75rem !important;
    padding: 0.4rem 0.8rem !important;
    border-radius: 12px !important;
    font-weight: 600 !important;
}

/* --- 3D Flip Card Styles --- */

/* 1. The Scene: Establishes the 3D space and perspective. */
.card-scene {
    width: 100%;
    height: 280px;
    perspective: 1000px;
    background-color: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    margin-bottom: 1rem;
    /* overflow:hidden bricht backface-visibility in manchen Browsern.
       overflow:clip ist besser, wird aber nicht ueberall unterstuetzt.
       Daher: kein overflow — stattdessen backface-visibility auf allen Elementen. */
}

/* 2. The Flipper: The 3D object that rotates. */
.card-flipper {
    width: 100%;
    height: 100%;
    position: relative;
    transition: transform 0.8s; /* Smooth animation for the flip. */
    transform-style: preserve-3d; /* Crucial for making children exist in 3D space. */
}

/* 3. The Flipped State: Apply this class with JS to flip the card. */
.card-flipper.is-flipped {
    transform: rotateY(180deg);
}

/* 4. The Faces: Common styles for both front and back. */
.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden; /* Safari */
    backface-visibility: hidden; /* Hides the face when it's turned away. */
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
    /* transition: box-shadow entfernt — kann backface-visibility in Chrome brechen */
}

/* 5. The Front Face: Specific styling. */
.card-face--front {
    background-color: var(--card-background);
    border-left: 4px solid var(--primary-color);
}

/* 6. The Back Face: Specific styling and initial rotation. */
.card-face--back {
    background-color: var(--background-color);
    transform: rotateY(180deg);
    border-left: 4px solid var(--secondary-color);
    overflow-y: auto;
}
.card-face--back.has-image {
    border-left: none;
}

/* Hover effects for flip cards */
.card-scene:hover .card-face {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

/* Focus styles for accessibility */
.card-scene:focus {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* Style for the large Japanese character on the front. */
.flip-card .kana-char {
    font-size: 80px; /* Large, clear character */
    color: var(--primary-color);
    font-family: 'Noto Sans JP', sans-serif;
    font-weight: 500;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Style for the details on the back. */
.flip-card .details {
    text-align: center;
    padding: 20px;
    color: var(--text-color);
    font-size: 16px;
    width: 100%;
}

.flip-card .details p {
    margin: 0 0 8px 0;
    font-weight: 500;
}

.flip-card .details strong {
    color: var(--primary-color);
}

/* Vocabulary specific styling */
.flip-card .vocab-front {
    flex-direction: column;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Vorderseite MIT Bild: Bild als Hintergrund, Text darüber */
.flip-card .vocab-front.has-image {
    position: relative;
    width: 100%;
    height: 100%;
    justify-content: flex-end;
    overflow: hidden;
    border-radius: 12px;
}

.flip-card .has-image .vocab-image {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.flip-card .has-image .vocab-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

/* Text über dem Bild: halbtransparenter Hintergrund */
.flip-card .has-image .vocab-word,
.flip-card .has-image .vocab-reading {
    position: relative;
    z-index: 2;
}

.flip-card .has-image .vocab-word {
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(4px);
    padding: 4px 16px;
    border-radius: 8px;
    font-size: 36px;
    margin-bottom: 4px;
}

.flip-card .has-image .vocab-reading {
    background: rgba(255,255,255,0.75);
    backdrop-filter: blur(4px);
    padding: 2px 12px;
    border-radius: 6px;
    margin-bottom: 8px;
}

.flip-card .vocab-word {
    font-size: 48px;
    color: var(--primary-color);
    font-family: 'Noto Sans JP', sans-serif;
    font-weight: 500;
    margin-bottom: 8px;
}

.flip-card .vocab-reading {
    font-size: 20px;
    color: var(--text-light);
    font-family: 'Noto Sans JP', sans-serif;
}

.flip-card .vocab-romaji {
    font-size: 16px;
    color: var(--text-light);
    font-style: italic;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* Grammar specific styling */
.flip-card .grammar-front {
    flex-direction: column;
    text-align: center;
    padding: 20px;
}

.flip-card .grammar-title {
    font-size: 24px;
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 10px;
}

.flip-card .grammar-structure {
    font-size: 18px;
    color: var(--text-color);
    font-family: 'Courier New', monospace;
    background-color: rgba(74, 144, 226, 0.1);
    padding: 8px 12px;
    border-radius: 6px;
}

/* Flip instruction hint */
.flip-hint {
    position: absolute;
    bottom: 10px;
    right: 15px;
    font-size: 11px;
    color: var(--text-light);
    opacity: 0.7;
    pointer-events: none;
    background: rgba(255,255,255,0.75);
    backdrop-filter: blur(4px);
    padding: 2px 10px;
    border-radius: 10px;
    z-index: 3;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}
/* Flip-Hint beim Flip ausblenden */
.card-flipper.is-flipped .flip-hint {
    display: none;
}

/* Animation for flip hint */
.card-scene:hover .flip-hint {
    opacity: 1;
}

/* --- Flashcard Deck Mode --- */
.deck-container {
    max-width: 750px;
    margin: 0 auto;
    text-align: center;
}

/* Deck progress header */
.deck-header {
    background: linear-gradient(135deg, #f8f9fa, #fff);
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
}
.deck-header .progress {
    height: 10px;
    border-radius: 5px;
    background-color: #e9ecef;
}
.deck-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Single card display area */
.deck-card-area {
    min-height: 380px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}
.deck-card-area .flip-card {
    width: 100%;
    margin-bottom: 0;
}
.deck-card-area .card-scene {
    height: 360px;
    margin-bottom: 0;
}

/* Flashcard image on BACK side — side-by-side layout: image left, text right */
.card-face--back.has-image {
    padding: 0;
    overflow: clip; /* clip statt hidden — bricht backface-visibility nicht */
    display: flex;
    flex-direction: row;
    align-items: stretch;
}
.card-face--back .card-image {
    width: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.card-face--back .card-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 12px 0 0 12px;
}
.card-face--back.has-image .details {
    width: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px 24px;
    font-size: 14px;
    overflow-y: auto;
    text-align: center;
    position: relative;
}
.card-face--back.has-image .details p {
    margin: 0 0 6px 0;
    line-height: 1.5;
}
.card-face--back.has-image .card-audio-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    background: rgba(255,255,255,0.9);
}

/* Back side scrollable for cards without image */
.card-face--back:not(.has-image) .details {
    overflow-y: auto;
    max-height: 100%;
}

/* Confidence buttons (SRS 4-level rating) */
.confidence-buttons {
    display: none;
    gap: 0.4rem;
    justify-content: center;
    margin-top: 0.75rem;
    animation: fadeSlideUp 0.3s ease;
}
.confidence-buttons.visible {
    display: flex;
}
.confidence-btn {
    flex: 1;
    max-width: 140px;
    padding: 0.5rem 0.4rem;
    font-weight: 600;
    font-size: 0.8rem;
    border-radius: 10px;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    line-height: 1.2;
    border: none;
    color: #fff;
}
.confidence-btn .interval-hint {
    font-size: 0.65rem;
    font-weight: 400;
    opacity: 0.85;
    min-height: 0.8em;
}
.confidence-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    color: #fff;
}
/* SRS Button colors */
.btn-srs-again { background-color: #dc3545; }
.btn-srs-again:hover { background-color: #c82333; color: #fff; }
.btn-srs-hard { background-color: #fd7e14; }
.btn-srs-hard:hover { background-color: #e8690b; color: #fff; }
.btn-srs-good { background-color: #28a745; }
.btn-srs-good:hover { background-color: #218838; color: #fff; }
.btn-srs-easy { background-color: #007bff; }
.btn-srs-easy:hover { background-color: #0069d9; color: #fff; }

@media (max-width: 576px) {
    .confidence-btn {
        padding: 0.4rem 0.25rem;
        font-size: 0.7rem;
        max-width: none;
    }
    .confidence-btn i { display: none; }
    .confidence-btn .interval-hint { font-size: 0.6rem; }
}

/* Card transition animations — nur opacity, kein transform (bricht backface-visibility) */
.deck-card-area .flip-card {
    transition: opacity 0.3s ease;
}
.deck-card-area .flip-card.card-exit-right {
    animation: slideOutRight 0.35s ease forwards;
}
.deck-card-area .flip-card.card-exit-left {
    animation: slideOutLeft 0.35s ease forwards;
}
.deck-card-area .flip-card.card-exit-shake {
    animation: cardShake 0.4s ease;
}
.deck-card-area .flip-card.card-enter {
    animation: cardFadeIn 0.3s ease;
}
@keyframes slideOutRight {
    to { opacity: 0; }
}
@keyframes slideOutLeft {
    to { opacity: 0; }
}
@keyframes cardShake {
    0%, 100% { margin-left: 0; }
    25% { margin-left: -10px; }
    75% { margin-left: 10px; }
}
@keyframes cardFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Deck complete message */
.deck-complete {
    text-align: center;
    padding: 2rem 1rem;
    animation: fadeSlideUp 0.5s ease;
}
.deck-complete-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}
.deck-complete h4 {
    color: var(--primary-color);
    font-weight: 700;
}

/* Hide original content-item wrapper for cards in deck mode */
.content-item.in-deck {
    display: none !important;
}

/* --- Read Aloud Player Bar --- */
.read-aloud-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 6px 10px;
    background: #f0f4f8;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}
.read-aloud-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}
.read-aloud-btn:hover {
    transform: scale(1.1);
}
.read-aloud-play {
    background: var(--primary-color);
    color: white;
}
.read-aloud-play:hover {
    background: #3a7bd5;
}
.read-aloud-play.is-playing {
    background: #f59e0b;
}
.read-aloud-play.is-paused {
    background: #10b981;
}
.read-aloud-stop {
    background: #ef4444;
    color: white;
}
.read-aloud-stop:hover {
    background: #dc2626;
}
.read-aloud-label {
    font-size: 0.75rem;
    color: #64748b;
    margin-left: 4px;
}

/* --- Audio Button on Card Back --- */
.card-audio-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
    background: transparent;
    color: var(--primary-color);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
}
.card-audio-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
}
.card-audio-btn.playing {
    background: var(--primary-color);
    color: white;
    animation: audioPulse 0.8s ease infinite;
}
@keyframes audioPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(74, 144, 226, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(74, 144, 226, 0); }
}

/* --- Completion Modal --- */
.completion-modal {
    border: none;
    border-radius: 20px;
    overflow: hidden;
    background: linear-gradient(180deg, #fff9e6 0%, #ffffff 30%);
}
.completion-icon {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    animation: bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
.completion-icon i {
    font-size: 2.5rem;
    color: white;
}
.completion-title {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #4a90e2, #50e3c2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.stat-card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1rem 0.5rem;
}
.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #4a90e2;
}
.stat-label {
    font-size: 0.8rem;
    color: #6c757d;
    text-transform: uppercase;
}
@keyframes bounceIn {
    0% { transform: scale(0); opacity: 0; }
    60% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}
@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.stat-card:nth-child(1) { animation: fadeSlideUp 0.4s ease forwards; }
.stat-card:nth-child(2) { animation: fadeSlideUp 0.4s 0.15s ease forwards; }
.stat-card:nth-child(3) { animation: fadeSlideUp 0.4s 0.3s ease forwards; }

/* --- Keyboard Shortcut Hints --- */
.kbd-hint {
    display: inline-block;
    background: #e9ecef;
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 0 6px;
    font-size: 0.75rem;
    font-family: monospace;
    color: #495057;
    margin-left: 4px;
    line-height: 1.6;
}

/* Page Title Styling - Make lesson page titles smaller and more readable */
.page-title {
    font-size: 1.25rem !important; /* Smaller than default h4 */
    font-weight: 600 !important;
    color: var(--primary-color) !important;
    line-height: 1.4 !important;
    margin-bottom: 1rem !important;
    max-width: 1600px !important; /* Ultra-wide for maximum screen usage */
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Make page descriptions smaller too */
.page-description {
    font-size: 0.95rem !important;
    line-height: 1.5 !important;
    max-width: 1500px !important; /* Ultra-wide for maximum screen usage */
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Desktop content title improvements - make content headings smaller */
.content-item h1,
.content-item h2,
.content-item h3,
.content-item h4 {
    font-size: 1.3rem !important;
    line-height: 1.4 !important;
    margin-bottom: 1rem !important;
    font-weight: 600 !important;
}

/* Markdown-Hierarchie in LessonContent: visuelle Differenzierung */
.rich-text-content h2 {
    font-size: 1.5rem !important;
    line-height: 1.3 !important;
    margin: 1.5rem 0 0.75rem !important;
    font-weight: 700 !important;
    color: var(--primary-color, #1e3a8a) !important;
    border-bottom: 2px solid rgba(30, 58, 138, 0.15);
    padding-bottom: 0.35rem;
}
.rich-text-content h3 {
    font-size: 1.2rem !important;
    line-height: 1.35 !important;
    margin: 1.25rem 0 0.5rem !important;
    font-weight: 600 !important;
    color: #334155 !important;
}
.rich-text-content h4 {
    font-size: 1.05rem !important;
    line-height: 1.4 !important;
    margin: 1rem 0 0.4rem !important;
    font-weight: 600 !important;
    color: #475569 !important;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.rich-text-content strong, .rich-text-content b {
    color: #0f172a;
    font-weight: 700;
}
.rich-text-content em, .rich-text-content i {
    color: #475569;
    font-style: italic;
}
.rich-text-content ul, .rich-text-content ol {
    margin: 0.5rem 0 1rem 1.5rem;
    padding-left: 0.5rem;
}
.rich-text-content ul li, .rich-text-content ol li {
    margin: 0.35rem 0;
    line-height: 1.6;
}
.rich-text-content blockquote {
    border-left: 4px solid #fbbf24;
    background: rgba(251, 191, 36, 0.08);
    padding: 0.6rem 0.9rem;
    margin: 0.9rem 0;
    border-radius: 0 6px 6px 0;
    font-style: italic;
    color: #334155;
}
.rich-text-content code {
    background: #f1f5f9;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.92em;
    color: #be123c;
}
.rich-text-content p {
    margin: 0.6rem 0 0.9rem;
}
.rich-text-content hr {
    border: none;
    border-top: 1px dashed #cbd5e1;
    margin: 1.25rem 0;
}

/* Target text content container headings on desktop */
.text-content-container h1,
.text-content-container h2,
.text-content-container h3,
.text-content-container h4 {
    font-size: 1.3rem !important;
    line-height: 1.4 !important;
    margin-bottom: 1rem !important;
    font-weight: 600 !important;
}

/* Target any remaining large headings in content on desktop */
.content-body h1,
.content-body h2,
.content-body h3,
.content-body h4 {
    font-size: 1.3rem !important;
    line-height: 1.4 !important;
    margin-bottom: 1rem !important;
    font-weight: 600 !important;
}

/* Content areas should use more width */
.text-content-container {
    background-color: var(--background-color);
    border-radius: 8px;
    padding: 1.5rem;
    max-width: none !important; /* Remove width constraints */
}

/* Rich text content should be wider */
.rich-text-content {
    max-width: none !important;
    font-size: 1rem !important;
    line-height: 1.6 !important;
}

/* Center-align only content items that contain images */
.content-item:has(img) {
    text-align: center !important;
}

.content-item:has(img) img {
    display: block !important;
    margin: 0 auto !important;
}

.content-item:has(img) .text-content-container {
    text-align: center !important;
}

.content-item:has(img) .rich-text-content {
    text-align: center !important;
}

.content-item:has(img) .content-title {
    text-align: center !important;
}

.content-item:has(img) .mb-3 {
    text-align: center !important;
}

/* Fallback for browsers that don't support :has() selector */
.content-item img {
    display: block !important;
    margin: 0 auto !important;
}

/* Only center content items with image content type */
.content-item[data-content-id] {
    /* Reset text alignment to default */
    text-align: left !important;
}

/* Specifically target image content items */
.content-item .content-body:has(img),
.content-item:has(img[src*="uploads"]),
.content-item:has(img[src*="static"]) {
    text-align: center !important;
}

.content-item .content-body:has(img) .mb-3,
.content-item:has(img[src*="uploads"]) .mb-3,
.content-item:has(img[src*="static"]) .mb-3 {
    text-align: center !important;
}

/* Text-audio Player darf den Markdown-Text NICHT zentrieren — er erbt sonst
   von .content-item:has([src*="uploads"]) wegen des audio-src. Forciere
   left-align fuer rich-text-content + den Player selbst. */
.text-audio-player {
    text-align: left !important;
}
.content-item:has(.text-audio-player) .rich-text-content,
.content-item:has(.text-audio-player) .text-content-container,
.content-item:has(.text-audio-player) .content-body {
    text-align: left !important;
}

/* Make lesson images smaller and more manageable */
.content-item img,
.lesson-content-card img,
.content-body img {
    max-width: 750px !important; /* Limit maximum width */
    width: auto !important;
    height: auto !important;
    display: block !important;
    margin: 0 auto !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

/* For very large screens, make images even more reasonable */
@media (min-width: 1200px) {
    .content-item img,
    .lesson-content-card img,
    .content-body img {
        max-width: 650px !important;
    }
}

/* For mobile devices, allow images to be responsive but still reasonable */
@media (max-width: 768px) {
    .content-item img,
    .lesson-content-card img,
    .content-body img {
        max-width: 100% !important;
        width: 100% !important;
    }
}

/* For very small mobile screens */
@media (max-width: 576px) {
    .content-item img,
    .lesson-content-card img,
    .content-body img {
        max-width: 100% !important;
        width: 100% !important;
    }
}

/* Enhanced Courses Page Styles */

/* Hero Section */
.courses-hero-section {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    padding: 4rem 0 3rem 0;
    margin-top: -20px;
    color: white;
    position: relative;
    overflow: hidden;
}

.courses-hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="white" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="white" opacity="0.1"/><circle cx="50" cy="10" r="0.5" fill="white" opacity="0.1"/><circle cx="10" cy="60" r="0.5" fill="white" opacity="0.1"/><circle cx="90" cy="40" r="0.5" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    pointer-events: none;
}

.courses-hero-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.courses-hero-subtitle {
    font-size: 1.25rem;
    margin-bottom: 2.5rem;
    opacity: 0.95;
    font-weight: 300;
    line-height: 1.6;
}

.courses-stats-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 50px;
    padding: 1.5rem 2rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    max-width: 500px;
    margin: 0 auto;
}

.stat-item {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.stat-divider {
    width: 1px;
    height: 40px;
    background: rgba(255, 255, 255, 0.3);
}

/* Main Content */
.courses-main-content {
    padding: 3rem 0;
}

/* Enhanced Course Cards */
.enhanced-course-card {
    background: var(--card-background);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border: 1px solid var(--border-color);
    height: 100%;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(30px);
}

.enhanced-course-card.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.enhanced-course-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.course-card-image-container {
    position: relative;
    height: 200px;
    overflow: hidden;
}

.course-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.enhanced-course-card:hover .course-card-image {
    transform: scale(1.05);
}

.course-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.1) 0%, rgba(0, 0, 0, 0.3) 100%);
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    padding: 1rem;
}

.course-level-badge {
    background: rgba(255, 255, 255, 0.95);
    color: var(--primary-color);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.course-card-content {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.course-card-header {
    margin-bottom: 1rem;
}

.course-card-title {
    font-size: 1.375rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

.course-card-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.course-meta-item {
    font-size: 0.875rem;
    color: var(--text-light);
    display: flex;
    align-items: center;
    font-weight: 500;
}

.course-meta-item i {
    color: var(--primary-color);
    font-size: 0.75rem;
}

.course-card-description {
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 1.5rem;
    flex: 1;
}

.course-card-footer {
    margin-top: auto;
}

.course-progress-info {
    margin-bottom: 1rem;
}

.progress-bar-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.progress-bar-bg {
    flex: 1;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 500;
    white-space: nowrap;
}

.course-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    padding: 0.875rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    width: 100%;
}

.course-action-btn:hover {
    background: var(--secondary-color);
    color: white;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.3);
}

.course-action-btn .btn-icon {
    transition: transform 0.3s ease;
}

.course-action-btn:hover .btn-icon {
    transform: translateX(4px);
}

/* Loading, Empty, and Error States */
.empty-state-icon,
.error-state-icon {
    font-size: 4rem;
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

.error-state-icon {
    color: #dc3545;
}

.empty-state-title,
.error-state-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 1rem;
}

.empty-state-text,
.error-state-text {
    color: var(--text-light);
    font-size: 1.1rem;
    line-height: 1.6;
    max-width: 500px;
    margin: 0 auto 2rem auto;
}

/* Mobile-first responsive improvements */
@media (max-width: 768px) {
    /* Reduce container padding to minimize white space */
    .container {
        max-width: 100% !important;
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
    
    /* Reduce column padding */
    .col-12 {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
    
    /* Make lesson cards use full width */
    .lesson-header-card,
    .lesson-content-card,
    .lesson-navigation-top,
    .lesson-navigation-bottom,
    .page-overview {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    /* Reduce card padding on mobile */
    .card-body {
        padding: 1rem !important;
    }
    
    /* Make lesson title much smaller on mobile */
    .lesson-header-card .card-title,
    .lesson-header-card h1 {
        font-size: 1.5rem !important;
        line-height: 1.3 !important;
        margin-bottom: 0.75rem !important;
    }
    
    /* Make page titles much smaller */
    .page-title {
        font-size: 1rem !important;
        line-height: 1.3 !important;
        margin-bottom: 0.75rem !important;
    }
    
    .page-description {
        font-size: 0.85rem !important;
        margin-bottom: 1rem !important;
    }
    
    /* Reduce content item padding */
    .content-item {
        padding: 0.75rem !important;
        margin-bottom: 1rem !important;
    }
    
    /* Make content titles smaller */
    .content-item h6,
    .content-title {
        font-size: 0.95rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    /* Reduce navigation padding */
    .lesson-navigation-top,
    .lesson-navigation-bottom {
        padding: 0.75rem !important;
        margin-left: -0.5rem !important;
        margin-right: -0.5rem !important;
    }
    
    /* Make page overview more compact */
    .page-overview {
        margin-left: -0.5rem !important;
        margin-right: -0.5rem !important;
        margin-bottom: 1rem !important;
    }
    
    .page-overview-header {
        padding: 0.75rem 1rem !important;
    }
    
    .page-overview-content {
        padding: 0.5rem !important;
    }
    
    .page-menu-item {
        padding: 0.5rem 0.75rem !important;
        margin-bottom: 0.25rem !important;
    }
    
    .page-menu-number {
        width: 25px !important;
        height: 25px !important;
        font-size: 0.8rem !important;
        margin-right: 0.75rem !important;
    }
    
    /* Welcome card adjustments */
    .welcome-card {
        padding: 1.5rem;
        margin: 0.75rem;
    }
    
    /* Make admin modals responsive on mobile */
    #pageEditorModal .modal-content,
    #lessonContentModal .modal-content,
    #addContentModal .modal-content {
        width: 95% !important;
        max-width: none !important;
    }
    
    /* Responsive flip cards */
    .card-scene {
        height: 160px;
    }
    
    .flip-card .kana-char {
        font-size: 60px;
    }
    
    .flip-card .vocab-word {
        font-size: 36px;
    }
    
    .flip-card .vocab-reading {
        font-size: 16px;
    }
    
    .flip-card .grammar-title {
        font-size: 20px;
    }
    
    .flip-card .grammar-structure {
        font-size: 16px;
    }
    
    .flip-card .details {
        font-size: 14px;
        padding: 15px;
    }

    /* Mobile: stack image above text */
    .card-face--back.has-image {
        flex-direction: column;
    }
    .card-face--back.has-image .card-image {
        width: 100%;
        height: 50%;
    }
    .card-face--back.has-image .card-image img {
        border-radius: 12px 12px 0 0;
    }
    .card-face--back.has-image .details {
        width: 100%;
        height: 50%;
        padding: 10px 12px;
        font-size: 12px;
    }

    /* Courses page mobile adjustments */
    .courses-hero-section {
        padding: 2.5rem 0 2rem 0;
    }
    
    .courses-hero-title {
        font-size: 2rem;
    }
    
    .courses-hero-subtitle {
        font-size: 1rem;
        margin-bottom: 2rem;
    }
    
    .courses-stats-bar {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .stat-item {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }
    
    .stat-number {
        font-size: 1.5rem;
        margin-bottom: 0;
    }
    
    .stat-divider {
        display: none;
    }
    
    .course-card-image-container {
        height: 160px;
    }
    
    .course-card-title {
        font-size: 1.25rem;
    }
    
    .course-card-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .courses-main-content {
        padding: 2rem 0;
    }
}

@media (max-width: 576px) {
    /* Ultra-compact mobile layout */
    .container {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
    
    .col-12 {
        padding-left: 0.25rem !important;
        padding-right: 0.25rem !important;
    }
    
    /* Make lesson titles even smaller on very small screens */
    .lesson-header-card .card-title,
    .lesson-header-card h1 {
        font-size: 1.25rem !important;
        line-height: 1.2 !important;
    }
    
    .page-title {
        font-size: 0.95rem !important;
        line-height: 1.2 !important;
    }
    
    .page-description {
        font-size: 0.8rem !important;
    }
    
    /* Ultra-compact content items */
    .content-item {
        padding: 0.5rem !important;
        margin-bottom: 0.75rem !important;
    }
    
    .content-item h6,
    .content-title {
        font-size: 0.9rem !important;
    }
    
    /* Compact navigation */
    .lesson-navigation-top,
    .lesson-navigation-bottom {
        padding: 0.5rem !important;
        margin-left: -0.25rem !important;
        margin-right: -0.25rem !important;
    }
    
    .nav-btn {
        min-width: 80px !important;
        padding: 0.4rem 0.75rem !important;
        font-size: 0.85rem !important;
    }
    
    .page-counter {
        font-size: 0.9rem !important;
    }
    
    /* Compact page overview */
    .page-overview {
        margin-left: -0.25rem !important;
        margin-right: -0.25rem !important;
    }
    
    .page-overview-header {
        padding: 0.5rem 0.75rem !important;
    }
    
    .page-overview-header h6 {
        font-size: 0.9rem !important;
    }
    
    /* Courses page mobile adjustments */
    .courses-hero-title {
        font-size: 1.75rem;
    }
    
    .courses-hero-subtitle {
        font-size: 0.95rem;
    }
    
    .enhanced-course-card {
        margin-bottom: 1.5rem;
    }
    
    .course-card-content {
        padding: 1.25rem;
    }
}

/* Japanese Text Audio Styling */
.japanese-audio-text {
    color: var(--primary-color);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-weight: 500;
    text-decoration: underline;
    text-decoration-color: transparent;
    display: inline;
}

.japanese-audio-text:hover {
    background-color: rgba(74, 144, 226, 0.1);
    text-decoration-color: var(--primary-color);
    transform: translateY(-1px);
}

.japanese-audio-text.playing-audio {
    background-color: var(--secondary-color);
    color: white;
    animation: audioPlaying 1s infinite;
}

@keyframes audioPlaying {
    0%, 100% { 
        background-color: var(--secondary-color);
        transform: scale(1);
    }
    50% { 
        background-color: var(--primary-color);
        transform: scale(1.05);
    }
}

/* Mobile responsive adjustments for Japanese audio text */
@media (max-width: 768px) {
    .japanese-audio-text {
        padding: 3px 5px;
        font-size: 1rem;
        line-height: 1.4;
    }
    
    .japanese-audio-text:hover {
        background-color: rgba(74, 144, 226, 0.15);
    }
}

/* TTS — Klickbare Absaetze und Zeilen */
.tts-segment,
.tts-line {
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background 0.15s, box-shadow 0.15s;
}
.tts-segment:hover,
.tts-line:hover {
    background: rgba(43, 76, 126, 0.06);
}
.tts-segment.tts-playing,
.tts-line.tts-playing {
    background: rgba(43, 76, 126, 0.12);
    box-shadow: 0 0 0 2px rgba(43, 76, 126, 0.15);
}

/* Enhanced Course View Page Styles */

/* Course Hero Section */
.enhanced-course-hero {
    position: relative;
    height: 100vh;
    min-height: 600px;
    max-height: 800px;
    display: flex;
    align-items: center;
    overflow: hidden;
    margin-top: -20px;
}

.course-hero-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: blur(2px);
    transform: scale(1.1);
}

.course-hero-overlay {
    /* Remove overlay completely to show background image at 100% */
    display: none;
}

.course-hero-content {
    position: relative;
    z-index: 10;
    width: 100%;
    color: white;
}

.course-category-badge {
    display: inline-block;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 2rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.course-hero-title {
    font-size: 4rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    line-height: 1.1;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    border-radius: 20px;
    color: white;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    display: inline-block;
}

.course-hero-description {
    font-size: 1.375rem;
    font-weight: 300;
    line-height: 1.6;
    margin-bottom: 3rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    padding: 1.5rem 2rem;
    border-radius: 15px;
    color: white;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.3);
}

/* Course Stats Row */
.course-stats-row {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.course-stat-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 1.25rem 1.75rem;
    border-radius: 20px;
    min-width: 140px;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.3);
    color: white;
}

.stat-icon {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.stat-number {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.25rem;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.85);
}

/* Enhanced Progress Section */
.course-progress-section {
    margin-bottom: 3rem;
}

.progress-container {
    max-width: 600px;
    margin: 0 auto;
}

.progress-track {
    position: relative;
    height: 12px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 1rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-radius: 6px;
    transition: width 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.4);
}

.progress-glow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
    transition: left 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    font-weight: 500;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    padding: 0.5rem 1rem;
    border-radius: 10px;
    color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Action Buttons */
.course-action-buttons {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.course-primary-btn,
.course-secondary-btn {
    display: inline-flex;
    align-items: center;
    padding: 1rem 2.5rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1.1rem;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border: 2px solid transparent;
    min-width: 200px;
    justify-content: center;
}

.course-primary-btn {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.course-primary-btn:hover {
    background: rgba(255, 255, 255, 0.95);
    color: var(--primary-color);
    text-decoration: none;
    transform: translateY(-3px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.course-secondary-btn {
    background: transparent;
    color: white;
    border-color: rgba(255, 255, 255, 0.5);
}

.course-secondary-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-decoration: none;
    border-color: white;
    transform: translateY(-3px);
}

/* Course View Lesson Cards Enhancement */
.lesson-card {
    transition: all 0.3s ease;
    margin-bottom: 1rem;
}

.lesson-card:hover {
    transform: translateY(-2px);
}

.lesson-card-link {
    display: block;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.lesson-card-link:hover {
    text-decoration: none !important;
}

.lesson-card-link:hover .card {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important;
    border-color: var(--primary-color) !important;
}

.lesson-card-link:hover .lesson-title {
    color: var(--primary-color) !important;
}

.lesson-card-link:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: 0.375rem;
}

.lesson-number {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lesson-status {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.lesson-status.completed {
    background-color: #d4edda;
}

.lesson-status.in-progress {
    background-color: #fff3cd;
}

.lesson-status.not-started {
    background-color: #f8f9fa;
    border: 2px solid #dee2e6;
    color: #6c757d;
    font-weight: bold;
}

.lesson-num {
    font-size: 0.9rem;
    font-weight: bold;
}

.course-sidebar {
    position: sticky;
    top: 20px;
}

.stat-item {
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.stat-item:last-child {
    border-bottom: none;
}

.bg-gradient {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
}

/* Responsive Design for Course View */
@media (max-width: 768px) {
    .enhanced-course-hero {
        height: 80vh;
        min-height: 500px;
    }
    
    .course-hero-title {
        font-size: 2.5rem;
    }
    
    .course-hero-description {
        font-size: 1.125rem;
        margin-bottom: 2rem;
    }
    
    .course-stats-row {
        gap: 1rem;
        margin-bottom: 2rem;
    }
    
    .course-stat-item {
        min-width: 120px;
        padding: 1rem 1.25rem;
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
    
    .stat-content {
        align-items: center;
    }
    
    .course-action-buttons {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
    
    .course-primary-btn,
    .course-secondary-btn {
        width: 100%;
        max-width: 300px;
    }
    
    .course-sidebar {
        position: static;
        margin-top: 2rem;
    }
}

@media (max-width: 576px) {
    .enhanced-course-hero {
        height: 70vh;
        min-height: 450px;
    }
    
    .course-hero-title {
        font-size: 2rem;
    }
    
    .course-hero-description {
        font-size: 1rem;
    }
    
    .course-stats-row {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }
    
    .course-stat-item {
        width: 100%;
        max-width: 250px;
    }
    
    .course-category-badge {
        font-size: 0.75rem;
        padding: 0.5rem 1rem;
        margin-bottom: 1.5rem;
    }
}

/* Enhanced Split Layout Lesson Cards */

/* Default lesson cards (no background image) */
.lesson-card-default {
    background: white;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.lesson-card-default:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

/* Split layout lesson cards (with background image) */
.lesson-card-split {
    background: white;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-radius: 16px;
    border: none;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.lesson-card-split:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.15);
}

/* Image section - top 45% of the card */
.lesson-card-image-section {
    height: 180px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    overflow: hidden;
}

.lesson-card-image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.1) 0%,
        rgba(0, 0, 0, 0.2) 50%,
        rgba(0, 0, 0, 0.4) 100%
    );
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 1rem;
}

.lesson-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.lesson-badges .badge {
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    font-weight: 600;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
}

/* Content section - bottom 55% of the card */
.lesson-card-content-section {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 200px;
    background: white;
}

.lesson-card-header {
    margin-bottom: 1rem;
}

.lesson-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.75rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.lesson-card-description {
    color: var(--text-light);
    font-size: 0.9rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0;
}

.lesson-card-footer {
    margin-top: auto;
}

.lesson-meta-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.meta-item {
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 500;
}

/* Custom progress bar for split layout */
.lesson-progress-bar {
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* Action button for split layout */
.lesson-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    padding: 0.875rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    border: none;
    width: 100%;
    cursor: pointer;
}

.lesson-action-btn:hover {
    background: var(--secondary-color);
    color: white;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.3);
}

.lesson-action-btn-disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.lesson-action-btn-disabled:hover {
    background: #6c757d;
    transform: none;
    box-shadow: none;
}

.lesson-login-hint {
    display: block;
    text-align: center;
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-light);
}

.lesson-login-hint a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.lesson-login-hint a:hover {
    text-decoration: underline;
}

/* Locked state for split layout cards */
.lesson-card-split.locked {
    opacity: 0.8;
}

.lesson-card-split.locked .lesson-card-image-overlay {
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.3) 0%,
        rgba(0, 0, 0, 0.5) 50%,
        rgba(0, 0, 0, 0.7) 100%
    );
}

/* Responsive adjustments for split layout */
@media (max-width: 768px) {
    .lesson-card-image-section {
        height: 140px;
    }
    
    .lesson-card-content-section {
        padding: 1.25rem;
        min-height: 180px;
    }
    
    .lesson-card-title {
        font-size: 1.1rem;
    }
    
    .lesson-card-description {
        font-size: 0.85rem;
    }
    
    .lesson-action-btn {
        padding: 0.75rem 1.25rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 576px) {
    .lesson-card-image-section {
        height: 120px;
    }
    
    .lesson-card-content-section {
        padding: 1rem;
        min-height: 160px;
    }
    
    .lesson-card-title {
        font-size: 1rem;
        -webkit-line-clamp: 1;
    }
    
    .lesson-card-description {
        font-size: 0.8rem;
        -webkit-line-clamp: 1;
    }
    
    .lesson-meta-row {
        flex-direction: column;
        gap: 0.25rem;
        margin-bottom: 0.75rem;
    }
    
    .lesson-badges {
        gap: 0.25rem;
    }
    
    .lesson-badges .badge {
        font-size: 0.75rem;
        padding: 0.3rem 0.6rem;
    }
}

/* ══════════════════════════════════════════════════════════════════
   MOBILE BOTTOM NAVIGATION BAR
   ══════════════════════════════════════════════════════════════════ */
.mobile-bottom-nav {
    display: none; /* Hidden on desktop */
}

@media (max-width: 767px) {
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1040;
        background: rgba(255, 255, 255, 0.97);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-top: 1px solid rgba(0, 0, 0, 0.06);
        box-shadow: 0 -1px 8px rgba(0, 0, 0, 0.04);
        padding: 0.2rem 0.5rem;
        padding-bottom: calc(0.2rem + env(safe-area-inset-bottom, 0px));
        gap: 0.25rem;
        border-radius: 18px 18px 0 0;
    }

    .bottom-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.1rem;
        padding: 0.25rem 0.4rem;
        color: #6b7280;
        text-decoration: none;
        font-size: 0.6rem;
        font-weight: 500;
        transition: color 0.15s;
        min-height: 40px;
        border-radius: 12px;
        -webkit-tap-highlight-color: transparent;
    }

    .bottom-nav-item i {
        font-size: 1.05rem;
        transition: transform 0.15s;
    }

    .bottom-nav-item.active {
        color: var(--zen-indigo, #2b4c7e);
        background: rgba(43, 76, 126, 0.06);
    }

    .bottom-nav-item.active i {
        transform: scale(1.08);
    }

    .bottom-nav-item:active {
        color: var(--zen-indigo, #2b4c7e);
        transform: scale(0.95);
    }

    /* Body padding-bottom fuer Bottom-Nav-Platz */
    body {
        padding-bottom: 56px !important;
    }

    /* Admin-FAB ueber die Bottom-Nav + ggf. Lesson-Nav schieben */
    .admin-floating-edit {
        bottom: 110px !important;
    }

    /* Back-to-Top ueber die Bottom-Nav schieben */
    .back-to-top,
    #backToTop {
        bottom: 66px !important;
    }
}

/* ══════════════════════════════════════════════════════════════════
   SKELETON LOADER (fuer Lessons + allgemein)
   ══════════════════════════════════════════════════════════════════ */
.skeleton {
    position: relative;
    overflow: hidden;
    background: #e5e7eb;
    border-radius: 8px;
}

.skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
    animation: skeleton-shimmer 1.5s infinite;
}

@keyframes skeleton-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.skeleton-card {
    border-radius: 16px;
    overflow: hidden;
}

.skeleton-card .skeleton-image {
    width: 100%;
    height: 160px;
}

.skeleton-card .skeleton-title {
    height: 20px;
    width: 70%;
    margin: 1rem;
}

.skeleton-card .skeleton-text {
    height: 14px;
    width: 90%;
    margin: 0.5rem 1rem;
}

.skeleton-card .skeleton-badge {
    height: 24px;
    width: 80px;
    margin: 0.5rem 1rem 1rem;
    border-radius: 12px;
}

/* ══════════════════════════════════════════════════════════════════
   PREFERS-REDUCED-MOTION
   ══════════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .skeleton::after {
        animation: none !important;
    }
}

/* ══════════════════════════════════════════════════════════════════
   TAP-TARGET MINIMUM SIZE (44px Apple/Google)
   ══════════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
    a.btn,
    button,
    .btn,
    .nav-btn,
    .form-select,
    .form-control,
    select {
        min-height: 44px;
    }

    .enhanced-nav-link,
    .nav-action-btn {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

/* ══════════════════════════════════════════════════════════════════
   SWIPE HINT (Progressive Disclosure)
   ══════════════════════════════════════════════════════════════════ */
.swipe-hint {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 0.6rem 1.25rem;
    border-radius: 24px;
    font-size: 0.8rem;
    z-index: 1060;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
    white-space: nowrap;
}

.swipe-hint.show {
    opacity: 1;
}

.swipe-hint i {
    margin: 0 0.35rem;
}
