@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

/* Reset and Global Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', 'Segoe UI', sans-serif;
    color: #2d3748;
    line-height: 1.6;
    background-color: #ffffff;
    font-size: 11pt;
}

/* Page Setup for Printing / PDF compilation */
@page {
    size: A4;
    margin: 2cm 2cm 2cm 2cm;
}

.page {
    page-break-after: always;
    position: relative;
    width: 100%;
}

.page:last-child {
    page-break-after: avoid;
}

/* Headings */
h1 {
    font-size: 28pt;
    font-weight: 700;
    color: #1a365d;
    margin-bottom: 20px;
    text-align: center;
    line-height: 1.2;
}

h2 {
    font-size: 20pt;
    font-weight: 600;
    color: #2b6cb0;
    margin-top: 30px;
    margin-bottom: 15px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 5px;
    page-break-after: avoid;
}

h3 {
    font-size: 14pt;
    font-weight: 600;
    color: #2d3748;
    margin-top: 20px;
    margin-bottom: 10px;
    page-break-after: avoid;
}

h4 {
    font-size: 12pt;
    font-weight: 600;
    color: #4a5568;
    margin-top: 15px;
    margin-bottom: 5px;
    page-break-after: avoid;
}

p {
    margin-bottom: 12px;
}

/* Cover Page Styling */
.cover-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 3cm 2cm;
    text-align: center;
    background: linear-gradient(135deg, #1a365d 0%, #2a4365 50%, #2b6cb0 100%);
    color: white;
}

.cover-title {
    font-size: 36pt;
    font-weight: 700;
    margin-top: 2cm;
    color: #ebf8ff;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.cover-subtitle {
    font-size: 18pt;
    font-weight: 300;
    margin-top: 0.5cm;
    color: #90cdf4;
}

.cover-malayalam {
    font-size: 22pt;
    font-weight: 500;
    margin-top: 1.5cm;
    line-height: 1.5;
    color: #ffffff;
}

.cover-footer {
    font-size: 12pt;
    color: #cbd5e0;
    margin-bottom: 1cm;
}

/* Table of Contents */
.toc-list {
    list-style-type: none;
    margin: 30px 0;
}

.toc-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 12px;
    font-size: 12pt;
}

.toc-name {
    font-weight: 500;
    color: #2d3748;
}

.toc-dots {
    flex-grow: 1;
    border-bottom: 1px dotted #cbd5e0;
    margin: 0 10px;
}

.toc-page {
    font-weight: 600;
    color: #4a5568;
}

/* Content layout blocks */
.chapter-header {
    background-color: #f7fafc;
    border-left: 8px solid #2b6cb0;
    padding: 20px;
    margin-bottom: 30px;
    border-radius: 0 8px 8px 0;
}

.chapter-number {
    font-size: 12pt;
    font-weight: 700;
    text-transform: uppercase;
    color: #4a5568;
    letter-spacing: 1.5px;
}

.chapter-title {
    font-size: 24pt;
    font-weight: 700;
    color: #1a365d;
    margin-top: 5px;
}

.objectives-box {
    background-color: #ebf8ff;
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 25px;
}

.objectives-title {
    font-weight: 700;
    color: #2b6cb0;
    margin-bottom: 8px;
    font-size: 11pt;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.objectives-list {
    padding-left: 20px;
}

/* Callout Boxes */
.callout {
    padding: 15px 20px;
    margin: 20px 0;
    border-radius: 6px;
    border-left-width: 5px;
    border-left-style: solid;
    page-break-inside: avoid;
}

.callout-info {
    background-color: #ebf8ff;
    border-left-color: #3182ce;
}

.callout-tip {
    background-color: #f0fff4;
    border-left-color: #38a169;
}

.callout-warning {
    background-color: #fffaf0;
    border-left-color: #dd6b20;
}

.callout-title {
    font-weight: 700;
    margin-bottom: 5px;
    color: #1a202c;
}

/* Gender Color-Coding */
.gender-der {
    color: #2b6cb0;
    font-weight: 700;
}
.gender-die {
    color: #b83280;
    font-weight: 700;
}
.gender-das {
    color: #2f855a;
    font-weight: 700;
}

.gender-badge-der {
    background-color: #ebf8ff;
    color: #2b6cb0;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.9em;
}
.gender-badge-die {
    background-color: #fff5f7;
    color: #b83280;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.9em;
}
.gender-badge-das {
    background-color: #f0fff4;
    color: #2f855a;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.9em;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    page-break-inside: avoid;
}

th, td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
}

th {
    background-color: #f7fafc;
    font-weight: 700;
    color: #4a5568;
    border-bottom: 2px solid #cbd5e0;
}

tr:nth-child(even) td {
    background-color: #fcfcfc;
}

.vocab-table th:nth-child(1), .vocab-table td:nth-child(1) { width: 18%; }
.vocab-table th:nth-child(2), .vocab-table td:nth-child(2) { width: 22%; }
.vocab-table th:nth-child(3), .vocab-table td:nth-child(3) { width: 22%; }
.vocab-table th:nth-child(4), .vocab-table td:nth-child(4) { width: 38%; }

