/* Premium Dark Theme for German Learning App */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&family=Vazirmatn:wght@300;400;500;700&display=swap');

:root {
    --bg-main: #0B0816;
    --bg-gradient: linear-gradient(135deg, #0E0A21 0%, #06040A 100%);
    --card-bg: rgba(255, 255, 255, 0.03);
    --card-border: rgba(255, 255, 255, 0.07);
    --card-hover-border: rgba(124, 58, 237, 0.4);
    
    --primary: #7C3AED;
    --primary-hover: #6D28D9;
    --primary-glow: rgba(124, 58, 237, 0.35);
    
    --accent: #F59E0B;
    --accent-glow: rgba(245, 158, 11, 0.2);
    
    --text-primary: #F3F4F6;
    --text-secondary: #9CA3AF;
    --text-muted: #6B7280;
    
    --success: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;
    --info: #3B82F6;
    
    --font-en: 'Plus Jakarta Sans', sans-serif;
    --font-fa: 'Vazirmatn', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-main);
    background-image: var(--bg-gradient);
    color: var(--text-primary);
    font-family: var(--font-en);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Glassmorphism Classes */
.glass-panel {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-panel:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb {
    background: rgba(124, 58, 237, 0.3);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(124, 58, 237, 0.6);
}

/* Header & Navigation */
header {
    width: 100%;
    padding: 0.65rem 1.75rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(11, 8, 22, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--card-border);
    transition: all 0.3s ease;
}

.navbar {
    max-width: 1260px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.25rem;
    position: relative;
}

.nav-brand-group {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.logo {
    font-size: 1.35rem;
    font-weight: 700;
    background: linear-gradient(90deg, #A78BFA 0%, #EC4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.mobile-menu-toggle {
    display: none;
}

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

.nav-links {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-right {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-item {
    position: relative;
    list-style: none;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.92rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    background: transparent;
    border: none;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
}

.nav-link:hover, 
.nav-link.active,
.nav-dropdown:hover > .nav-dropdown-toggle,
.nav-dropdown.open > .nav-dropdown-toggle {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.nav-link.active {
    color: #C4B5FD;
    background: rgba(124, 58, 237, 0.14);
}

.nav-icon {
    width: 17px;
    height: 17px;
    opacity: 0.75;
    transition: transform 0.2s ease, opacity 0.2s ease;
    flex-shrink: 0;
}

.nav-link:hover .nav-icon,
.nav-link.active .nav-icon {
    opacity: 1;
}

.chevron-down {
    width: 14px;
    height: 14px;
    opacity: 0.6;
    transition: transform 0.25s ease, opacity 0.2s ease;
    flex-shrink: 0;
}

.nav-dropdown:hover > .nav-dropdown-toggle .chevron-down,
.nav-dropdown.open > .nav-dropdown-toggle .chevron-down {
    transform: rotate(180deg);
    opacity: 1;
}

/* ==========================================================================
   Desktop Dropdown Menus
   ========================================================================== */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 240px;
    background: rgba(14, 10, 26, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 0.5rem;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.65), 0 0 1px rgba(255, 255, 255, 0.1);
    list-style: none;
    margin: 0;
    z-index: 1050;
    visibility: hidden;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.2s;
    pointer-events: none;
}

/* Hover bridge between toggle and dropdown */
.dropdown-menu::before {
    content: '';
    position: absolute;
    top: -12px;
    left: 0;
    right: 0;
    height: 14px;
}

.dropdown-menu.align-right {
    left: auto;
    right: 0;
    min-width: 220px;
}

/* Dropdown item styling */
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    transition: all 0.15s ease;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
}

.dropdown-item:hover {
    color: #FFFFFF;
    background: rgba(124, 58, 237, 0.18);
    transform: translateX(3px);
}

.dropdown-item.active {
    color: #A78BFA;
    background: rgba(124, 58, 237, 0.22);
    font-weight: 600;
}

.dropdown-item-danger:hover {
    color: #F87171 !important;
    background: rgba(239, 68, 68, 0.15) !important;
}

.item-emoji {
    font-size: 1.15rem;
    line-height: 1;
    flex-shrink: 0;
}

.title-text {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.88rem;
    white-space: nowrap;
}

.sub-text {
    font-size: 0.74rem;
    color: var(--text-muted);
    margin-top: 1px;
    white-space: nowrap;
}

.badge-tag {
    margin-left: auto;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 6px;
    background: rgba(124, 58, 237, 0.35);
    color: #C4B5FD;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.dropdown-divider {
    height: 1px;
    background: var(--card-border);
    margin: 0.4rem 0;
    list-style: none;
}

/* ==========================================================================
   Nested Submenu (Flyout)
   ========================================================================== */
.dropdown-submenu {
    position: relative;
    list-style: none;
}

.submenu-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.submenu-toggle:hover,
.dropdown-submenu:hover > .submenu-toggle,
.dropdown-submenu.open > .submenu-toggle {
    color: #FFFFFF;
    background: rgba(124, 58, 237, 0.18);
}

.submenu-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chevron-right {
    width: 14px;
    height: 14px;
    opacity: 0.6;
    flex-shrink: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.dropdown-submenu:hover > .submenu-toggle .chevron-right,
.dropdown-submenu.open > .submenu-toggle .chevron-right {
    opacity: 1;
    transform: translateX(2px);
}

.submenu-menu {
    position: absolute;
    top: -4px;
    left: calc(100% + 6px);
    min-width: 220px;
    background: rgba(14, 10, 26, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 0.5rem;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
    list-style: none;
    margin: 0;
    z-index: 1060;
    visibility: hidden;
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.2s;
    pointer-events: none;
}

/* Hover bridge for nested submenu */
.submenu-menu::before {
    content: '';
    position: absolute;
    top: 0;
    left: -12px;
    bottom: 0;
    width: 14px;
}

/* Desktop Hover Trigger (min-width: 881px) */
@media (min-width: 881px) {
    .nav-dropdown:hover > .dropdown-menu,
    .nav-dropdown.open > .dropdown-menu {
        visibility: visible;
        opacity: 1;
        transform: translateY(0);
        pointer-events: auto;
    }

    .dropdown-submenu:hover > .submenu-menu,
    .dropdown-submenu.open > .submenu-menu {
        visibility: visible;
        opacity: 1;
        transform: translateX(0);
        pointer-events: auto;
    }
}

/* ==========================================================================
   User Profile Pill
   ========================================================================== */
.user-profile-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--card-border);
    padding: 0.35rem 0.75rem 0.35rem 0.4rem;
    border-radius: 30px;
    color: var(--text-primary);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.user-profile-btn:hover,
.nav-dropdown:hover > .user-profile-btn,
.nav-dropdown.open > .user-profile-btn {
    background: rgba(124, 58, 237, 0.15);
    border-color: rgba(124, 58, 237, 0.4);
    box-shadow: 0 0 16px rgba(124, 58, 237, 0.2);
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7C3AED, #EC4899);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: #FFFFFF;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    flex-shrink: 0;
}

.user-avatar.large {
    width: 38px;
    height: 38px;
    font-size: 1rem;
}

.username-label {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-user-header {
    padding: 0.6rem 0.8rem;
    list-style: none;
}

.user-info-detail {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-name-full {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.user-status-text {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Main Container */
main {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem;
}

/* Typography & Localization */
.rtl {
    direction: rtl;
    font-family: var(--font-fa);
}

.ltr {
    direction: ltr;
    font-family: var(--font-en);
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    letter-spacing: -0.5px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: #FFF;
    box-shadow: 0 0 20px var(--primary-glow);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(124, 58, 237, 0.5);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-primary);
    border: 1px solid var(--card-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
}

.btn-accent {
    background: var(--accent);
    color: #0F0C1B;
    box-shadow: 0 0 20px var(--accent-glow);
}

.btn-accent:hover {
    background: #E08E0B;
    transform: translateY(-2px);
}

/* Dashboard Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.metric-card {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 120px;
}

.metric-card h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-card .value {
    font-size: 2.2rem;
    font-weight: 700;
    margin: 0.5rem 0;
    background: linear-gradient(90deg, #FFFFFF, #9CA3AF);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.progress-bar-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #EC4899);
    border-radius: 3px;
}

/* Category Grid */
.section-title {
    margin-bottom: 1.5rem;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.category-card {
    padding: 1.5rem;
    cursor: pointer;
    border: 1px solid var(--card-border);
}

.category-card:hover {
    border-color: var(--card-hover-border);
    box-shadow: 0 8px 30px var(--primary-glow);
    transform: translateY(-4px);
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.category-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-word {
    background: rgba(124, 58, 237, 0.15);
    color: #A78BFA;
    border: 1px solid rgba(124, 58, 237, 0.3);
}

.badge-sentence {
    background: rgba(245, 158, 11, 0.15);
    color: #FBBF24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.category-info {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
}

/* Flashcard Styles */
.study-container {
    max-width: 600px;
    margin: 2rem auto;
    perspective: 1000px; /* Crucial for 3D flip */
}

.flashcard {
    width: 100%;
    min-height: 380px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.flashcard.flipped {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2.5rem;
    border-radius: 24px;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.card-front {
    background: linear-gradient(135deg, rgba(20, 16, 38, 0.95) 0%, rgba(10, 8, 20, 0.98) 100%);
    border: 1px solid var(--card-border);
    transform: rotateY(0deg);
}

.card-back {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.15) 0%, rgba(12, 10, 20, 0.98) 100%);
    border: 1px solid rgba(124, 58, 237, 0.25);
    transform: rotateY(180deg);
}

.card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    margin: 2rem 0;
}

.german-text {
    font-size: 2.4rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 1.5rem;
    color: #FFF;
}

.persian-text {
    font-size: 1.8rem;
    font-weight: 500;
    line-height: 1.5;
    color: #E5E7EB;
}

.audio-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
}

.btn-audio {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-audio:hover {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
    transform: scale(1.08);
}

.speed-badge {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
}

.card-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.btn-rate {
    padding: 0.75rem 0.5rem;
    font-size: 0.85rem;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    border: none;
    color: #FFF;
    transition: transform 0.2s;
    text-align: center;
}

.btn-rate:hover {
    transform: translateY(-2px);
}

.rate-again { background: var(--danger); }
.rate-hard { background: var(--warning); color: #0F0C1B; }
.rate-good { background: var(--info); }
.rate-easy { background: var(--success); }

/* Import Page & Forms */
.form-panel {
    max-width: 600px;
    margin: 2rem auto;
    padding: 2.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    font-family: var(--font-en);
    outline: none;
    transition: border-color 0.2s;
}

.form-control:focus {
    border-color: var(--primary);
}

.file-drop-area {
    border: 2px dashed var(--card-border);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s;
}

.file-drop-area:hover {
    border-color: var(--primary);
}

/* Tables & Lists */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: 16px;
    border: 1px solid var(--card-border);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th, .data-table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--card-border);
}

.data-table th {
    background: rgba(255, 255, 255, 0.02);
    font-weight: 600;
    color: var(--text-secondary);
}

.data-table tbody tr {
    transition: background-color 0.2s;
}

.data-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.01);
}

.status-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    display: inline-block;
}

.status-new { background: rgba(59, 130, 246, 0.15); color: #60A5FA; border: 1px solid rgba(59, 130, 246, 0.3); }
.status-due { background: rgba(239, 68, 68, 0.15); color: #F87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.status-learned { background: rgba(16, 185, 129, 0.15); color: #34D399; border: 1px solid rgba(16, 185, 129, 0.3); }

/* Messages / Alerts */
.messages {
    list-style: none;
    margin-bottom: 1.5rem;
}

.alert {
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 0.75rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: #34D399;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: #F87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Study Modes Cards */
.study-mode-card {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 1px solid var(--card-border);
    border-radius: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    min-height: 220px;
}

.study-mode-card.primary:hover {
    border-color: var(--primary);
    box-shadow: 0 8px 30px var(--primary-glow);
    transform: translateY(-4px);
}

.study-mode-card.accent:hover {
    border-color: var(--accent);
    box-shadow: 0 8px 30px var(--accent-glow);
    transform: translateY(-4px);
}

.study-mode-card.success:hover {
    border-color: var(--success);
    box-shadow: 0 8px 30px rgba(16, 185, 129, 0.25);
    transform: translateY(-4px);
}

.study-mode-card.info:hover {
    border-color: var(--info);
    box-shadow: 0 8px 30px rgba(59, 130, 246, 0.25);
    transform: translateY(-4px);
}

.study-mode-card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #FFF;
    margin-bottom: 0.5rem;
}

.study-mode-card p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.4;
    margin-bottom: 1.5rem;
}

.study-mode-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.study-mode-action {
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: transform 0.2s ease;
}

.study-mode-card:hover .study-mode-action {
    transform: translateX(4px);
}

/* Footer */
footer {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--card-border);
    margin-top: auto;
}

/* Responsive Breakpoints */
@media (max-width: 880px) {
    header {
        padding: 0.6rem 1.25rem;
    }
    
    .navbar {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }
    
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid var(--card-border);
        border-radius: 8px;
        color: var(--text-primary);
        cursor: pointer;
        padding: 0.5rem;
        transition: all 0.2s;
    }
    
    .mobile-menu-toggle:hover {
        color: var(--primary);
        border-color: rgba(124, 58, 237, 0.4);
        background: rgba(124, 58, 237, 0.1);
    }
    
    .nav-content {
        display: none;
        position: absolute;
        top: calc(100% + 1px);
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        background: rgba(11, 8, 22, 0.98);
        backdrop-filter: blur(24px);
        -webkit-backdrop-filter: blur(24px);
        border-bottom: 1px solid var(--card-border);
        padding: 1.25rem;
        z-index: 999;
        box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
        max-height: calc(100vh - 75px);
        overflow-y: auto;
    }
    
    .nav-content.open {
        display: flex;
    }
    
    .nav-links, .nav-right {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 0.35rem;
    }
    
    .nav-link {
        width: 100%;
        justify-content: space-between;
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
        background: rgba(255, 255, 255, 0.02);
        border-radius: 10px;
    }

    .nav-dropdown.open > .nav-dropdown-toggle {
        background: rgba(124, 58, 237, 0.15);
        color: #C4B5FD;
    }

    .nav-dropdown.open > .nav-dropdown-toggle .chevron-down {
        transform: rotate(180deg);
    }
    
    /* Mobile Accordion Dropdown Menus */
    .dropdown-menu, .submenu-menu {
        position: static !important;
        visibility: visible !important;
        opacity: 1 !important;
        transform: none !important;
        box-shadow: none !important;
        background: rgba(255, 255, 255, 0.02) !important;
        border: 1px solid rgba(255, 255, 255, 0.05) !important;
        border-radius: 10px !important;
        padding: 0.4rem !important;
        margin-top: 0.35rem !important;
        pointer-events: auto !important;
        min-width: 0 !important;
    }

    .dropdown-menu::before, .submenu-menu::before {
        display: none !important;
    }

    .dropdown-menu {
        display: none;
    }

    .nav-dropdown.open > .dropdown-menu {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
    }

    .dropdown-submenu {
        width: 100%;
    }

    .submenu-toggle {
        padding: 0.65rem 0.8rem;
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.02);
    }

    .dropdown-submenu.open > .submenu-toggle {
        background: rgba(124, 58, 237, 0.15);
        color: #C4B5FD;
    }

    .dropdown-submenu.open > .submenu-toggle .chevron-right {
        transform: rotate(90deg);
    }

    .submenu-menu {
        display: none;
        margin-left: 0.75rem;
        margin-top: 0.25rem !important;
        border-left: 2px solid rgba(124, 58, 237, 0.4) !important;
        border-radius: 0 10px 10px 0 !important;
    }

    .dropdown-submenu.open > .submenu-menu {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
    }

    .user-profile-btn {
        width: 100%;
        justify-content: space-between;
        padding: 0.65rem 1rem;
        border-radius: 10px;
        background: rgba(255, 255, 255, 0.03);
    }
    
    .nav-right .btn {
        justify-content: center;
        margin-top: 0.5rem;
    }
    
    main {
        padding: 1rem;
    }
    
    .german-text {
        font-size: 1.8rem;
    }
    
    .persian-text {
        font-size: 1.4rem;
    }
    
    .card-face {
        padding: 1.5rem;
    }
}

/* ==========================================================================
   New Study Page Custom Styles
   ========================================================================== */

/* Settings Screen Selection Cards */
.radio-card {
    display: block;
    cursor: pointer;
    position: relative;
}
.radio-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.radio-card-content {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--card-border);
    padding: 1rem 1.2rem;
    border-radius: 16px;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 4px;
    height: 100%;
}
.radio-card input[type="radio"]:checked + .radio-card-content {
    background: rgba(124, 58, 237, 0.08);
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(124, 58, 237, 0.15);
}
.radio-card:hover .radio-card-content {
    border-color: rgba(124, 58, 237, 0.4);
}
.radio-title {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.95rem;
}
.radio-desc {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* Spinner Animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Audio controls for sentences */
.btn-audio-sentence {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}
.btn-audio-sentence:hover {
    background: var(--primary);
    border-color: var(--primary);
}
.btn-audio-sentence.slow {
    color: var(--accent);
    border-color: rgba(245, 158, 11, 0.3);
}
.btn-audio-sentence.slow:hover {
    background: var(--accent);
    color: #0F0C1B;
    border-color: var(--accent);
}

/* Rate Buttons styling */
.btn-rate {
    position: relative;
}
.btn-rate.selected {
    box-shadow: 0 0 15px rgba(255,255,255,0.1) inset;
    border-color: #FFF !important;
}
.rate-again:hover, .rate-again.selected {
    background: rgba(239, 68, 68, 0.15);
    border-color: var(--danger);
    color: var(--danger);
}
.rate-hard:hover, .rate-hard.selected {
    background: rgba(245, 158, 11, 0.15);
    border-color: var(--accent);
    color: var(--accent);
}
.rate-good:hover, .rate-good.selected {
    background: rgba(16, 185, 129, 0.15);
    border-color: var(--success);
    color: var(--success);
}
.rate-easy:hover, .rate-easy.selected {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--info);
    color: var(--info);
}

.shortcut-badge {
    position: absolute;
    top: 4px;
    right: 6px;
    font-size: 0.65rem;
    color: var(--text-muted);
    border: 1px solid rgba(255,255,255,0.05);
    padding: 1px 4px;
    border-radius: 4px;
}

.keyboard-helper {
    font-family: var(--font-fa);
}

/* Toast Notification styling */
.toast-alert {
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translate(-50%, 20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* ==========================================================================
   Redesigned Study Mode 2 (learn2) Styles
   ========================================================================== */

.nav-floating-btn {
    position: fixed;
    top: 55%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #FFF;
    font-size: 2.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    user-select: none;
}

.nav-floating-btn:hover:not(:disabled) {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(124, 58, 237, 0.6);
    transform: translateY(-50%) scale(1.1);
}

.nav-floating-btn:disabled {
    opacity: 0.15;
    cursor: not-allowed;
}

.nav-floating-left {
    left: 24px;
}

.nav-floating-right {
    right: 24px;
}

@media (max-width: 900px) {
    .nav-floating-left {
        left: 8px;
    }
    .nav-floating-right {
        right: 8px;
    }
    .nav-floating-btn {
        width: 48px;
        height: 48px;
        font-size: 1.8rem;
    }
}

/* ==========================================================================
   AI Explanation Modal & Chat Full-Width Layout
   ========================================================================== */

.ai-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    pointer-events: auto;
}

.ai-modal-panel {
    width: 100%;
    max-width: 780px;
    height: 85vh;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--primary-glow);
    background: rgba(11, 8, 22, 0.98);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
    min-height: 0;
}

.ai-modal-body {
    position: relative;
    padding: 1.25rem 1.5rem;
    overflow-y: auto !important;
    overflow-x: hidden;
    flex: 1 1 0% !important;
    min-height: 0 !important;
    font-family: var(--font-fa);
    line-height: 1.8;
    color: var(--text-primary);
    font-size: 1rem;
    -webkit-overflow-scrolling: touch;
    direction: rtl;
}

/* Custom modern scrollbar for AI modal */
.ai-modal-body::-webkit-scrollbar {
    width: 6px;
}
.ai-modal-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}
.ai-modal-body::-webkit-scrollbar-thumb {
    background: rgba(124, 58, 237, 0.4);
    border-radius: 4px;
}
.ai-modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(124, 58, 237, 0.7);
}

.ai-message-item {
    width: 100%;
    display: flex;
    flex-direction: column;
}

.ai-user-bubble {
    width: 100%;
    background: rgba(124, 58, 237, 0.16);
    border: 1px solid rgba(124, 58, 237, 0.35);
    padding: 0.85rem 1.2rem;
    border-radius: 16px;
    color: #FFF;
    direction: rtl;
    text-align: right;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.08);
}

.ai-model-box {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 1.1rem 1.35rem;
    border-radius: 18px;
    color: #EEE;
    direction: rtl;
    text-align: right;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
}

.ai-markdown-content {
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.8;
    font-size: 0.98rem;
}

.ai-markdown-content p {
    margin-bottom: 0.85rem;
}

.ai-markdown-content p:last-child {
    margin-bottom: 0;
}

.ai-markdown-content ul, .ai-markdown-content ol {
    margin: 0.5rem 0 1rem 1.5rem;
    padding-right: 1rem;
}

.ai-markdown-content li {
    margin-bottom: 0.4rem;
}

.ai-markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.9rem;
}

