/* ========================================
   A-Level Studies - Clean & Minimal Theme
   ======================================== */

/* CSS Custom Properties */
:root {
    /* Neutral Colors - Soft & Calming */
    --bg-primary: #f8f9fa;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;

    --text-primary: #2d3436;
    --text-secondary: #636e72;
    --text-muted: #b2bec3;

    /* Subject Colors - Muted & Distinct */
    --cs-color: #6c5ce7;
    --math-color: #00b894;
    --physics-color: #0984e3;
    --business-color: #e17055;

    /* Accent Colors */
    --accent-primary: #6c5ce7;
    --accent-success: #00b894;
    --accent-warning: #fdcb6e;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 50%;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;

    /* Border Color */
    --border-color: rgba(0, 0, 0, 0.08);
}

/* Dark Mode */
[data-theme="dark"] {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: #1f2940;

    --text-primary: #edf2f7;
    --text-secondary: #a0aec0;
    --text-muted: #718096;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);

    --border-color: rgba(255, 255, 255, 0.1);
}

/* Dark Mode - Extended Fixes */
[data-theme="dark"] .chapter-card {
    border-color: var(--border-color);
}

[data-theme="dark"] .resource-btn {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

[data-theme="dark"] .resource-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

[data-theme="dark"] .resource-btn svg {
    color: var(--text-muted);
}

[data-theme="dark"] .resource-links {
    border-top-color: var(--border-color);
}

[data-theme="dark"] .chapter-number {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

[data-theme="dark"] .topic-list li::before {
    background: var(--text-muted);
}

[data-theme="dark"] .subject-card {
    border-color: var(--border-color);
}

[data-theme="dark"] .paper-badge {
    background: var(--accent-primary);
}

[data-theme="dark"] .dropdown-menu {
    background: var(--bg-card);
    border-color: var(--border-color);
}

[data-theme="dark"] .dropdown-menu a {
    color: var(--text-secondary);
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .dropdown-menu a:hover {
    background: var(--bg-secondary);
}

[data-theme="dark"] .mode-btn,
[data-theme="dark"] .control-btn,
[data-theme="dark"] .timer-btn-secondary {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

[data-theme="dark"] .mode-btn:hover,
[data-theme="dark"] .control-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

[data-theme="dark"] .timer-track {
    stroke: var(--bg-secondary);
}

[data-theme="dark"] input[type="checkbox"] {
    accent-color: var(--accent-primary);
}

[data-theme="dark"] .pdf-frame {
    background: #2d3748;
}

[data-theme="dark"] .pdf-download-link {
    color: var(--accent-primary);
}

[data-theme="dark"] .pdf-download-link:hover {
    color: #a29bfe;
}

[data-theme="dark"] .section-header {
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .flashcards-shortcut {
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.15), rgba(162, 155, 254, 0.1));
    border-color: rgba(108, 92, 231, 0.4);
}

[data-theme="dark"] .nav-link {
    background: var(--bg-card);
    border-color: var(--border-color);
}

[data-theme="dark"] .nav-link:hover {
    background: var(--bg-secondary);
}

[data-theme="dark"] .resource-tab,
[data-theme="dark"] .topical-tab {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

[data-theme="dark"] .resource-tab:hover:not(.active),
[data-theme="dark"] .topical-tab:hover:not(.active) {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

[data-theme="dark"] .checklist-section {
    border-color: var(--border-color);
}

[data-theme="dark"] .section-header {
    background: var(--bg-secondary);
}

[data-theme="dark"] .section-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .checklist-item {
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .split-panel {
    border-color: var(--border-color);
}

[data-theme="dark"] .source-card {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

[data-theme="dark"] .source-card:hover {
    background: var(--accent-primary);
}

[data-theme="dark"] .quick-link-card {
    border-color: var(--border-color);
}

[data-theme="dark"] .quick-link-card.study-plan {
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.15) 0%, rgba(0, 184, 148, 0.15) 100%);
    border-color: rgba(108, 92, 231, 0.3);
}

[data-theme="dark"] .flashcard {
    border-color: var(--border-color);
}

[data-theme="dark"] .study-stats {
    background: var(--bg-secondary);
}

[data-theme="dark"] .progress-bar {
    background: var(--bg-secondary);
}

[data-theme="dark"] .video-section {
    background: linear-gradient(135deg, rgba(214, 48, 49, 0.15), rgba(253, 121, 168, 0.1)) !important;
}

[data-theme="dark"] .topical-card {
    background: var(--bg-card);
    border-color: var(--border-color);
}

[data-theme="dark"] .topical-card:hover {
    border-color: var(--accent-primary);
}

[data-theme="dark"] .action-btn {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

[data-theme="dark"] .action-btn.newtab-btn {
    border-color: var(--border-color);
}

[data-theme="dark"] .author-btn {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .author-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .author-btn.active {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

[data-theme="dark"] .author-nav {
    border-color: var(--border-color);
}

[data-theme="dark"] .pdf-tab {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

[data-theme="dark"] .pdf-tab:hover:not(.active) {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

[data-theme="dark"] .notes-header {
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .reading-time {
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

[data-theme="dark"] .toc {
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.8) 0%, rgba(22, 33, 62, 0.8) 100%);
    border-color: var(--border-color);
}

[data-theme="dark"] .toc-list li a:hover {
    background: rgba(108, 92, 231, 0.2);
}

[data-theme="dark"] .knowledge-box {
    background: linear-gradient(135deg, rgba(9, 132, 227, 0.15) 0%, rgba(9, 132, 227, 0.1) 100%);
}

[data-theme="dark"] .analysis-box {
    background: linear-gradient(135deg, rgba(0, 184, 148, 0.15) 0%, rgba(0, 184, 148, 0.1) 100%);
}

[data-theme="dark"] .evaluation-box {
    background: linear-gradient(135deg, rgba(243, 156, 18, 0.15) 0%, rgba(243, 156, 18, 0.1) 100%);
}

[data-theme="dark"] .example-box {
    background: linear-gradient(135deg, rgba(155, 89, 182, 0.15) 0%, rgba(155, 89, 182, 0.1) 100%);
}

[data-theme="dark"] .comparison-table tbody tr:nth-child(even) {
    background: var(--bg-secondary);
}

[data-theme="dark"] .comparison-table tbody tr:hover {
    background: rgba(108, 92, 231, 0.1);
}

[data-theme="dark"] .comparison-table th,
[data-theme="dark"] .comparison-table td {
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .pdf-download-link {
    background: rgba(108, 92, 231, 0.15);
}

[data-theme="dark"] .pdf-download-link:hover {
    background: rgba(108, 92, 231, 0.25);
}

[data-theme="dark"] .pdf-tabs {
    border-bottom-color: var(--border-color);
}

/* Reset & Base Styles */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Container */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: var(--spacing-md);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    text-align: center;
    padding: var(--spacing-xl) 0 var(--spacing-lg);
}

.logo {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.tagline {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: var(--spacing-xs);
    font-weight: 400;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xl);
}

/* Section Title */
.section-title {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Subjects Grid */
.subjects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--spacing-md);
}

/* Subject Card */
.subject-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    text-align: center;
    cursor: pointer;
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

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

.subject-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto var(--spacing-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    transition: transform var(--transition-fast);
}

.subject-card:hover .subject-icon {
    transform: scale(1.05);
}

/* Subject-specific icon colors */
.subject-card[data-subject="cs"] .subject-icon {
    background: rgba(108, 92, 231, 0.1);
    color: var(--cs-color);
}

.subject-card[data-subject="math"] .subject-icon {
    background: rgba(0, 184, 148, 0.1);
    color: var(--math-color);
}

.subject-card[data-subject="physics"] .subject-icon {
    background: rgba(9, 132, 227, 0.1);
    color: var(--physics-color);
}

.subject-card[data-subject="business"] .subject-icon {
    background: rgba(225, 112, 85, 0.1);
    color: var(--business-color);
}

.subject-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
}

.subject-code {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Pomodoro Section */
.pomodoro-section {
    padding: var(--spacing-lg) 0;
}

.pomodoro-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0, 0, 0, 0.04);
    text-align: center;
}

/* Timer Display */
.timer-display {
    margin-bottom: var(--spacing-lg);
}

.timer-ring {
    position: relative;
    width: 180px;
    height: 180px;
    margin: 0 auto;
}

.timer-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.timer-track {
    fill: none;
    stroke: var(--bg-primary);
    stroke-width: 8;
}

.timer-progress {
    fill: none;
    stroke: var(--accent-primary);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 339.292;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.5s ease, stroke var(--transition-normal);
}

.timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.timer-time {
    display: block;
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    letter-spacing: -1px;
}

.timer-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: var(--spacing-xs);
}

/* Timer Controls */
.timer-controls {
    display: flex;
    justify-content: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.timer-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    background: var(--accent-primary);
    color: white;
}

.timer-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.timer-btn:active {
    transform: translateY(0);
}

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

.timer-btn-secondary:hover {
    background: #eee;
    color: var(--text-primary);
}

.timer-btn svg {
    width: 18px;
    height: 18px;
}

/* Timer Modes */
.timer-modes {
    display: flex;
    justify-content: center;
    gap: var(--spacing-xs);
}

.mode-btn {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-family: inherit;
    font-weight: 500;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.mode-btn.active {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

/* Break Mode Styling */
.pomodoro-container.break-mode .timer-progress {
    stroke: var(--accent-success);
}

.pomodoro-container.break-mode .timer-btn:not(.timer-btn-secondary) {
    background: var(--accent-success);
}

.pomodoro-container.break-mode .mode-btn.active {
    background: var(--accent-success);
    border-color: var(--accent-success);
}

/* Footer */
.footer {
    text-align: center;
    padding: var(--spacing-lg) 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Responsive Design */
@media (max-width: 600px) {
    .container {
        padding: var(--spacing-sm);
    }

    .header {
        padding: var(--spacing-lg) 0 var(--spacing-md);
    }

    .logo {
        font-size: 1.5rem;
    }

    .subjects-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-sm);
    }

    .subject-card {
        padding: var(--spacing-md);
    }

    .subject-icon {
        width: 48px;
        height: 48px;
    }

    .subject-name {
        font-size: 0.9rem;
    }

    .pomodoro-container {
        padding: var(--spacing-lg);
    }

    .timer-ring {
        width: 150px;
        height: 150px;
    }

    .timer-time {
        font-size: 2rem;
    }

    .timer-controls {
        flex-wrap: wrap;
    }

    .timer-btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.85rem;
    }
}

/* Focus state for accessibility */
.subject-card:focus,
.timer-btn:focus,
.mode-btn:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Quick Links Section */
.quick-links-section {
    margin-bottom: var(--spacing-lg);
}

.quick-links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-md);
}

.quick-link-card {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0, 0, 0, 0.05);
    text-decoration: none;
    color: inherit;
    transition: all var(--transition-normal);
}

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

.quick-link-card.study-plan {
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.1) 0%, rgba(0, 184, 148, 0.1) 100%);
    border: 1px solid rgba(108, 92, 231, 0.2);
}

.quick-link-card.study-plan:hover {
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.15) 0%, rgba(0, 184, 148, 0.15) 100%);
}

