/* Enhanced CSS for CBSE Topper Answer Sheet */
:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --accent-color: #3b82f6;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --light-color: #f8fafc;
    --dark-color: #1e293b;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --border-radius: 8px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

/* Reset and base styles */
* {
    box-sizing: border-box;
}

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

/* Enhanced container */
.enhanced-topper-container {
    background: var(--gradient-primary);
    min-height: 100vh;
    padding: 2rem 0;
    position: relative;
}

.enhanced-topper-container::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="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="75" cy="75" r="1" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
    pointer-events: none;
}

/* Hero section */
.enhanced-hero {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 3rem 2rem;
    margin-bottom: 2rem;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.enhanced-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.1) 0%, transparent 70%);
    animation: heroGlow 6s ease-in-out infinite alternate;
}

@keyframes heroGlow {
    0% { transform: rotate(0deg) scale(1); }
    100% { transform: rotate(180deg) scale(1.1); }
}

.enhanced-hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    position: relative;
    z-index: 1;
}

.enhanced-hero p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.6;
    position: relative;
    z-index: 1;
}

/* AI Search container */
.ai-search-container {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    position: relative;
}

.search-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.search-tab {
    padding: 0.75rem 1.5rem;
    background: var(--light-color);
    border: 2px solid transparent;
    border-radius: 25px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    text-decoration: none;
    color: var(--text-primary);
    position: relative;
    overflow: hidden;
}

.search-tab::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;
}

.search-tab:hover::before {
    left: 100%;
}

.search-tab.active,
.search-tab:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.search-input-container {
    position: relative;
    margin-bottom: 1rem;
}

.search-input {
    width: 100%;
    padding: 1rem 3rem 1rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    transition: var(--transition);
    background: white;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    transform: translateY(-1px);
}

.voice-search-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.5rem;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1rem;
}

.voice-search-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-50%) scale(1.1);
}

/* Enhanced content */
.enhanced-content {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    position: relative;
}

/* Breadcrumb */
.breadcrumb-enhanced {
    background: var(--light-color);
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

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

.breadcrumb-enhanced a:hover {
    text-decoration: underline;
    color: var(--secondary-color);
}

/* Class sections */
.class-section {
    margin-bottom: 3rem;
}

.class-header {
    background: var(--gradient-primary);
    color: white;
    padding: 1.5rem;
    border-radius: 15px;
    margin-bottom: 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.class-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: headerShimmer 4s linear infinite;
}

@keyframes headerShimmer {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.class-header h2 {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
}

.class-header p {
    position: relative;
    z-index: 1;
    opacity: 0.9;
}

/* Statistics */
.class-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.stat-card {
    background: var(--light-color);
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(37, 99, 235, 0.1), transparent);
    transition: left 0.6s;
}

.stat-card:hover::before {
    left: 100%;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
    background: white;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    display: block;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Subject grid */
.subject-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.subject-card {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 15px;
    padding: 1.5rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.subject-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
}

.subject-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 49%, rgba(37, 99, 235, 0.05) 50%, transparent 51%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.subject-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.subject-card:hover::after {
    opacity: 1;
}

.subject-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    z-index: 1;
}

.subject-icon {
    font-size: 1.5rem;
    animation: iconBounce 2s ease-in-out infinite;
}

@keyframes iconBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

/* Year links */
.year-links {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.year-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--light-color);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-primary);
    transition: var(--transition);
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}

.year-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--gradient-primary);
    transition: left 0.3s ease;
    z-index: -1;
}

.year-link:hover::before {
    left: 0;
}

.year-link:hover {
    color: white;
    text-decoration: none;
    border-color: var(--primary-color);
    transform: translateX(5px);
}

.year-text {
    font-weight: 500;
}

.download-btn {
    background: var(--success-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    transition: var(--transition);
}

.year-link:hover .download-btn {
    background: white;
    color: var(--primary-color);
    transform: scale(1.05);
}

/* Tips section */
.tips-section {
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    border-radius: 15px;
    padding: 2rem;
    margin: 2rem 0;
    position: relative;
    overflow: hidden;
}

.tips-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.1) 0%, transparent 70%);
    animation: tipsGlow 8s ease-in-out infinite alternate;
}

@keyframes tipsGlow {
    0% { transform: scale(1) rotate(0deg); }
    100% { transform: scale(1.2) rotate(180deg); }
}

.tips-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 1rem;
    text-align: center;
    position: relative;
    z-index: 1;
}

.tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
    position: relative;
    z-index: 1;
}

