/*!
 * NCERT Solutions SEO Optimized Layout & Performance CSS
 * Advanced SEO optimizations, Core Web Vitals improvements, and enhanced UX
 * Version: 2.0.0
 * Author: SEO Optimization Team
 */

/* ==========================================================================
   1. CRITICAL CSS - ABOVE THE FOLD OPTIMIZATIONS
   ========================================================================== */

/* Critical rendering path optimization */
.blog-details-page {
    contain: layout style paint;
    will-change: auto;
}

/* Prevent layout shifts (CLS optimization) */
.blog-details-page .container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.blog-details-page .row {
    flex: 1;
    min-height: 600px;
}

/* Optimize largest contentful paint (LCP) */
.title-hd {
    font-display: swap;
    contain: layout style;
    transform: translateZ(0);
}

/* ==========================================================================
   2. SEO-OPTIMIZED STRUCTURED DATA LAYOUT
   ========================================================================== */

/* Enhanced semantic structure for better SEO */
.ncert-solutions-container {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    margin: 20px 0;
    overflow: hidden;
    position: relative;
}

.ncert-solutions-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #007bff 0%, #28a745 50%, #ffc107 100%);
    z-index: 1;
}

/* Breadcrumb schema optimization */
.seo-breadcrumb {
    background: #f8f9fa;
    padding: 12px 20px;
    border-bottom: 1px solid #e9ecef;
    font-size: 14px;
}

.seo-breadcrumb ol {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.seo-breadcrumb li {
    display: flex;
    align-items: center;
}

.seo-breadcrumb li:not(:last-child)::after {
    content: '›';
    margin: 0 8px;
    color: #6c757d;
    font-weight: bold;
}

.seo-breadcrumb a {
    color: #007bff;
    text-decoration: none;
    transition: color 0.3s ease;
}

.seo-breadcrumb a:hover {
    color: #0056b3;
    text-decoration: underline;
}

.seo-breadcrumb .current {
    color: #6c757d;
    font-weight: 500;
}

/* ==========================================================================
   3. ENHANCED CLASS CARDS WITH SEO OPTIMIZATION
   ========================================================================== */

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

.seo-class-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid #e8ecef;
    position: relative;
    contain: layout style paint;
}

.seo-class-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}

.seo-class-card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.seo-class-card-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    transform: rotate(45deg);
}

.seo-class-level {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.9;
    margin-bottom: 8px;
}

.seo-class-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
    position: relative;
    z-index: 1;
}

.seo-class-description {
    font-size: 14px;
    line-height: 1.5;
    margin: 10px 0 0 0;
    opacity: 0.95;
    position: relative;
    z-index: 1;
}

.seo-class-card-body {
    padding: 20px;
}

.seo-subjects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.seo-subject-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.seo-subject-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.5s ease;
}

.seo-subject-item:hover::before {
    left: 100%;
}

.seo-subject-item:hover {
    background: #e3f2fd;
    border-color: #2196f3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(33,150,243,0.2);
}

.seo-subject-link {
    color: #495057;
    text-decoration: none;
    font-weight: 500;
    font-size: 13px;
    display: block;
    position: relative;
    z-index: 1;
}

.seo-subject-item:hover .seo-subject-link {
    color: #1976d2;
}

/* ==========================================================================
   4. PERFORMANCE OPTIMIZED ANIMATIONS
   ========================================================================== */

/* GPU-accelerated animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 30px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translate3d(30px, 0, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

.seo-animate-fade-up {
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.seo-animate-slide-right {
    animation: slideInRight 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Staggered animation delays */
.seo-class-card:nth-child(1) { animation-delay: 0.1s; }
.seo-class-card:nth-child(2) { animation-delay: 0.2s; }
.seo-class-card:nth-child(3) { animation-delay: 0.3s; }
.seo-class-card:nth-child(4) { animation-delay: 0.4s; }

/* ==========================================================================
   5. ENHANCED SIDEBAR WITH SEO FEATURES
   ========================================================================== */

.seo-sidebar {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    overflow: hidden;
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 #f7fafc;
}

.seo-sidebar::-webkit-scrollbar {
    width: 6px;
}

