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

:root {
    /* Base variables - can be overridden per page */
    --primary: #2c3e50;
    --secondary: #3498db;
    --accent: #e74c3c;
    --light: #f8f9fa;
    --dark: #212529;
    --success: #28a745;
    --warning: #ffc107;
    --gray: #6c757d;
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --transition: all 0.3s ease;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--dark);
    background: linear-gradient(135deg, #f5f7fa 0%, #e4edf9 100%);
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Header Styles */
header {
    text-align: center;
    padding: 30px 0;
    background: linear-gradient(120deg, #1a3a6c, #2c5282);
    color: white;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
    border: 2px solid #fff;
}

header::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 70%);
    transform: rotate(30deg);
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 12px;
    position: relative;
    text-shadow: 0 2px 5px rgba(0,0,0,0.2);
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 1.4rem;
    opacity: 0.95;
    position: relative;
    font-weight: 300;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 15px;
}

.author-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
    padding: 6px 18px;
    border-radius: 30px;
    margin-top: 15px;
    font-size: 1.1rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Navigation Styles */
.navbar {
    background: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-radius: 0 0 12px 12px;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    height: 60px;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--secondary);
    cursor: pointer;
}

.nav-menu {
    display: flex;
    width: 100%;
    justify-content: center;
    gap: 15px;
}

.nav-link, .social-link {
    text-decoration: none;
    color: var(--primary);
    font-weight: 600;
    padding: 8px 15px;
    border-radius: 8px;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.nav-link:hover, .social-link:hover {
    background: rgba(52, 152, 219, 0.1);
    color: var(--secondary);
}

.social-link {
    background: linear-gradient(120deg, #e74c3c, #c0392b);
    color: white;
    margin-left: auto;
}

.social-link i {
    font-size: 1.1rem;
}

.social-banner {
    display: inline-block;
    background: linear-gradient(120deg, #e74c3c, #c0392b);
    color: white;
    padding: 10px 20px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: bold;
    margin: 15px 0;
    box-shadow: 0 4px 10px rgba(231, 76, 60, 0.3);
    transition: var(--transition);
}

.social-banner:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 15px rgba(231, 76, 60, 0.4);
}

.social-banner i {
    margin-right: 8px;
}

/* Content Section Styles */
.part {
    background: white;
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 35px;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.part:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.part::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 6px;
    height: 100%;
    background: var(--secondary);
}

.part-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--secondary);
    margin-bottom: 25px;
    position: relative;
}

.part-title {
    font-size: 1.9rem;
    color: var(--primary);
    font-weight: 700;
}

.part-marks {
    background: var(--accent);
    color: white;
    padding: 7px 18px;
    border-radius: 25px;
    font-weight: bold;
    font-size: 1.2rem;
    box-shadow: 0 3px 10px rgba(231, 76, 60, 0.3);
}

.question {
    margin-bottom: 30px;
    padding-bottom: 25px;
    border-bottom: 1px dashed #e0e6ef;
    position: relative;
}

.question:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.question-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--secondary);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-weight: bold;
    margin-right: 15px;
    font-size: 1.1rem;
    flex-shrink: 0;
    box-shadow: 0 3px 8px rgba(52, 152, 219, 0.4);
    transition: var(--transition);
}

.question-text {
    font-weight: 700;
    font-size: 1.35rem;
    color: var(--primary);
    margin-bottom: 18px;
    line-height: 1.5;
    padding-right: 20px;
}

.answer {
    padding-left: 52px;
    font-size: 1.1rem;
    color: #444;
}

/* Special Content Elements */
.key-point {
    background: linear-gradient(120deg, #e3f2fd 0%, #bbdefb 100%);
    padding: 3px 8px;
    border-radius: 5px;
    font-weight: 700;
    position: relative;
    box-shadow: 0 2px 4px rgba(0,0,0,0.03);
    color: var(--primary);
    margin: 0 2px;
}

.key-point::after {
    content: "";
    position: absolute;
    bottom: 1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--secondary);
    border-radius: 1px;
}

ul {
    padding-left: 30px;
    margin: 18px 0;
}

li {
    margin-bottom: 10px;
    position: relative;
    padding-left: 10px;
    line-height: 1.7;
}