.ai-markdown-content th, .ai-markdown-content td {
    padding: 0.6rem 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: right;
}

.ai-markdown-content th {
    background: rgba(255, 255, 255, 0.06);
    color: #FFF;
    font-weight: 700;
}

.ai-markdown-content code {
    background: rgba(0, 0, 0, 0.4);
    padding: 0.2rem 0.4rem;
    border-radius: 6px;
    font-family: var(--font-en);
    font-size: 0.9em;
    color: #38BDF8;
}

.ai-markdown-content pre {
    background: rgba(0, 0, 0, 0.4);
    padding: 0.8rem 1rem;
    border-radius: 10px;
    overflow-x: auto;
    direction: ltr;
    text-align: left;
    margin: 0.8rem 0;
}

.ai-markdown-content strong {
    color: #FFF;
    font-weight: 700;
}

@media (max-width: 640px) {
    .ai-modal-overlay {
        padding: 0.4rem;
    }
    .ai-modal-panel {
        height: 94vh;
        max-height: 94vh;
        border-radius: 18px;
    }
    .ai-modal-body {
        padding: 0.85rem 0.9rem;
    }
    .ai-model-box {
        padding: 0.85rem 0.95rem;
        border-radius: 14px;
    }
    .ai-user-bubble {
        padding: 0.75rem 0.85rem;
        border-radius: 12px;
    }
}

