/* ===== CSS Variables ===== */
:root {
    --primary-color: #2563eb;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
}

/* ===== Base Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== Study Page Navigation ===== */
.study-nav {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

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

.back-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.nav-controls {
    display: flex;
    gap: 1rem;
}

.btn-primary, .btn-secondary {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-secondary {
    background: var(--bg-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

/* ===== Page Header ===== */
.page-header {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    padding: 2rem 0;
    border-bottom: 1px solid var(--border-color);
}

.breadcrumb {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.breadcrumb a {
    color: var(--primary-color);
    text-decoration: none;
}

.page-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 1.125rem;
    margin-bottom: 1rem;
}

.page-meta {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.badge {
    padding: 0.375rem 0.875rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

.badge-primary {
    background: #dbeafe;
    color: #1e40af;
}

.badge-secondary {
    background: #f1f5f9;
    color: #475569;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

/* ===== Keywords Box ===== */
.keywords-box {
    background: #fef3c7;
    border-left: 4px solid var(--warning-color);
    padding: 1rem;
    margin: 2rem 0;
    border-radius: 0 8px 8px 0;
    font-size: 0.9rem;
}

/* ===== Study Sections ===== */
.study-section {
    background: var(--card-bg);
    border-radius: 12px;
    margin: 1.5rem 0;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.section-header {
    width: 100%;
    padding: 1.25rem 1.5rem;
    background: var(--card-bg);
    border: none;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    transition: all 0.2s;
}

.section-header:hover {
    background: var(--bg-color);
}

.section-number {
    font-size: 1.5rem;
}

.toggle-icon {
    margin-left: auto;
    transition: transform 0.3s;
}

.section-header.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.section-content {
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.section-content.collapsed {
    max-height: 0;
}

.content-box {
    padding: 1.5rem;
}

/* ===== Lists ===== */
.simple-list, .bullet-list, .numbered-list {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.simple-list li, .bullet-list li {
    margin: 0.75rem 0;
    line-height: 1.7;
}

.bullet-list li {
    list-style: disc;
}

.numbered-list li {
    list-style: decimal;
    margin: 1rem 0;
}

/* ===== Prelims Box ===== */
.prelims-box {
    background: #eff6ff;
    border-radius: 8px;
    padding: 1.5rem;
}

.fact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.fact-item {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
}

.fact-label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.fact-value {
    display: block;
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.125rem;
}

.highlight-box {
    background: #fef3c7;
    border-left: 4px solid var(--warning-color);
    padding: 1rem;
    margin-top: 1rem;
    border-radius: 0 8px 8px 0;
}

/* ===== Mains Box ===== */
.mains-box {
    background: #f8fafc;
}

.mains-subsection {
    margin: 1.5rem 0;
    padding: 1.25rem;
    background: white;
    border-radius: 8px;
}

.mains-subsection h4 {
    color: var(--primary-color);
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

/* ===== Case Studies ===== */
.case-study {
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 8px;
    padding: 1.25rem;
    margin: 1rem 0;
}

.case-study h4 {
    color: #166534;
    margin-bottom: 0.75rem;
}

/* ===== MCQ Section ===== */
.mcq-box {
    background: #fefce8;
}

.mcq-item {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1rem 0;
}

.mcq-question {
    margin-bottom: 1rem;
    line-height: 1.7;
}

.mcq-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 1rem 0;
}

.mcq-options label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.mcq-options label:hover {
    background: var(--bg-color);
}

.mcq-answer {
    display: none;
    background: #f0fdf4;
    border-left: 4px solid var(--success-color);
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 0 8px 8px 0;
}

.mcq-answer.show {
    display: block;
}

.btn-show-answer {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    margin-top: 0.5rem;
}

.btn-show-answer:hover {
    background: #1d4ed8;
}

/* ===== Revision Box ===== */
.revision-box {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: 8px;
    padding: 1.5rem;
}

.revision-list {
    list-style: none;
    padding: 0;
}

.revision-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.revision-list li:last-child {
    border-bottom: none;
}

.mnemonic-box {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    font-family: 'Courier New', monospace;
}

.warning-list {
    list-style: none;
    padding: 0;
}

.warning-list li {
    padding: 0.5rem;
    background: #fee2e2;
    margin: 0.5rem 0;
    border-radius: 6px;
    color: #991b1b;
}

/* ===== Page Navigation ===== */
.page-navigation {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.nav-btn {
    flex: 1;
    min-width: 150px;
    padding: 1rem;
    text-align: center;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-success {
    background: var(--success-color);
    color: white;
    border-color: var(--success-color);
}

.btn-success:hover {
    background: #059669;
    color: white;
}

.btn-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== Footer ===== */
.page-footer {
    background: var(--bg-color);
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    text-align: center;
    margin-top: 3rem;
}

/* ===== Intro Box ===== */
.intro-box {
    background: #f0f9ff;
    border-left: 4px solid var(--primary-color);
    padding: 1.5rem;
    border-radius: 0 8px 8px 0;
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .page-header h1 {
        font-size: 1.5rem;
    }
    
    .section-header {
        font-size: 1rem;
        padding: 1rem;
    }
    
    .fact-grid {
        grid-template-columns: 1fr;
    }
    
    .page-navigation {
        flex-direction: column;
    }
}

/* ===== Print Styles ===== */
@media print {
    .study-nav, .page-navigation, .btn-show-answer {
        display: none !important;
    }
    
    .section-content {
        max-height: none !important;
    }
    
    .toggle-icon {
        display: none;
    }
    
    body {
        background: white;
    }
    
    .study-section {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