li::before {
    content: "•";
    position: absolute;
    left: -18px;
    color: var(--secondary);
    font-weight: bold;
    font-size: 1.4rem;
    top: -3px;
}

.illustration {
    background: #e8f4ff;
    border-left: 4px solid var(--secondary);
    padding: 18px 20px;
    margin: 20px 0;
    border-radius: 0 10px 10px 0;
    font-style: italic;
    position: relative;
}

.illustration::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20"><path fill="%23bbdefb" d="M10 3L5 7l5 4 5-4-5-4zm0 12l-5-4 5-4 5 4-5 4z"/></svg>') repeat;
    opacity: 0.2;
}

.concept-box {
    background: #f8fbff;
    border: 1px solid #d0e3f1;
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
    position: relative;
    transition: var(--transition);
}

.concept-box:hover {
    transform: translateX(5px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.1);
    border-color: var(--secondary);
}

.concept-box::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--secondary);
    border-radius: 4px 0 0 4px;
}

.concept-title {
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    font-size: 1.25rem;
}

.concept-title i {
    color: var(--secondary);
    margin-right: 10px;
    font-size: 1.4rem;
}

.order-example {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin: 20px 0;
    justify-content: center;
}

.order-card {
    flex: 1;
    min-width: 220px;
    background: white;
    border: 1px solid #e0e6ef;
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    text-align: center;
}

.order-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.1);
    border-color: var(--secondary);
}

.order-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--secondary);
}

.order-name {
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 8px;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.order-name i {
    color: var(--secondary);
    margin-right: 8px;
    font-size: 1.3rem;
}

.order-example-text {
    color: var(--gray);
    line-height: 1.6;
}

/* Special Elements for English Grammar */
.phonetics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.phonetic-card {
    background: white;
    border: 1px solid #e0e6ed;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
}

.phonetic-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.12);
    border-color: var(--secondary);
}

.symbol {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--primary);
    text-align: center;
    margin-bottom: 8px;
    font-family: 'Lucida Sans', 'DejaVu Sans', sans-serif;
}

.examples {
    color: var(--gray);
    font-style: italic;
    font-size: 0.95rem;
}

.pronunciation-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    box-shadow: 0 3px 8px rgba(0,0,0,0.1);
    border-radius: 10px;
    overflow: hidden;
}

.pronunciation-table th {
    background: linear-gradient(120deg, var(--secondary), #2c5282);
    color: white;
    padding: 12px 15px;
    text-align: left;
}

.pronunciation-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e2e8f0;
}

.pronunciation-table tr:nth-child(even) {
    background-color: #f8fafc;
}

.pronunciation-table tr:hover {
    background-color: #ebf4ff;
}

.modifier-example {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 20px 0;
}

.modifier-card {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    border-left: 4px solid var(--secondary);
}

.modifier-type {
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.problem {
    color: var(--accent);
    font-style: italic;
    margin: 8px 0;
}

.correction {
    color: var(--success);
    font-weight: 600;
    margin-top: 5px;
}

.highlight-box {
    background: linear-gradient(120deg, #fff8e1 0%, #ffecb3 100%);
    border-left: 4px solid #ffc107;
    padding: 18px 20px;
    border-radius: 0 10px 10px 0;
    margin: 20px 0;
    position: relative;
}

.highlight-box::before {
    content: "!";
    position: absolute;
    left: -15px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    background: #ffc107;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.divider {
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--secondary), transparent);
    margin: 15px 0;
    border-radius: 3px;
}

/* Footer Styles */
footer {
    text-align: center;
    padding: 30px 20px;
    margin-top: 20px;
    color: var(--gray);
    font-size: 1.05rem;
    border-top: 1px solid #e0e6ef;
    background: white;
    border-radius: 12px;
    box-shadow: 0 -2px 15px rgba(0,0,0,0.05);
}

.contact-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed #ddd;
}

.contact-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--secondary);
    text-decoration: none;
    font-weight: 600;
    font-size: 1.15rem;
    margin-top: 8px;
    transition: var(--transition);
}

.contact-link:hover {
    color: var(--accent);
    transform: translateX(5px);
}

.contact-link i {
    font-size: 1.5rem;
}

.download-btn {
    display: inline-block;
    background: linear-gradient(120deg, var(--accent), #c0392b);
    color: white;
    padding: 12px 28px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    margin-top: 15px;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.4);
    transition: var(--transition);
    border: none;
    cursor: pointer;
}

