/* --- Base & Print Optimization --- */
:root {
    --primary-color: #000;
    --secondary-color: #333;
    --text-color: #111;
    --white-bg: #ffffff;
    --border-color: #ccc;
    /* Base font size for better screen readability */
    --base-font-size: 16px; 
}

body {
    /* 1. Font Family: Times New Roman or similar academic serif font */
    font-family: 'Times New Roman', Times, serif; 
    
    /* 2. Text Color: Deep black (based on your previous request for #000) */
    color: #000; 
    
    /* 3. Font Size: Standard academic size for good readability */
    font-size: 12pt; /* This is fine, but will be overridden for screen view below */
    
    /* 4. Background Color: Clean white, as is typical for print/academic documents */
    background-color: #ffffff;
    
    /* 5. Margins/Padding: Standard margins to give the content a professional look */
    margin: 1in; /* This is too wide for mobile, will be fixed below */
    padding: 0;
    
    /* 6. Line Height: Slightly increased for better readability, similar to double-spacing in documents */
    line-height: 1.6;
}

/* Optional: Styling for mathematical elements to ensure they stand out like in the image */
.math-container {
    /* Uses the TeX/LaTeX font for math where possible, if embedded via MathJax/KaTeX */
    font-family: 'Computer Modern', 'Latin Modern', 'STIXGeneral', serif;
    font-size: 1.1em; /* Slightly larger than body text */
    line-height: 1.2;
}

/* FIX 1: Allow MathJax (LaTeX) content to scroll horizontally on small screens */
.mjx-container, .question-paper table {
    overflow-x: auto;
    max-width: 100%;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}
        
/* The main paper container is set up like a page */
.question-paper {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 60px; /* Base padding for screen view - TOO WIDE FOR MOBILE */
    background-color: var(--white-bg);
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); 
    min-height: 100vh;
}

/* Print Button Container (now the main Navigation Bar) */
.print-btn-container {
    /* FIX 2: Added Flex to help with stacking later */
    display: flex; 
    justify-content: flex-end; /* Align to the right */
    gap: 10px; /* Spacing between buttons */
    text-align: right;
    margin-bottom: 20px;
    padding-right: 60px; /* Aligns with content padding - TOO WIDE FOR MOBILE */
}

/* Styling for BOTH the Print and Navigation Buttons */
.nav-btn {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 15px;
    text-align: center;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    font-size: 14px;
    /* margin-left: 10px; REMOVED, gap handles spacing now */
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.3s;
}
        
.nav-btn:hover {
    background-color: #0056b3;
}
        
.nav-btn i {
    margin-right: 8px;
}
/* Specific style for the navigation button to differentiate slightly */
.qbank-btn {
    background-color: #28a745; /* Green color for Question Bank */
}
.qbank-btn:hover {
    background-color: #1e7e34;
}


/* --- MOBILE RESPONSIVENESS --- */
@media (max-width: 768px) {
    /* Reset body and container margins/padding */
    body {
        margin: 0; /* Remove 1in margin */
        font-size: 16px; /* Use a larger, standard screen font size (12pt is too small) */
        line-height: 1.5;
    }

    /* Make the main content area occupy the full screen width */
    .question-paper {
        padding: 15px 10px; /* Reduce heavy padding for mobile view */
        box-shadow: none; /* Remove box-shadow for cleaner look */
        width: 100%;
    }

    /* Reset the small 'container' class padding if it's used elsewhere */
    .container {
        padding: 0 10px;
        width: 100%;
    }
    
    /* Stack the Navigation/Print buttons vertically */
    .print-btn-container {
        flex-direction: column; /* Stack vertically */
        align-items: center; /* Center them */
        padding: 10px; /* Add some overall padding */
        gap: 8px; /* Reduce gap slightly */
        /* Center the container itself and remove the right padding */
        text-align: center;
        padding-right: 0;
    }

    /* Make the buttons take up the full available width */
    .nav-btn {
        width: 100%;
        margin: 0; /* Remove horizontal margin */
        justify-content: center; /* Center text and icon in the button */
    }

    /* Reduce list indentations for better space usage */
    ol.mcq-list, ol[start] {
        padding-left: 15px;
    }
    ol.option-list {
        padding-left: 15px;
    }

    /* Ensure mathematical content fits and allows scrolling */
    .mjx-container, .question-paper table {
        display: block; /* Important for scroll */
        max-width: 100%;
        overflow-x: auto; /* Allows horizontal scrolling for wide equations/tables */
        -webkit-overflow-scrolling: touch; /* Better scrolling on iOS */
    }

    /* Reduce header font sizes slightly if needed */
    .paper-header h1 {
        font-size: 1.3em;
    }
}