.seo-sidebar::-webkit-scrollbar-track {
    background: #f7fafc;
}

.seo-sidebar::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.seo-sidebar::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

.seo-widget {
    border-bottom: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.seo-widget:last-child {
    border-bottom: none;
}

.seo-widget-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    font-weight: 600;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.seo-widget-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
    font-size: 12px;
}

.seo-widget-content {
    padding: 20px;
}

.seo-quick-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.seo-quick-links li {
    margin-bottom: 8px;
}

.seo-quick-links a {
    color: #495057;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.seo-quick-links a:hover {
    background: #e3f2fd;
    color: #1976d2;
    text-decoration: none;
    transform: translateX(4px);
}

.seo-quick-links a::before {
    content: '→';
    font-size: 12px;
    transition: transform 0.3s ease;
}

.seo-quick-links a:hover::before {
    transform: translateX(2px);
}

/* ==========================================================================
   6. CORE WEB VITALS OPTIMIZATIONS
   ========================================================================== */

/* Reduce Cumulative Layout Shift (CLS) */
.seo-image-placeholder {
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.seo-image-placeholder::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Optimize First Input Delay (FID) */
.seo-interactive-element {
    touch-action: manipulation;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* Optimize Largest Contentful Paint (LCP) */
.seo-hero-section {
    contain: layout style paint;
    will-change: auto;
    transform: translateZ(0);
}

/* ==========================================================================
   7. ACCESSIBILITY AND SEO ENHANCEMENTS
   ========================================================================== */

/* Screen reader optimizations */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus management for accessibility */
.seo-focus-visible:focus-visible {
    outline: 2px solid #007bff;
    outline-offset: 2px;
    border-radius: 4px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .seo-class-card {
        border: 2px solid #000;
    }
    
    .seo-class-card-header {
        background: #000;
        color: #fff;
    }
    
    .seo-subject-item {
        border: 1px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .seo-class-card,
    .seo-subject-item,
    .seo-quick-links a {
        transition: none;
        animation: none;
    }
    
    .seo-animate-fade-up,
    .seo-animate-slide-right {
        animation: none;
        opacity: 1;
        transform: none;
    }
}

/* ==========================================================================
   8. MOBILE-FIRST RESPONSIVE OPTIMIZATIONS
   ========================================================================== */

/* Mobile optimizations */
@media (max-width: 767px) {
    .seo-class-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        margin: 20px 0;
    }
    
    .seo-class-card-header {
        padding: 15px;
    }
    
    .seo-class-title {
        font-size: 18px;
    }
    
    .seo-class-description {
        font-size: 13px;
    }
    
    .seo-class-card-body {
        padding: 15px;
    }
    
    .seo-subjects-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 8px;
    }
    
    .seo-subject-item {
        padding: 10px;
    }
    
    .seo-subject-link {
        font-size: 12px;
    }
    
    .seo-sidebar {
        position: static;
        max-height: none;
        margin-top: 30px;
    }
    
    .seo-widget-content {
        padding: 15px;
    }
}

/* Tablet optimizations */
@media (min-width: 768px) and (max-width: 1023px) {
    .seo-class-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .seo-subjects-grid {
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    }
}

/* ==========================================================================
   9. ADVANCED SEO SCHEMA MARKUP STYLES
   ========================================================================== */

.seo-schema-article {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    padding: 30px;
    margin: 30px 0;
    position: relative;
}

.seo-schema-article::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #28a745 0%, #007bff 100%);
}

.seo-article-header {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e9ecef;
}

.seo-article-title {
    font-size: 28px;
    font-weight: 700;
    color: #2c3e50;
    margin: 0 0 15px 0;
    line-height: 1.3;
}

.seo-article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 14px;
    color: #6c757d;
}

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

.seo-meta-icon {
    width: 16px;
    height: 16px;
    opacity: 0.7;
}

.seo-article-content {
    font-size: 16px;
    line-height: 1.7;
    color: #2c3e50;
}

.seo-article-content h2 {
    font-size: 24px;
    font-weight: 600;
    color: #2c3e50;
    margin: 30px 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9ecef;
}