.download-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.5);
}

.download-btn i {
    margin-right: 8px;
}

.timestamp {
    background: rgba(44, 62, 80, 0.08);
    display: inline-block;
    padding: 4px 15px;
    border-radius: 20px;
    font-weight: 500;
    margin-top: 8px;
    color: var(--primary);
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-toggle {
        display: block;
    }
    
    .nav-menu {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        align-items: center;
        padding: 20px 0;
        box-shadow: 0 10px 15px rgba(0,0,0,0.1);
        transform: translateY(-150%);
        transition: transform 0.3s ease;
        z-index: 999;
    }
    
    .nav-menu.active {
        transform: translateY(0);
    }
    
    .part-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .answer {
        padding-left: 20px;
    }
    
    .question-number {
        margin-bottom: 10px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1.1rem;
    }
    
    .order-example {
        flex-direction: column;
    }
    
    .part {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.7rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .question-text {
        font-size: 1.15rem;
    }
    
    .answer {
        font-size: 1rem;
    }
    
    .part-title {
        font-size: 1.6rem;
    }
    
    .nav-menu {
        padding: 30px 0;
    }
    
    .nav-link, .social-link {
        padding: 12px 20px;
        width: 90%;
        justify-content: center;
    }
}
/* Navigation Bar Styles */
.navbar {
    background: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-radius: 0 0 12px 12px;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    height: 60px;
    justify-content: space-between;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--secondary);
    cursor: pointer;
}

.nav-menu {
    display: flex;
    gap: 15px;
}

.nav-link, .page-link {
    text-decoration: none;
    color: var(--primary);
    font-weight: 600;
    padding: 8px 15px;
    border-radius: 8px;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.nav-link:hover, .page-link:hover {
    background: rgba(52, 152, 219, 0.1);
    color: var(--secondary);
}

.page-links {
    display: flex;
    gap: 10px;
}

.active-page {
    background: var(--secondary);
    color: white;
}

.social-link {
    background: linear-gradient(120deg, var(--accent), #c0392b);
    color: white;
    padding: 8px 15px;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-left: 15px;
}

.social-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(231, 76, 60, 0.3);
}

.social-link i {
    font-size: 1.1rem;
}

@media (max-width: 768px) {
    .nav-toggle {
        display: block;
    }
    
    .nav-menu {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        align-items: center;
        padding: 20px 0;
        box-shadow: 0 10px 15px rgba(0,0,0,0.1);
        transform: translateY(-150%);
        transition: transform 0.3s ease;
        z-index: 999;
    }
    
    .nav-menu.active {
        transform: translateY(0);
    }
    
    .page-links {
        flex-direction: column;
        width: 100%;
        align-items: center;
        gap: 10px;
    }
    
    .nav-link, .page-link, .social-link {
        width: 90%;
        justify-content: center;
        margin: 5px 0;
    }
}
/* Add these updates to the existing styles.css file */

/* Main container adjustments for mobile */
@media (max-width: 768px) {
    body {
        padding: 15px;
    }
    
    .part {
        padding: 25px 20px;
    }
    
    .answer {
        padding-left: 35px;
    }
    
    .subtitle {
        font-size: 1.2rem;
        padding: 0 5px;
    }
    
    h1 {
        font-size: 2.1rem;
    }
    
    .nav-container {
        padding: 0 10px;
    }
}

/* Extreme mobile optimization (small phones) */
@media (max-width: 480px) {
    body {
        padding: 10px;
        font-size: 1.05rem;
    }
    
    header {
        padding: 20px 10px;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 1.05rem;
    }
    
    .author-badge {
        font-size: 0.95rem;
        padding: 5px 12px;
        margin-top: 10px;
    }
    
    .part {
        padding: 22px 15px;
        margin-bottom: 25px;
    }
    
    .part-title {
        font-size: 1.7rem;
    }
    
    .part-marks {
        font-size: 1.1rem;
        padding: 6px 15px;
    }
    
    .question {
        margin-bottom: 22px;
        padding-bottom: 20px;
    }
    
    .question-number {
        width: 32px;
        height: 32px;
        font-size: 1rem;
        margin-right: 12px;
    }
    
    .question-text {
        font-size: 1.25rem;
        margin-bottom: 15px;
    }
    
    .answer {
        padding-left: 30px;
        font-size: 1.05rem;
        line-height: 1.7;
    }
    
    .concept-box {
        padding: 18px 15px;
        margin: 18px 0;
    }
    
    .concept-title {
        font-size: 1.15rem;
    }
    
    ul {
        padding-left: 25px;
        margin: 15px 0;
    }
    
    li {
        font-size: 1.05rem;
        line-height: 1.7;
    }
    
    .order-example {
        flex-direction: column;
        gap: 15px;
    }
    
    .order-card {
        min-width: 100%;
        padding: 18px 15px;
    }
    
    .order-name {
        font-size: 1.15rem;
    }
    
    .order-example-text {
        font-size: 1.05rem;
    }
    
    .phonetics-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 12px;
    }
    
    .phonetic-card {
        padding: 12px;
    }
    
    .symbol {
        font-size: 1.6rem;
    }
    
    .examples {
        font-size: 0.9rem;
    }
    
    footer {
        padding: 20px 15px;
        font-size: 1rem;
    }
    
    .contact-link {
        font-size: 1.05rem;
    }
    
    .contact-link i {
        font-size: 1.4rem;
    }
    
    .social-banner {
        font-size: 1.1rem;
        padding: 8px 15px;
    }
    
    .social-banner i {
        font-size: 1.3rem;
    }
}