/* Dialogue styling */
.conversation-container {
    background-color: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    page-break-inside: avoid;
}

.bubble {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
}

.bubble:last-child {
    margin-bottom: 0;
}

.speaker-label {
    font-weight: 700;
    font-size: 10pt;
    color: #4a5568;
    margin-bottom: 2px;
    text-transform: uppercase;
}

.bubble-german {
    background-color: #ebf8ff;
    padding: 10px 15px;
    border-radius: 8px 8px 8px 0;
    align-self: flex-start;
    color: #2b6cb0;
    font-weight: 600;
    font-size: 11.5pt;
    border-left: 3px solid #3182ce;
}

.speaker-b .bubble-german {
    background-color: #f0fff4;
    color: #2f855a;
    border-radius: 8px 8px 0 8px;
    align-self: flex-end;
    border-left: none;
    border-right: 3px solid #38a169;
}

.bubble-translation {
    font-size: 10.5pt;
    margin-top: 5px;
    color: #4a5568;
}

.bubble-pronunciation {
    font-size: 9.5pt;
    color: #718096;
    font-style: italic;
    margin-top: 2px;
}

/* Exercises */
.exercise-section {
    background-color: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    margin-top: 30px;
    page-break-inside: avoid;
}

.exercise-title {
    font-size: 14pt;
    font-weight: 700;
    color: #2b6cb0;
    margin-bottom: 15px;
    border-bottom: 2px solid #cbd5e0;
    padding-bottom: 5px;
}

.exercise-item {
    margin-bottom: 20px;
}

.exercise-question {
    font-weight: 600;
    margin-bottom: 8px;
}

.exercise-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-left: 20px;
}

.exercise-option {
    padding: 8px;
    background-color: white;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 10pt;
}

.exercise-answers {
    background-color: #edf2f7;
    border-radius: 6px;
    padding: 15px;
    margin-top: 20px;
}

.exercise-answers-title {
    font-weight: 700;
    color: #4a5568;
    margin-bottom: 8px;
}

/* Visual Aids / Diagrams */
.visual-diagram {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    margin: 20px 0;
    background-color: #fff;
    text-align: center;
    page-break-inside: avoid;
}

.diagram-title {
    font-weight: 700;
    color: #4a5568;
    margin-bottom: 10px;
    font-size: 10.5pt;
    text-transform: uppercase;
}

.diagram-box {
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    gap: 15px;
    margin: 15px 0;
}

.diagram-card {
    flex: 1;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    padding: 12px;
    background-color: #f7fafc;
}

.diagram-desc {
    font-size: 9.5pt;
    color: #718096;
    margin-top: 5px;
}

/* Pronunciation charts */
.pronunciation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
    margin: 20px 0;
}

