/**
 * NCERT ePDF Pages - Shared Stylesheet
 * Optimized CSS for ncert_epdf_home.php, ncert_epdf_class.php, ncert_epdf_subject.php
 * Author: SaralStudy Development Team
 * Version: 1.0
 */

/* CSS Variables for Consistency - Updated to match existing site colors */
:root {
    --primary-color: #07294d;
    --secondary-color: #0c8b51;
    --accent-color: #f77112;
    --white: #fff;
    --text-dark: #333;
    --text-light: #6c757d;
    --border-light: #e8ecef;
    --background-light: #f1f1f1;
    --shadow: 0 4px 20px rgba(0,0,0,0.1);
    --shadow-hover: 0 12px 40px rgba(0,0,0,0.15);
    --radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
    --gradient-primary: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    --gradient-light: linear-gradient(135deg, #f8f9fa, #e9ecef);
}

/* Reset and Base Styles */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
}

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

/* Hero Sections */
.epdf-hero,
.class-hero,
.subject-hero {
    background: var(--gradient-primary);
    color: var(--white);
    padding: clamp(40px, 8vw, 80px) 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.epdf-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="books" width="50" height="50" patternUnits="userSpaceOnUse"><rect width="50" height="50" fill="none"/><circle cx="25" cy="25" r="2" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23books)"/></svg>');
    opacity: 0.3;
}

.class-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><text y="50" font-size="40" fill="rgba(255,255,255,0.1)">12</text></svg>') center/200px;
    opacity: 0.3;
}

.subject-hero::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20vw;
    font-weight: 900;
    opacity: 0.1;
    z-index: 0;
}

.epdf-hero h1,
.class-hero h1,
.subject-hero h1 {
    font-size: clamp(1.8rem, 5vw, 3.5rem);
    font-weight: 700;
    margin: 0 0 20px 0;
    line-height: 1.1;
    position: relative;
    z-index: 1;
}

.epdf-hero p,
.class-hero p,
.subject-hero p {
    font-size: clamp(1rem, 2vw, 1.2rem);
    opacity: 0.9;
    max-width: 700px;
    margin: 0 auto 30px;
    position: relative;
    z-index: 1;
}

/* Statistics and Info Grids */
.stats-grid,
.class-info,
.book-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin: 30px 0;
    padding: 30px;
    background: var(--gradient-light);
    border-radius: var(--radius);
}

.stat-item,
.info-item {
    text-align: center;
}

.stat-number,
.info-number {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.stat-label,
.info-label {
    font-size: 0.9rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Card Grids */
.epdf-grid,
.subjects-grid,
.chapters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
    margin: 40px 0;
}

.chapters-grid {
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 25px;
}

/* Card Styles */
.epdf-card,
.subject-card,
.chapter-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 30px;
    transition: var(--transition);
    border: 1px solid var(--border-light);
    position: relative;
    overflow: hidden;
}

.chapter-card {
    padding: 25px;
}

.epdf-card::before,
.subject-card::before,
.chapter-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.epdf-card:hover,
.subject-card:hover,
.chapter-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-hover);
}

.chapter-card:hover {
    transform: translateY(-5px);
}

.epdf-card:hover::before,
.subject-card:hover::before,
.chapter-card:hover::before {
    transform: scaleX(1);
}

/* Card Headers */
.class-header,
.subject-header,
.chapter-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.class-icon,
.subject-icon {
    font-size: 2rem;
    margin-right: 15px;
}

.chapter-number {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    margin-right: 15px;
    flex-shrink: 0;
}

.class-info h3,
.subject-info h3,
.chapter-info h4 {
    margin: 0 0 5px 0;
    font-size: 1.2rem;
    color: var(--text-dark);
}

/* Badges and Tags */
.age-group,
.difficulty-badge {
    font-size: 0.8rem;
    color: var(--text-light);
    background: #f8f9fa;
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
}

.difficulty-easy {
    background: #d4edda;
    color: #155724;
}

.difficulty-medium {
    background: #fff3cd;
    color: #856404;
}

.difficulty-hard,
.difficulty-advanced {
    background: #f8d7da;
    color: #721c24;
}

.difficulty-intermediate {
    background: #cce5ff;
    color: #004085;
}

.difficulty-beginner {
    background: #e2f7e2;
    color: #0f5132;
}

/* Subject and Topic Tags */
.subject-tags,
.topic-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0;
}