/* Additional mobile-specific improvements */
@media (max-width: 360px) {
    body {
        font-size: 1.1rem;
    }
    
    h1 {
        font-size: 1.7rem;
    }
    
    .question-text {
        font-size: 1.2rem;
    }
    
    .answer {
        font-size: 1.1rem;
        padding-left: 25px;
    }
    
    .phonetics-grid {
        grid-template-columns: 1fr;
    }
    
    .nav-menu {
        padding: 15px 0;
    }
    
    .page-links {
        gap: 8px;
    }
    
    .page-link {
        font-size: 0.95rem;
        padding: 6px 10px;
    }
    
    .social-link {
        font-size: 0.95rem;
        margin-left: 8px;
        padding: 6px 10px;
    }
}

/* Download Button Style */
.download-btn {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 1rem;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(192, 57, 43, 0.4);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(192, 57, 43, 0.6);
}

.download-btn:active {
    transform: translateY(0);
}

/* IMPORTANT: Styles for the PDF generation */
/* This prevents elements from being cut in half across pages */
.question, .part, .concept-box, .code-block, .arch-wrapper {
    page-break-inside: avoid; 
}

/* Hide specific elements when generating PDF */
.pdf-hidden {
    display: none !important;
}


/* --- Styles for Answer Key Notification --- */
        .answer-key-alert {
            max-width: 720px;
            margin: 20px auto;
            background: linear-gradient(135deg, #e3f2fd, #bbdefb); /* Light Blue Gradient */
            border-left: 5px solid #1976d2; /* distinct blue accent */
            border-radius: 8px;
            padding: 20px;
            display: flex;
            align-items: center;
            gap: 15px;
            box-shadow: 0 4px 6px rgba(0,0,0,0.1);
        }

        .alert-icon {
            font-size: 2rem;
            color: #1976d2;
            padding: 0 10px;
        }

        .alert-content h3 {
            margin: 0 0 5px 0;
            color: #0d47a1;
            font-size: 1.2rem;
        }

        .alert-content p {
            margin: 5px 0;
            color: #333;
            font-size: 0.95rem;
        }

        .gdrive-btn {
            display: inline-block;
            margin-top: 10px;
            background-color: #1976d2; /* Google Blue */
            color: white;
            padding: 10px 20px;
            text-decoration: none;
            border-radius: 6px;
            font-weight: bold;
            transition: all 0.3s ease;
            box-shadow: 0 2px 4px rgba(0,0,0,0.2);
        }

        .gdrive-btn:hover {
            background-color: #1565c0;
            transform: translateY(-2px);
            box-shadow: 0 4px 8px rgba(0,0,0,0.2);
        }

        /* Mobile adjustment */
        @media (max-width: 600px) {
            .answer-key-alert {
                flex-direction: column;
                text-align: center;
                margin: 15px;
            }
        }