.pronunciation-card {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 10px;
    text-align: center;
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.pronunciation-letter {
    font-size: 18pt;
    font-weight: 700;
    color: #2b6cb0;
}

.pronunciation-malayalam {
    font-size: 12pt;
    color: #2d3748;
    font-weight: 500;
    margin: 5px 0;
}

.pronunciation-word {
    font-size: 9pt;
    color: #718096;
}

/* Footer / Header styling for layout */
.footer-note {
    font-size: 9pt;
    color: #a0aec0;
    text-align: center;
    margin-top: 40px;
    border-top: 1px solid #edf2f7;
    padding-top: 10px;
}

/* ==========================================================================
   Interactive Screen CSS (SPA Layout & Interactive Exercises)
   ========================================================================== */
@media screen {
    body {
        background-color: #f7fafc;
        display: flex;
        font-size: 11pt;
    }

    #screen-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        background-color: #1a365d;
        color: #ebf8ff;
        overflow-y: auto;
        border-right: 1px solid #2b6cb0;
        z-index: 1000;
        display: flex;
        flex-direction: column;
    }

    .sidebar-title {
        padding: 20px;
        background-color: #1a202c;
        font-weight: 700;
        font-size: 13pt;
        color: #ffffff;
        border-bottom: 1px solid #2d3748;
        line-height: 1.3;
    }

    .sidebar-title small {
        font-weight: 400;
        color: #90cdf4;
        font-size: 9.5pt;
    }

    .sidebar-menu {
        list-style: none;
        padding: 10px 0;
        flex-grow: 1;
    }

    .sidebar-menu-item {
        padding: 12px 20px;
        cursor: pointer;
        font-size: 10pt;
        font-weight: 500;
        color: #cbd5e0;
        border-left: 4px solid transparent;
        transition: all 0.2s ease;
        border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    }

    .sidebar-menu-item:hover {
        background-color: #2a4365;
        color: #ffffff;
    }

    .sidebar-menu-item.active {
        background-color: #2b6cb0;
        color: #ffffff;
        border-left-color: #90cdf4;
    }

    #main-container {
        margin-left: 280px;
        padding: 40px;
        width: calc(100% - 280px);
        max-width: 1000px;
        background-color: #ffffff;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
        min-height: 100vh;
    }

    /* Page Visibility in SPA mode */
    .page {
        display: none !important;
    }

    .page.active-page {
        display: block !important;
        animation: fadeIn 0.3s ease-in-out;
    }

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

    /* MCQ Option Click Styles */
    .exercise-option {
        transition: all 0.2s ease;
    }
    
    .exercise-option:hover:not(.disabled) {
        background-color: #edf2f7;
        border-color: #cbd5e0;
    }

    .exercise-option.correct-option {
        background-color: #c6f6d5 !important;
        border-color: #38a169 !important;
        color: #22543d !important;
        font-weight: 600;
    }

    .exercise-option.incorrect-option {
        background-color: #fed7e2 !important;
        border-color: #e53e3e !important;
        color: #742a2a !important;
        font-weight: 600;
    }

    .exercise-option.disabled {
        opacity: 0.8;
        cursor: not-allowed;
    }

    /* Feedback Box styling */
    .feedback-box {
        margin-top: 12px;
        padding: 10px 15px;
        border-radius: 6px;
        font-size: 10pt;
        font-weight: 500;
        border-left: 4px solid;
    }

    .feedback-correct {
        background-color: #f0fff4;
        border-color: #38a169;
        color: #276749;
    }

    .feedback-incorrect {
        background-color: #fff5f5;
        border-color: #e53e3e;
        color: #9b2c2c;
    }

    /* Hide Answer Block on Screen */
    .hide-on-screen {
        display: none !important;
    }

    /* Fill-in-the-blank input styling */
    .interactive-input-blank {
        border: 2px solid #cbd5e0;
        border-radius: 4px;
        padding: 4px 8px;
        font-size: 10.5pt;
        width: 140px;
        outline: none;
        transition: border-color 0.2s;
        margin: 0 4px;
        color: #2d3748;
        font-weight: 600;
        text-align: center;
    }

    .interactive-input-blank:focus {
        border-color: #3182ce;
    }

    .interactive-input-blank.correct-blank {
        background-color: #c6f6d5 !important;
        border-color: #38a169 !important;
        color: #22543d !important;
    }

    .interactive-input-blank.incorrect-blank {
        background-color: #fed7e2 !important;
        border-color: #e53e3e !important;
        color: #742a2a !important;
        animation: shake 0.3s;
    }

    @keyframes shake {
        0%, 100% { transform: translateX(0); }
        25% { transform: translateX(-4px); }
        75% { transform: translateX(4px); }
    }

    .check-blank-btn {
        padding: 5px 10px;
        background-color: #3182ce;
        color: white;
        border: none;
        border-radius: 4px;
        cursor: pointer;
        font-size: 9.5pt;
        font-weight: 600;
        transition: background-color 0.2s;
    }

    .check-blank-btn:hover:not(:disabled) {
        background-color: #2b6cb0;
    }

    .check-blank-btn:disabled {
        background-color: #cbd5e0;
        color: #718096;
        cursor: not-allowed;
    }

    .reveal-answers-btn {
        margin: 20px 0;
        padding: 10px 18px;
        background-color: #4a5568;
        color: white;
        border: none;
        border-radius: 6px;
        cursor: pointer;
        font-weight: 600;
        font-size: 10pt;
        transition: background-color 0.2s;
    }

    .reveal-answers-btn:hover {
        background-color: #2d3748;
    }
}

/* ==========================================================================
   Mobile Responsive Navigation & Layout
   ========================================================================== */
#mobile-header {
    display: none;
}

@media screen and (max-width: 900px) {
    body {
        flex-direction: column;
    }

    #mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 56px;
        background-color: #1a365d;
        color: #ffffff;
        padding: 0 16px;
        z-index: 1100;
        box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    }

    #mobile-menu-toggle {
        background: transparent;
        border: none;
        color: #ffffff;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 8px;
        border-radius: 4px;
    }

    #mobile-menu-toggle:hover {
        background-color: rgba(255, 255, 255, 0.1);
    }

    .mobile-header-title {
        font-weight: 700;
        font-size: 11pt;
        letter-spacing: 0.5px;
    }

    #screen-sidebar {
        top: 56px;
        transform: translateX(-100%);
        transition: transform 0.25s ease-in-out;
        width: 280px;
        box-shadow: 4px 0 12px rgba(0,0,0,0.25);
    }

    #screen-sidebar.mobile-open {
        transform: translateX(0);
    }

    #main-container {
        margin-left: 0;
        margin-top: 56px;
        width: 100%;
        padding: 20px 16px;
        box-shadow: none;
    }

    .exercise-options {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Print Stylesheet Overrides
   ========================================================================== */
@media print {
    body {
        background-color: white !important;
        color: black !important;
        display: block !important;
    }

    .no-print, #screen-sidebar, #mobile-header, .reveal-answers-btn {
        display: none !important;
    }

    #main-container {
        margin-left: 0 !important;
        margin-top: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        box-shadow: none !important;
    }

    .page {
        display: block !important;
        page-break-after: always;
    }

    .hide-on-screen {
        display: block !important;
    }
}