.tip-card {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
    position: relative;
}

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

.tip-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
    display: block;
    animation: tipIconPulse 3s ease-in-out infinite;
}

@keyframes tipIconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.tip-title {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

/* FAQ section */
.faq-section {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: var(--shadow);
}

.faq-title {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 2rem;
    text-align: center;
}

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

.faq-item:hover {
    box-shadow: var(--shadow);
}

.faq-question {
    background: var(--light-color);
    padding: 1.5rem;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
    position: relative;
}

.faq-question::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--gradient-primary);
    transition: left 0.3s ease;
    z-index: -1;
}

.faq-question:hover::before {
    left: 0;
}

.faq-question:hover {
    color: white;
}

.faq-answer {
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    background: white;
}

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

/* Related resources */
.related-resources {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-radius: 15px;
    padding: 2rem;
    margin: 2rem 0;
    position: relative;
    overflow: hidden;
}

.related-resources::before {
    content: '';
    position: absolute;
    top: -30%;
    left: -30%;
    width: 60%;
    height: 60%;
    background: radial-gradient(circle, rgba(245, 158, 11, 0.2) 0%, transparent 70%);
    animation: resourcesFloat 6s ease-in-out infinite alternate;
}

@keyframes resourcesFloat {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(20px, -20px) rotate(180deg); }
}

.resources-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 1rem;
    text-align: center;
    position: relative;
    z-index: 1;
}

.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    position: relative;
    z-index: 1;
}

.resource-link {
    background: white;
    padding: 1rem;
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-primary);
    text-align: center;
    transition: var(--transition);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.resource-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(37, 99, 235, 0.1), transparent);
    transition: left 0.5s;
}

.resource-link:hover::before {
    left: 100%;
}

.resource-link:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    text-decoration: none;
    color: var(--primary-color);
}

.resource-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: block;
    animation: resourceIconSpin 4s linear infinite;
}

@keyframes resourceIconSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Search results */
.search-results {
    margin-top: 1rem;
}

.search-highlight {
    animation: highlightPulse 2s ease-in-out;
    border-color: #fbbf24 !important;
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.3) !important;
}

@keyframes highlightPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

/* Responsive design */
@media (max-width: 1024px) {
    .subject-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    .enhanced-hero {
        padding: 2rem 1rem;
    }
    
    .enhanced-hero h1 {
        font-size: 2rem;
    }
    
    .search-tabs {
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 0.5rem;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .search-tabs::-webkit-scrollbar {
        display: none;
    }
    
    .search-tab {
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    .subject-grid {
        grid-template-columns: 1fr;
    }
    
    .tips-grid {
        grid-template-columns: 1fr;
    }
    
    .resources-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .class-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .enhanced-topper-container {
        padding: 1rem 0;
    }
    
    .enhanced-hero {
        padding: 1.5rem 1rem;
        margin-bottom: 1rem;
    }
    
    .enhanced-hero h1 {
        font-size: 1.75rem;
    }
    
    .ai-search-container {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .enhanced-content {
        padding: 1rem;
    }
    
    .class-stats {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .resources-grid {
        grid-template-columns: 1fr;
    }
    
    .year-link {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    .faq-question {
        padding: 1rem;
        font-size: 0.9rem;
    }
    
    .faq-answer.active {
        padding: 1rem;
    }
}

/* Print styles */
@media print {
    .ai-search-container,
    .tips-section,
    .faq-section,
    .related-resources {
        display: none;
    }
    
    .enhanced-hero {
        background: white;
        box-shadow: none;
    }
    
    .subject-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .year-link {
        border: 1px solid #ccc;
        margin-bottom: 0.25rem;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #f9fafb;
        --text-secondary: #d1d5db;
        --light-color: #374151;
        --border-color: #4b5563;
    }
    
    .enhanced-content,
    .ai-search-container,
    .faq-section {
        background: #1f2937;
        color: var(--text-primary);
    }
    
    .search-input {
        background: #374151;
        color: var(--text-primary);
        border-color: var(--border-color);
    }
    
    .subject-card,
    .tip-card,
    .resource-link {
        background: #374151;
        color: var(--text-primary);
        border-color: var(--border-color);
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for accessibility */
.search-tab:focus,
.year-link:focus,
.resource-link:focus,
.faq-question:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.search-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .subject-card,
    .tip-card,
    .resource-link {
        border: 2px solid var(--text-primary);
    }
    
    .search-tab.active {
        border: 2px solid white;
    }
}