.seo-article-content h3 {
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
    margin: 25px 0 12px 0;
}

.seo-article-content p {
    margin-bottom: 16px;
    text-align: justify;
}

.seo-article-content ul,
.seo-article-content ol {
    margin: 16px 0;
    padding-left: 24px;
}

.seo-article-content li {
    margin-bottom: 8px;
    line-height: 1.6;
}

/* ==========================================================================
   10. PERFORMANCE MONITORING AND OPTIMIZATION
   ========================================================================== */

/* Critical resource hints */
.seo-preload-hint {
    display: none;
}

/* Optimize font loading */
@font-face {
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: local('Roboto'), local('Roboto-Regular');
}

/* Optimize image loading */
.seo-lazy-image {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.seo-lazy-image.loaded {
    opacity: 1;
}

/* ==========================================================================
   11. PRINT OPTIMIZATIONS
   ========================================================================== */

@media print {
    .seo-sidebar,
    .seo-widget,
    .navigation,
    .header-area,
    .footer-area {
        display: none !important;
    }
    
    .seo-class-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
    
    .seo-class-card {
        break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #000 !important;
    }
    
    .seo-class-card-header {
        background: #f8f9fa !important;
        color: #000 !important;
    }
    
    .seo-article-title {
        color: #000 !important;
    }
    
    .seo-article-content {
        color: #000 !important;
    }
}

/* ==========================================================================
   12. DARK MODE SUPPORT (FUTURE ENHANCEMENT)
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .seo-dark-mode-ready {
        --bg-primary: #1a1a1a;
        --bg-secondary: #2d2d2d;
        --text-primary: #ffffff;
        --text-secondary: #b3b3b3;
        --border-color: #404040;
        --accent-color: #4a9eff;
    }
}

/* ==========================================================================
   13. UTILITY CLASSES FOR SEO OPTIMIZATION
   ========================================================================== */

.seo-text-center { text-align: center; }
.seo-text-left { text-align: left; }
.seo-text-right { text-align: right; }
.seo-text-justify { text-align: justify; }

.seo-font-weight-light { font-weight: 300; }
.seo-font-weight-normal { font-weight: 400; }
.seo-font-weight-medium { font-weight: 500; }
.seo-font-weight-semibold { font-weight: 600; }
.seo-font-weight-bold { font-weight: 700; }

.seo-margin-0 { margin: 0; }
.seo-margin-sm { margin: 8px; }
.seo-margin-md { margin: 16px; }
.seo-margin-lg { margin: 24px; }
.seo-margin-xl { margin: 32px; }

.seo-padding-0 { padding: 0; }
.seo-padding-sm { padding: 8px; }
.seo-padding-md { padding: 16px; }
.seo-padding-lg { padding: 24px; }
.seo-padding-xl { padding: 32px; }

.seo-border-radius-sm { border-radius: 4px; }
.seo-border-radius-md { border-radius: 8px; }
.seo-border-radius-lg { border-radius: 12px; }
.seo-border-radius-xl { border-radius: 16px; }

.seo-shadow-sm { box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.seo-shadow-md { box-shadow: 0 4px 8px rgba(0,0,0,0.1); }
.seo-shadow-lg { box-shadow: 0 8px 16px rgba(0,0,0,0.1); }
.seo-shadow-xl { box-shadow: 0 16px 32px rgba(0,0,0,0.1); }

/* ==========================================================================
   14. FINAL RESPONSIVE BREAKPOINTS
   ========================================================================== */

/* Extra small devices (portrait phones, less than 576px) */
@media (max-width: 575.98px) {
    .seo-class-card-header {
        padding: 12px;
    }
    
    .seo-class-title {
        font-size: 16px;
    }
    
    .seo-class-description {
        font-size: 12px;
    }
    
    .seo-subjects-grid {
        grid-template-columns: 1fr;
    }
    
    .seo-article-title {
        font-size: 24px;
    }
}

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) and (max-width: 767.98px) {
    .seo-class-grid {
        grid-template-columns: 1fr;
    }
    
    .seo-subjects-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .seo-class-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .seo-class-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    .seo-class-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .seo-sidebar {
        position: sticky;
        top: 20px;
    }
}
