/* ==========================================
   ENHANCED CONTENT PAGE STYLES
   Better spacing, alignment, and typography
   For lesson pages and resource content
   ========================================== */

/* ==========================================
   TYPOGRAPHY IMPROVEMENTS
   ========================================== */

/* Better heading hierarchy with proper spacing */
.resources-section h1,
.chapter-hero-title {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.resources-section h2,
.category-title {
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 700;
    line-height: 1.3;
    margin-top: 3rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.resources-section h3 {
    font-size: clamp(1.25rem, 3vw, 1.5rem);
    font-weight: 600;
    line-height: 1.4;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.resources-section h4 {
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.5;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

/* Better paragraph spacing and readability */
.resources-section p {
    font-size: 1rem;
    line-height: 1.75;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.resources-section p + p {
    margin-top: 1rem;
}

/* ==========================================
   CONTENT BOXES - IMPROVED SPACING
   ========================================== */

.grammar-box,
.rule,
.note,
.example,
.alert {
    padding: 2rem;
    margin-bottom: 2rem;
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
}

/* First heading in box should have no top margin */
.grammar-box > h2:first-child,
.grammar-box > h3:first-child,
.rule > h2:first-child,
.rule > h3:first-child {
    margin-top: 0;
}

/* Last element in box should have no bottom margin */
.grammar-box > *:last-child,
.rule > *:last-child,
.example > *:last-child {
    margin-bottom: 0;
}

/* Grammar box specific styling */
.grammar-box {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.03) 0%, rgba(147, 51, 234, 0.03) 100%);
    border-left: 4px solid var(--color-primary);
}

.grammar-box h2,
.grammar-box h3 {
    color: var(--color-primary);
}

/* Rule boxes */
.rule {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05) 0%, rgba(5, 150, 105, 0.05) 100%);
    border-left: 4px solid var(--color-success);
}

/* Example boxes with better spacing */
.example {
    padding: 1.5rem;
    margin: 1.5rem 0;
    background: #f8fafc;
    border-left: 4px solid var(--color-primary);
    border-radius: var(--radius-md);
    line-height: 1.8;
}

.example + .example {
    margin-top: 1rem;
}

/* Alert boxes */
.alert {
    padding: 1.5rem;
    margin: 1.5rem 0;
    border-radius: var(--radius-md);
}

.alert-success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(5, 150, 105, 0.1) 100%);
    border-left: 4px solid var(--color-success);
}

.alert-warning {
    background: #fff3cd;
    border-left: 4px solid #f59e0b;
    color: #92400e;
}

.alert-info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(37, 99, 235, 0.1) 100%);
    border-left: 4px solid #3b82f6;
}

/* ==========================================
   LISTS - BETTER SPACING
   ========================================== */

.resources-section ul,
.resources-section ol {
    margin: 1.5rem 0;
    padding-left: 2rem;
    line-height: 1.8;
}

.resources-section li {
    margin-bottom: 0.75rem;
    line-height: 1.75;
}

.resources-section li:last-child {
    margin-bottom: 0;
}

/* Nested lists */
.resources-section ul ul,
.resources-section ol ul,
.resources-section ul ol,
.resources-section ol ol {
    margin-top: 0.75rem;
    margin-bottom: 0.75rem;
}

/* ==========================================
   TABLES - BETTER SPACING
   ========================================== */

.table-wrapper {
    overflow-x: auto;
    margin: 2rem 0;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.prep-table,
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-primary);
}

.prep-table th,
table th {
    padding: 1rem 1.5rem;
    text-align: left;
    font-weight: 600;
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border-primary);
    color: var(--text-primary);
}

.prep-table td,
table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-primary);
    line-height: 1.6;
}

.prep-table tr:last-child td,
table tr:last-child td {
    border-bottom: none;
}

.prep-table tr:hover,
table tbody tr:hover {
    background: var(--bg-secondary);
}

/* ==========================================
   INLINE CODE AND EMPHASIS
   ========================================== */

strong {
    font-weight: 600;
    color: var(--text-primary);
}

code {
    padding: 0.2rem 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

/* ==========================================
   SECTION DIVIDERS
   ========================================== */

.divider {
    height: 1px;
    background: var(--border-primary);
    margin: 2rem 0;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 3rem 0 2rem 0;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-primary);
}

.category-icon {
    font-size: 2rem;
}

.category-title {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
}

/* ==========================================
   RESOURCE CARDS - BETTER SPACING
   ========================================== */

.resource-card {
    padding: 2rem;
    text-align: center;
    transition: all 0.2s ease;
}

.resource-card-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.resource-card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0.75rem 0;
    line-height: 1.4;
}

.resource-card p {
    margin: 0.5rem 0 0 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.resources-grid {
    gap: 1.5rem;
}

/* ==========================================
   HERO SECTIONS - BETTER SPACING
   ========================================== */

.chapter-hero {
    padding: 3rem 0;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
}

.chapter-hero-title {
    margin-bottom: 0.75rem;
}

.chapter-hero-meta {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-top: 1rem;
    line-height: 1.6;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.back-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* ==========================================
   HINDI TEXT IMPROVEMENTS
   ========================================== */

.hindi-text {
    font-family: 'Noto Sans Devanagari', sans-serif;
    line-height: 1.8;
}

/* ==========================================
   NESTED CONTENT BOXES
   ========================================== */

/* Inner boxes within grammar boxes */
.grammar-box > div[style*="background"],
.rule > div[style*="background"] {
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
}

/* First nested box */
.grammar-box > div[style*="background"]:first-of-type {
    margin-top: 1.5rem;
}

/* ==========================================
   SPACING UTILITIES
   ========================================== */

.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.mt-1 { margin-top: 0.5rem !important; }
.mb-1 { margin-bottom: 0.5rem !important; }
.mt-2 { margin-top: 1rem !important; }
.mb-2 { margin-bottom: 1rem !important; }
.mt-3 { margin-top: 1.5rem !important; }
.mb-3 { margin-bottom: 1.5rem !important; }
.mt-4 { margin-top: 2rem !important; }
.mb-4 { margin-bottom: 2rem !important; }

.p-0 { padding: 0 !important; }
.p-1 { padding: 0.5rem !important; }
.p-2 { padding: 1rem !important; }
.p-3 { padding: 1.5rem !important; }
.p-4 { padding: 2rem !important; }

/* ==========================================
   RESPONSIVE IMPROVEMENTS
   ========================================== */

@media (max-width: 768px) {
    .grammar-box,
    .rule,
    .example,
    .alert {
        padding: 1.5rem;
    }

    .resources-section h2 {
        margin-top: 2rem;
    }

    .category-header {
        margin: 2rem 0 1.5rem 0;
    }

    .prep-table th,
    .prep-table td,
    table th,
    table td {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
}

@media (max-width: 480px) {
    .grammar-box,
    .rule,
    .example,
    .alert {
        padding: 1rem;
    }

    .resources-section ul,
    .resources-section ol {
        padding-left: 1.5rem;
    }
}