.subject-tag,
.topic-tag {
    background: #e9ecef;
    color: var(--text-dark);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.topic-tag.more {
    background: var(--primary-color);
    color: var(--white);
}

/* Meta Information */
.class-meta,
.subject-meta,
.chapter-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 15px 0;
    font-size: 0.9rem;
    color: var(--text-light);
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.meta-label {
    font-weight: 600;
}

.book-count,
.languages {
    background: #f8f9fa;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
}

/* Lists and Descriptions */
.subjects-list,
.topics-list,
.topics-preview {
    margin: 15px 0;
}

.subjects-list h4,
.topics-list h4,
.topics-preview h5 {
    margin: 0 0 8px 0;
    font-size: 0.9rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.class-description,
.subject-description,
.chapter-description {
    color: var(--text-light);
    line-height: 1.5;
    margin: 10px 0;
}

/* Action Buttons */
.class-actions,
.subject-actions,
.chapter-actions {
    margin-top: 20px;
}

.btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    text-align: center;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.btn-outline-secondary {
    background: transparent;
    color: var(--text-light);
    border: 1px solid var(--border-light);
}

.btn-outline-secondary:hover {
    background: #f8f9fa;
    color: var(--text-dark);
}

.btn-block {
    display: block;
    width: 100%;
    margin-bottom: 10px;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1rem;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.8rem;
}

/* Download Section */
.full-book-download {
    margin: 30px 0;
}

.download-card {
    background: var(--white);
    border: 2px solid var(--primary-color);
    border-radius: var(--radius);
    padding: 30px;
    text-align: center;
}

.download-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.download-header h3 {
    margin: 0;
    color: var(--primary-color);
}

.book-size {
    background: #e9ecef;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-light);
}

.download-options {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Features Section */
.features-section,
.study-tips-section,
.study-guide-section {
    margin: 40px 0;
    padding: 30px;
    background: #f8f9fa;
    border-radius: var(--radius);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.feature-item {
    background: var(--white);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.feature-item h4 {
    margin: 0 0 10px 0;
    color: var(--primary-color);
}

/* Study Tips */
.tips-grid,
.study-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.tip-item,
.step-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.tip-number,
.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.tip-content h4,
.step-content h4 {
    margin: 0 0 8px 0;
    color: var(--text-dark);
}

.tip-content p,
.step-content p {
    margin: 0;
    color: var(--text-light);
    line-height: 1.5;
}

/* FAQ Section */
.faq-section {
    margin: 40px 0;
}

.faq-item {
    border: 1px solid var(--border-light);
    border-radius: 8px;
    margin-bottom: 10px;
    overflow: hidden;
}

.faq-question {
    width: 100%;
    background: var(--white);
    border: none;
    padding: 20px;
    text-align: left;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.faq-question:hover {
    background: #f8f9fa;
}

.faq-question.active {
    background: var(--primary-color);
    color: var(--white);
}

.faq-icon {
    transition: transform 0.3s ease;
    font-size: 0.8rem;
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: #f8f9fa;
}

.faq-answer.active {
    max-height: 200px;
}

.faq-answer p {
    padding: 20px;
    margin: 0;
    color: var(--text-light);
    line-height: 1.6;
}

/* PDF Viewer Styles */
.pdf-viewer-section {
    margin: 30px 0;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.pdf-viewer-header {
    background: var(--gradient-primary);
    color: var(--white);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.pdf-viewer-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
}

.pdf-viewer-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.pdf-control-btn {
    background: rgba(255,255,255,0.2);
    color: var(--white);
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

.pdf-control-btn:hover {
    background: rgba(255,255,255,0.3);
}

.pdf-viewer-container {
    position: relative;
    width: 100%;
    height: 600px;
    background: #f8f9fa;
}

.pdf-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.pdf-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--text-light);
}

.pdf-error {
    padding: 40px;
    text-align: center;
    color: var(--text-light);
}

.pdf-fallback-links {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

/* Enhanced Layout Fixes */
.main-content-wrapper {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.content-area {
    flex: 1;
    min-width: 0; /* Prevents flex item from overflowing */
}

.sidebar-area {
    flex: 0 0 300px;
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

/* Improved Sidebar Styles */
.enhanced-sidebar {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.sidebar-section {
    border-bottom: 1px solid var(--border-light);
}

.sidebar-section:last-child {
    border-bottom: none;
}

.sidebar-header {
    background: var(--gradient-light);
    padding: 15px 20px;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 1rem;
}

.sidebar-content {
    padding: 0;
}

.sidebar-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-list-item {
    border-bottom: 1px solid #f8f9fa;
}

.sidebar-list-item:last-child {
    border-bottom: none;
}

.sidebar-link {
    display: block;
    padding: 12px 20px;
    color: var(--text-dark);
    text-decoration: none;
    transition: var(--transition);
    position: relative;
}

.sidebar-link:hover {
    background: #f8f9fa;
    color: var(--primary-color);
    text-decoration: none;
    padding-left: 25px;
}

.sidebar-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary-color);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.sidebar-link:hover::before {
    transform: scaleY(1);
}

/* Enhanced Mobile Layout */
.mobile-layout-fix {
    display: none;
}

/* Responsive Design - Enhanced */
@media (max-width: 1024px) {
    .main-content-wrapper {
        flex-direction: column;
        gap: 20px;
    }
    
    .sidebar-area {
        flex: none;
        position: static;
        max-height: none;
        order: 2;
    }
    
    .content-area {
        order: 1;
    }
}

@media (max-width: 768px) {
    .epdf-hero,
    .class-hero,
    .subject-hero {
        padding: 30px 0;
    }
    
    .epdf-hero h1,
    .class-hero h1,
    .subject-hero h1 {
        font-size: clamp(1.5rem, 4vw, 2.5rem);
    }
    
    .epdf-grid,
    .subjects-grid,
    .chapters-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        margin: 30px 0;
    }
    
    .stats-grid,
    .class-info,
    .book-info {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        padding: 20px;
    }
    
    .features-grid,
    .tips-grid,
    .study-steps {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .download-options {
        flex-direction: column;
        gap: 10px;
    }
    
    .class-header,
    .subject-header,
    .chapter-header {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .class-icon,
    .subject-icon {
        margin-right: 0;
        margin-bottom: 10px;
    }
    
    .chapter-number {
        margin-right: 0;
        margin-bottom: 10px;
    }
    
    .pdf-viewer-header {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .pdf-viewer-container {
        height: 400px;
    }
    
    .pdf-fallback-links {
        flex-direction: column;
        align-items: center;
    }
    
    .mobile-layout-fix {
        display: block;
        background: #e3f2fd;
        padding: 15px;
        border-radius: 8px;
        margin: 20px 0;
        text-align: center;
        color: #1976d2;
        font-size: 0.9rem;
    }
    
    .container {
        padding: 0 10px;
    }
    
    /* Mobile-specific sidebar improvements */
    .sidebar-area {
        margin-top: 30px;
    }
    
    .sidebar-header {
        text-align: center;
        font-size: 1.1rem;
    }
    
    .sidebar-link {
        padding: 15px 20px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .stats-grid,
    .class-info,
    .book-info {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 15px;
    }
    
    .stat-number,
    .info-number {
        font-size: 1.8rem;
    }
    
    .class-meta,
    .subject-meta,
    .chapter-meta {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
    
    .subject-tags,
    .topic-tags {
        justify-content: center;
    }
    
    .epdf-card,
    .subject-card,
    .chapter-card {
        padding: 20px;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    .btn-block {
        width: 100%;
        text-align: center;
    }
    
    .pdf-viewer-container {
        height: 300px;
    }
    
    .pdf-control-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
}

/* Tablet specific adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
    .subjects-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .chapters-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stats-grid,
    .class-info,
    .book-info {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Large desktop optimizations */
@media (min-width: 1200px) {
    .container {
        max-width: 1400px;
    }
    
    
    .subjects-grid,
    .chapters-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .sidebar-area {
        flex: 0 0 350px;
    }
}

/* Blog Section Styles - Matching existing site design */
.blog-section {
    margin: 40px 0;
    padding: 30px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
}

.blog-section .section-header {
    text-align: center;
    margin-bottom: 30px;
}

.blog-section .section-header h2,
.blog-section .section-header h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 1.8rem;
    font-weight: 600;
}

.blog-section .section-header p {
    color: var(--text-light);
    font-size: 1rem;
    margin: 0;
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.blog-card {
    background: var(--background-light);
    border-radius: 8px;
    overflow: hidden;
    transition: var(--transition);
    border: 1px solid var(--border-light);
}

.blog-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.blog-image {
    height: 180px;
    overflow: hidden;
}

.blog-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.blog-card:hover .blog-image img {
    transform: scale(1.05);
}

.blog-content {
    padding: 20px;
}

.blog-content h3 {
    margin-bottom: 10px;
    font-size: 1.1rem;
    font-weight: 600;
}

.blog-content h3 a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.blog-content h3 a:hover {
    color: var(--secondary-color);
}

.blog-content p {
    color: var(--text-light);
    margin-bottom: 15px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.read-more {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.read-more:hover {
    color: var(--secondary-color);
    text-decoration: none;
}

.view-all-blogs {
    text-align: center;
}

.view-all-blogs .btn-outline-primary {
    display: inline-block;
    padding: 12px 30px;
    border: 2px solid var(--accent-color);
    color: var(--accent-color);
    text-decoration: none;
    border-radius: 25px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.view-all-blogs .btn-outline-primary:hover {
    background: var(--accent-color);
    color: var(--white);
    text-decoration: none;
}

/* Related Links Section - Matching existing site design */
.related-links-section {
    background: var(--background-light);
    padding: 40px 0;
    margin: 40px 0;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
}

.related-links-section .section-header {
    text-align: center;
    margin-bottom: 30px;
}

.related-links-section .section-title {
    color: var(--primary-color);
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.related-links-section .section-title i {
    color: var(--accent-color);
    margin-right: 10px;
}

.related-links-section .section-description {
    color: var(--text-light);
    font-size: 1rem;
    margin: 0;
}

.related-links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.related-link-card {
    background: var(--white);
    border-radius: 10px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    overflow: hidden;
    border: 1px solid var(--border-light);
}

.related-link-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.link-item {
    display: flex;
    align-items: center;
    padding: 20px;
    text-decoration: none;
    color: inherit;
}

.link-icon {
    background: #e3f2fd;
    color: var(--primary-color);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.link-content {
    flex-grow: 1;
}

.link-title {
    color: var(--primary-color);
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 5px 0;
}

.link-description {
    color: var(--text-light);
    font-size: 0.9rem;
    margin: 0;
    line-height: 1.4;
}

.link-arrow {
    color: var(--accent-color);
    font-size: 1rem;
    margin-left: 10px;
}

.quick-access-section {
    background: var(--white);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border: 1px solid var(--border-light);
}

.quick-access-section h4 {
    color: var(--primary-color);
    font-size: 1.2rem;
    margin-bottom: 15px;
}

.quick-access-section h4 i {
    color: var(--accent-color);
    margin-right: 8px;
}

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

.quick-link {
    background: var(--accent-color);
    color: var(--white);
    padding: 8px 16px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.quick-link:hover {
    background: var(--secondary-color);
    color: var(--white);
    text-decoration: none;
    transform: translateY(-2px);
}

/* Enhanced Sidebar Styles - Matching existing site design */
.blog-sidebar,
.right-sidebar {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid var(--border-light);
}

.blog-sidebar-post,
.blog-sidebar-category,
.blog-sidebar-tags {
    background: var(--background-light);
    margin-bottom: 20px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border-light);
}

.sidebar-title {
    background: var(--primary-color);
    color: var(--white);
    padding: 15px 20px;
    margin: 0;
}

.sidebar-title .title,
.sidebar-title h4 {
    color: var(--white);
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.category-items,
.post-items {
    padding: 0;
    margin: 0;
}

.category-items li,
.post-items li {
    border-bottom: 1px solid #e9ecef;
    list-style: none;
}

.category-items li:last-child,
.post-items li:last-child {
    border-bottom: none;
}

.category-items li a,
.post-items li a {
    display: block;
    padding: 12px 20px;
    color: var(--text-dark);
    text-decoration: none;
    transition: var(--transition);
    position: relative;
}

.category-items li a:hover,
.post-items li a:hover {
    background: #f8f9fa;
    color: var(--primary-color);
    text-decoration: none;
    padding-left: 25px;
}

.category-items li a::before,
.post-items li a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent-color);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.category-items li a:hover::before,
.post-items li a:hover::before {
    transform: scaleY(1);
}

/* Form Radio Styles - Matching existing site design */
.form-radio {
    margin: 8px 0;
}

.form-radio input[type="radio"] {
    display: none;
}

.form-radio input[type="radio"] + label {
    font-weight: 400;
    font-size: 14px;
    color: var(--text-dark);
    margin-bottom: 0;
    position: relative;
    padding-left: 25px;
    cursor: pointer;
    display: block;
    transition: var(--transition);
}

.form-radio input[type="radio"] + label:hover {
    color: var(--primary-color);
}

.form-radio input[type="radio"] + label span {
    width: 14px;
    height: 14px;
    border: 1px solid #707070;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 0;
    transition: all 0.3s linear;
}

.form-radio input[type="radio"] + label span::before {
    position: absolute;
    content: '';
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background-color: var(--primary-color);
    border-radius: 50%;
    transform: scale(0.7);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s linear;
}

.form-radio input[type="radio"]:checked + label span {
    border-color: var(--primary-color);
}

.form-radio input[type="radio"]:checked + label span::before {
    opacity: 1;
    visibility: visible;
}

/* Print Styles */
@media print {
    .epdf-hero,
    .class-hero,
    .subject-hero {
        background: none !important;
        color: var(--text-dark) !important;
    }
    
    .btn {
        display: none;
    }
    
    .faq-answer {
        max-height: none !important;
    }
    
    .blog-section,
    .related-links-section {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    :root {
        --shadow: 0 4px 20px rgba(0,0,0,0.3);
        --shadow-hover: 0 12px 40px rgba(0,0,0,0.4);
    }
    
    .epdf-card,
    .subject-card,
    .chapter-card {
        border: 2px solid var(--text-dark);
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Mobile Responsive Styles for Blog and Sidebar */
@media (max-width: 768px) {
    .blog-section {
        padding: 20px;
        margin: 30px 0;
    }
    
    .blog-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .blog-section .section-header h2,
    .blog-section .section-header h3 {
        font-size: 1.5rem;
    }
    
    .blog-card {
        margin-bottom: 20px;
    }
    
    .blog-content {
        padding: 15px;
    }
    
    .related-links-section {
        padding: 30px 15px;
        margin: 30px 0;
    }
    
    .related-links-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .link-item {
        padding: 15px;
    }
    
    .link-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .related-links-section .section-title {
        font-size: 1.5rem;
    }
    
    .quick-links {
        justify-content: center;
    }
    
    .blog-sidebar,
    .right-sidebar {
        margin-top: 30px;
    }
    
    .sidebar-title {
        text-align: center;
        font-size: 1.1rem;
    }
    
    .category-items li a,
    .post-items li a {
        padding: 15px 20px;
        font-size: 1rem;
    }
}

/* Additional Mobile-specific Enhancements */
@media (max-width: 768px) {
    /* Mobile Hero Enhancements */
    .mobile-hero {
        background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
        color: var(--white);
        padding: 30px 15px;
        text-align: center;
        position: relative;
        overflow: hidden;
    }
    
    .mobile-hero::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="books-mobile" width="30" height="30" patternUnits="userSpaceOnUse"><circle cx="15" cy="15" r="1" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23books-mobile)"/></svg>');
        opacity: 0.3;
    }
    
    /* Mobile Card Enhancements */
    .mobile-card {
        background: var(--white);
        border-radius: 8px;
        box-shadow: var(--shadow);
        padding: 20px;
        margin-bottom: 15px;
        border: 1px solid var(--border-light);
        transition: var(--transition);
    }
    
    .mobile-card:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-hover);
    }
    
    .mobile-card-icon {
        width: 40px;
        height: 40px;
        background: var(--gradient-primary);
        color: var(--white);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 700;
        margin-right: 15px;
        font-size: 0.8rem;
    }
    
    .mobile-btn {
        display: block;
        width: 100%;
        padding: 12px;
        background: var(--gradient-primary);
        color: var(--white);
        text-decoration: none;
        border-radius: 6px;
        text-align: center;
        font-weight: 600;
        margin-top: 15px;
        transition: var(--transition);
    }
    
    .mobile-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 15px rgba(7, 41, 77, 0.3);
        text-decoration: none;
        color: var(--white);
    }
    
    /* Mobile Chapter List */
    .mobile-chapter-number {
        width: 25px;
        height: 25px;
        background: var(--primary-color);
        color: var(--white);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.7rem;
        font-weight: 600;
        margin-right: 10px;
    }
    
    .mobile-download-icon {
        font-size: 1.2rem;
        color: var(--accent-color);
    }
    
    /* Mobile FAQ */
    .mobile-faq-question {
        color: var(--primary-color);
        cursor: pointer;
    }
    
    .faq-icon {
        color: var(--accent-color);
    }
    
    /* Mobile Quick Links */
    .mobile-quick-link {
        background: var(--background-light);
        color: var(--primary-color);
        transition: var(--transition);
    }
    
    .mobile-quick-link:hover {
        background: var(--primary-color);
        color: var(--white);
        text-decoration: none;
    }
}