/* --- Print Styles: A4, 12pt Font, Margins, and 2-Column Options --- */
@media print {
    /* General Print Settings */
    @page {
        size: A4;
        margin: 1.5cm; /* Standard print margin */
    }
    body {
        background-color: var(--white-bg);
        padding: 0;
        /* KEEPING 12pt (standard academic print size) for paper */
        font-size: 12pt; 
        line-height: 1.4;
    }
    .question-paper {
        box-shadow: none;
        margin: 0;
        padding: 0; 
        min-height: auto;
    }
    /* HIDE BUTTONS AND NAVIGATION ON PRINT */
    .print-btn-container, .header, .nav {
        display: none !important; 
    }
    .paper-header {
        border-bottom: 2px solid #000; 
        margin-bottom: 20px;
    }
    .section-header {
        border-bottom: 1px solid #000;
        margin-top: 25px;
    }
    hr {
        display: none; /* Hide horizontal rules */
    }

    /* MCQ Options in 2 Columns for efficiency */
    ol.option-list {
        display: flex;
        flex-wrap: wrap;
        margin-top: 5px;
    }
    ol.option-list li {
        flex: 0 0 50%; /* Each option takes 50% width */
        max-width: 50%;
        box-sizing: border-box;
        padding-right: 15px; /* Spacing between columns */
    }

    /* Single column for A/R options where text is long */
    li:nth-last-child(-n+2) ol.option-list li, /* Last 2 Qs are A/R */
    li:nth-last-child(-n+1) ol.option-list li {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    /* Print style for the table in Q29(a) */
    .tabular-data {
        width: 100%;
        border-collapse: collapse;
        margin: 10px 0;
    }
    .tabular-data th, .tabular-data td {
        border: 1px solid #000;
        padding: 8px;
        text-align: center;
    }
    .tabular-data th {
        background-color: #eee;
    }
}


/* --- Component Styling (Ensuring Poppins for Headers, Lora for body text) --- */
.header { display: none; } /* Hide navigation bar for a question paper look */

.paper-header {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}
        
.paper-header h1 {
    font-family: 'Poppins', sans-serif; /* Poppins for strong header text */
    font-size: 1.6em; 
    margin-bottom: 5px;
    color: var(--primary-color);
    font-weight: 700;
}
        
.paper-header p {
    margin: 2px 0;
    font-size: 0.8em;
    color: var(--secondary-color);
}

.section-header {
    font-family: 'Poppins', sans-serif; /* Poppins for section headings */
    margin-top: 25px;
    margin-bottom: 10px;
    font-size: 1.2em;
    font-weight: 600;
    color: var(--primary-color);
    padding: 4px 0;
    border-bottom: 1px solid var(--primary-color);
    text-transform: uppercase;
}

.section-header span {
    font-size: 0.7em;
    font-weight: 400;
    color: var(--secondary-color);
    margin-left: 10px;
}
        
.question-paper > p {
    margin-bottom: 10px;
    font-style: italic;
    color: #555;
    /* Adjusted relative size to look good with the larger base font */
    font-size: 0.9em; 
}

/* Question lists maintain the Lora (serif) font set in the body */
ol.mcq-list, ol[start] {
    padding-left: 30px; 
    list-style-position: outside; 
    list-style-type: decimal;
}
        
ol.mcq-list > li, ol[start] > li {
    margin-bottom: 20px; 
    padding: 0; 
    /* Ensuring question text is full size (1em is 16px on screen) */
    font-size: 1em; 
    line-height: 1.6;
}
        
ol.option-list {
    list-style-type: lower-alpha;
    margin-top: 10px;
    padding-left: 20px; 
    line-height: 1.6;
}

ol.option-list li {
    margin-bottom: 3px;
    font-family: 'Lora', serif; 
    /* Ensuring options are also full size (1em is 16px on screen) */
    font-size: 1em; 
}
        
.assertion-reason {
    margin: 8px 0;
    padding: 8px;
    border: 1px solid var(--border-color);
    background-color: #fafafa;
    border-radius: 4px;
    font-weight: 400;
}

.case-study-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 1.1em;
    color: var(--primary-color);
    padding-bottom: 3px;
    border-bottom: 1px dashed var(--border-color);
}

.or-separator {
    font-family: 'Lora', serif;
    margin: 15px 0; 
    font-size: 0.8em; /* Slightly adjusted size */
    color: #555;
}

.or-separator::before { left: 10%; } 
.or-separator::after { right: 10%; }
        
.latex-equation { 
    margin: 10px 0; 
    padding: 8px;
    /* Ensuring LaTeX equations are clear */
    font-size: 1em; 
}

/* Specific styles for the table */
.tabular-data {
    width: 70%; /* Desktop width */
    border-collapse: collapse;
    margin: 10px auto;
}
.tabular-data th, .tabular-data td {
    border: 1px solid var(--border-color);
    padding: 8px;
    text-align: center;
}
.tabular-data th {
    font-family: 'Poppins', sans-serif;
    background-color: #f8f8f8;
}
.tabular-data td {
    font-family: 'Lora', serif;
}