:root {
    --primary: #2c5282;
    --primary-light: #3182ce;
    --secondary: #1a365d;
    --success: #228B22;
    --warning: #CC6600;
    --danger: #CC0000;
    --attention: #dd7482;
    --purple: #7b1fa2;
    --purple-light: #9c27b0;
    --bg-light: #f7fafc;
    --bg-blue: #e8f4fd;
    --bg-green: #e8f5e9;
    --bg-yellow: #fff3cd;
    --bg-red: #ffebee;
    --bg-purple: #f3e5f5;
    --text: #333;
    --text-light: #666;
    --border: #e2e8f0;
    --sidebar-width: 280px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
   background: linear-gradient(135deg, #374151 0%, #000000 100%);
    min-height: 100vh;
    color: var(--text);
    line-height: 1.6;
}

/* ========================================
   SIDEBAR STYLES
   ======================================== */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    height: 100dvh;
    background: white;
    box-shadow: 4px 0 15px rgba(0,0,0,0.1);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
}

.sidebar-close {
    display: none;
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    transition: background 0.3s;
}

.sidebar-close:hover {
    background: rgba(255,255,255,0.3);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.nav-group {
    margin-bottom: 10px;
}

.nav-group-title {
    padding: 10px 20px 5px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
}

.nav-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 10px 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    text-align: left;
    font-size: 0.9rem;
    color: var(--text);
    transition: all 0.2s;
    gap: 12px;
}

.nav-item:hover {
    background: var(--bg-blue);
    color: var(--primary);
}

.nav-item.active {
    background: linear-gradient(90deg, var(--bg-blue) 0%, white 100%);
    color: var(--primary);
    border-left: 3px solid var(--primary);
    font-weight: 600;
}

.nav-icon {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.nav-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-footer {
    padding: 15px;
    border-top: 1px solid var(--border);
    background: var(--bg-light);
    flex-shrink: 0;
}

.sidebar-footer .language-flags {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.75rem;
}

.language-flags-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-light);
}

.language-flags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.lang-flag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: white;
    color: var(--secondary);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.lang-flag.active {
    border-color: var(--primary-light);
    background: var(--bg-blue);
}

.lang-flag:hover,
.lang-flag:focus-visible {
    border-color: var(--primary-light);
    background: #f0f7ff;
}

.lang-flag:active {
    transform: translateY(1px);
}

.lang-flag-emoji {
    font-size: 0.9rem;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s;
}

.sidebar-overlay.active {
    opacity: 1;
}

/* ========================================
   MAIN CONTENT WRAPPER
   ======================================== */

.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s;
}

.mobile-header {
    display: none;
    position: sticky;
    top: 0;
    background: white;
    padding: 12px 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 100;
    align-items: center;
    gap: 15px;
}

.hamburger {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 28px;
    height: 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
}

.hamburger span {
    display: block;
    width: 100%;
    height: 3px;
    background: var(--primary);
    border-radius: 2px;
    transition: all 0.3s;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

.mobile-title {
    font-size: 1.1rem;
    color: var(--secondary);
    font-weight: 600;
}

/* ========================================
   APP CONTAINER
   ======================================== */

.app-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 10px;
}