.quick-link-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--cs-color) 0%, var(--math-color) 100%);
    border-radius: var(--radius-sm);
    color: white;
    flex-shrink: 0;
}

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

.quick-link-content h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.quick-link-content p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
}

.quick-link-arrow {
    font-size: 1.25rem;
    color: var(--text-muted);
    transition: transform var(--transition-fast);
}

.quick-link-card:hover .quick-link-arrow {
    transform: translateX(4px);
    color: var(--accent-primary);
}

/* Theme Toggle Button */
.theme-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--bg-card);
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    transition: all var(--transition-normal);
    z-index: 9998;
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.theme-toggle svg {
    width: 22px;
    height: 22px;
}

.theme-toggle .sun-icon,
.theme-toggle .moon-icon {
    display: none;
}

[data-theme="dark"] .theme-toggle {
    background: #2d3748;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .theme-toggle:hover {
    background: #3d4a5c;
}
/* ========================================
   Enhanced UX Animations
   ======================================== */

/* Page fade-in animation */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

body {
    animation: fadeIn 0.4s ease-out;
}

/* Staggered card animations */
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.subject-card, .chapter-card, .quick-link-card {
    animation: slideUp 0.5s ease-out backwards;
}

.subject-card:nth-child(1) { animation-delay: 0.1s; }
.subject-card:nth-child(2) { animation-delay: 0.15s; }
.subject-card:nth-child(3) { animation-delay: 0.2s; }
.subject-card:nth-child(4) { animation-delay: 0.25s; }

/* Smooth hover transitions for all interactive elements */
button, a, .clickable {
    transition: all 0.2s ease;
}

/* Enhanced focus styles for accessibility */
*:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 3px;
    border-radius: 4px;
}

/* Ripple effect for buttons */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease, opacity 0.4s ease;
    opacity: 0;
}

.ripple:active::after {
    width: 200%;
    height: 200%;
    opacity: 1;
    transition: 0s;
}

/* Loading shimmer animation */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.loading-shimmer {
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-primary) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* Smooth scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

/* Selection color */
::selection {
    background: rgba(102, 126, 234, 0.3);
    color: inherit;
}

/* Pulse animation for notifications */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.pulse {
    animation: pulse 2s infinite;
}

/* Bounce animation for icons */
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.bounce:hover {
    animation: bounce 0.5s ease;
}