/* Header */
.header {
    background: white;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 15px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.header h1 {
    color: var(--secondary);
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.header .subtitle {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Content */
.content {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    min-height: 400px;
}

.section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-title {
    color: var(--primary);
    font-size: 1.4rem;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 3px solid var(--primary);
}

.subsection {
    margin: 20px 0;
}

.subsection-title {
    color: var(--secondary);
    font-size: 1.1rem;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.level-badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    background: var(--bg-light);
    border-radius: 10px;
    color: var(--text-light);
}

/* Rule Box */
.rule-box {
    background: linear-gradient(135deg, var(--bg-blue) 0%, #d0e8f7 100%);
    border-left: 4px solid var(--primary);
    padding: 12px 15px;
    border-radius: 0 10px 10px 0;
    margin: 15px 0;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.95rem;
    color: var(--secondary);
    overflow-x: auto;
}

/* Examples */
.example {
    display: flex;
    align-items: flex-start;
    padding: 10px 12px;
    margin: 8px 0;
    border-radius: 0;
    background: var(--bg-light);
    cursor: pointer;
    transition: all 0.3s;
    gap: 10px;
}

.example:hover {
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.example.preferred { border-left: 4px solid var(--primary); }
.example.correct { border-left: 4px solid var(--success); }
.example.rare { border-left: 4px solid var(--warning); }
.example.both { border-left: 4px solid var(--purple); }

.example-marker {
    font-weight: bold;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.example-marker.preferred { color: var(--primary); }
.example-marker.correct { color: var(--success); }
.example-marker.rare { color: var(--warning); }
.example-marker.both { color: var(--purple); }

.example-content {
    flex: 1;
}

.example-dutch {
    font-style: italic;
    color: var(--secondary);
    font-size: 1rem;
}

.example-translation {
    color: var(--text-light);
    font-size: 0.85rem;
    margin-top: 3px;
    display: none;
}

.example.revealed .example-translation {
    display: block;
}

.click-hint {
    font-size: 0.7rem;
    color: #999;
    margin-left: auto;
}

.example.revealed .click-hint {
    display: none;
}

/* Note Boxes */
.note-box {
    padding: 12px 15px;
    border-radius: 10px;
    margin: 15px 0;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.note-box.info { background: var(--bg-blue); }
.note-box.warning { background: var(--bg-yellow); }
.note-box.important { background: var(--bg-green); }
.note-box.danger { background: var(--bg-red); }
.note-box.purple { background: var(--bg-purple); }

.note-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.note-text {
    font-size: 0.9rem;
}

/* Verb List */
.verb-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0;
}

.verb-tag {
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: 500;
}

.verb-tag.optional {
    background: var(--bg-purple);
    color: var(--purple);
}

.verb-tag.required {
    background: var(--bg-red);
    color: var(--danger);
}

/* Summary Table */
.summary-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    font-size: 0.85rem;
}

.summary-table th {
    background: var(--primary);
    color: white;
    padding: 10px;
    text-align: left;
}

.summary-table td {
    padding: 10px;
    border-bottom: 1px solid var(--border);
}

.summary-table tr:nth-child(even) {
    background: var(--bg-light);
}

.summary-table code {
    font-family: 'Consolas', monospace;
    background: rgba(0,0,0,0.05);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
}

/* Quiz Section */
.quiz-container {
    margin: 20px 0;
}

.quiz-question {
    background: var(--bg-light);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
}

.quiz-question p {
    margin-bottom: 10px;
    font-weight: 500;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quiz-option {
    padding: 10px 15px;
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    background: white;
    width: 100%;
    text-align: left;
    font: inherit;
    color: inherit;
}

.quiz-option:hover {
    border-color: var(--primary-light);
    background: var(--bg-blue);
}

.quiz-option.correct {
    border-color: var(--success);
    background: var(--bg-green);
}

.quiz-option.incorrect {
    border-color: var(--danger);
    background: var(--bg-red);
}

.quiz-option.disabled,
.quiz-option:disabled {
    pointer-events: none;
}

.quiz-feedback {
    margin-top: 10px;
    padding: 10px;
    border-radius: 8px;
    display: none;
}

.quiz-feedback.show {
    display: block;
}

.quiz-feedback.correct {
    background: var(--bg-green);
    color: var(--success);
}

.quiz-feedback.incorrect {
    background: var(--bg-red);
    color: var(--danger);
}

.quiz-score {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--purple) 100%);
    color: white;
    border-radius: 10px;
    margin-top: 20px;
}

.quiz-score h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.reset-btn {
    margin-top: 15px;
    padding: 10px 25px;
    border: none;
    background: white;
    color: var(--primary);
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
}

.reset-btn:hover {
    transform: scale(1.05);
}

/* Comparison Block */
.comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin: 15px 0;
}

.comparison-card {
    padding: 15px;
    border-radius: 10px;
}

.comparison-card.good {
    background: var(--bg-green);
    border: 2px solid var(--success);
}

.comparison-card.bad {
    background: var(--bg-red);
    border: 2px solid var(--danger);
}

.comparison-card h4 {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    color: white;
    font-size: 0.85rem;
    opacity: 0.8;
}

/* Scroll to top button */
.scroll-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 1000;
    transition: all 0.3s;
}

.scroll-top.visible {
    display: flex;
}

.scroll-top:hover {
    transform: scale(1.1);
}

/* Progress bar */
.progress-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(255,255,255,0.3);
    z-index: 1001;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    width: 0%;
    transition: width 0.3s;
}

/* ========================================
   MOBILE STYLES
   ======================================== */

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar-close {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .sidebar-overlay {
        display: block;
        pointer-events: none;
    }
    
    .sidebar-overlay.active {
        pointer-events: auto;
    }
    
    .main-wrapper {
        margin-left: 0;
    }
    
    .mobile-header {
        display: flex;
    }
    
    .header {
        display: none;
    }
    
    .comparison {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .section-title {
        font-size: 1.2rem;
    }

    .rule-box {
        font-size: 0.85rem;
        padding: 10px;
    }

    .example {
        padding: 8px 10px;
    }
    
    .sidebar {
        width: 85%;
        max-width: 320px;
    }

    .sidebar-footer {
        padding-bottom: calc(15px + env(safe-area-inset-bottom, 0px));
    }
    
    .nav-item {
        padding: 12px 20px;
    }
}

/* Scrollbar styling for sidebar */
.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: var(--bg-light);
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}