/* Theme Toggle Button */
.theme-toggle {
    background: none;
    border: 1px solid #ddd;
    color: #333;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    margin-left: 1rem;
    transition: all 0.3s ease;
    color: #e0e0e0;
}

.theme-toggle:hover {
    background: #444;
}

/* Dark theme styles */
[data-theme="dark"] {
    color-scheme: dark;
}

[data-theme="dark"] html {
    background-color: #121212;
}

[data-theme="dark"] body {
    background-color: #121212;
    color: #e0e0e0;
}

/* Navbar dark theme */
[data-theme="dark"] .navbar {
    background-color: #1f1f1f;
}

[data-theme="dark"] .theme-toggle {
    border-color: #444;
    color: #e0e0e0;
    background-color: #2a2a2a;
}

[data-theme="dark"] .theme-toggle:hover {
    background-color: #333;
}

/* Index page dark theme */
[data-theme="dark"] .main-content {
    color: #e0e0e0;
}

[data-theme="dark"] .welcome-section h1 {
    color: #f0f0f0;
}

[data-theme="dark"] .welcome-section p {
    color: #b0b0b0;
}

[data-theme="dark"] .content-card {
    background: #2a2a2a;
    border: 1px solid #404040;
}

[data-theme="dark"] .content-card:hover {
    background: #333;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .content-card h3 {
    color: #f0f0f0;
}

[data-theme="dark"] .content-card p {
    color: #b0b0b0;
}

[data-theme="dark"] .card-link {
    background: #0d6efd;
    color: #fff;
}

[data-theme="dark"] .card-link:hover {
    background: #0b5ed7;
}

/* Stats section dark theme */
[data-theme="dark"] .stats-section h2 {
    color: #f0f0f0;
}

[data-theme="dark"] .stat-item {
    background: #2a2a2a;
    border-color: #404040;
}

[data-theme="dark"] .stat-number {
    color: #4dabf7;
}

[data-theme="dark"] .stat-label {
    color: #b0b0b0;
}

/* Featured section dark theme */
[data-theme="dark"] .featured-section h2 {
    color: #f0f0f0;
}

[data-theme="dark"] .featured-item {
    background: #2a2a2a;
    border-left: 4px solid #4dabf7;
    color: #b0b0b0;
}

[data-theme="dark"] .featured-item strong {
    color: #f0f0f0;
}

/* Books page dark theme */
[data-theme="dark"] .page-header h1 {
    color: #f0f0f0;
}

[data-theme="dark"] .page-header p {
    color: #b0b0b0;
}

[data-theme="dark"] .section-title {
    color: #f0f0f0;
    border-bottom-color: #4dabf7;
}

[data-theme="dark"] .subsection-title {
    color: #e0e0e0;
    border-left-color: #51cf66;
}

[data-theme="dark"] .book-card {
    background: #2a2a2a;
    border-color: #404040;
}

[data-theme="dark"] .book-card:hover {
    background: #333;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .book-title a {
    color: #f0f0f0;
}

[data-theme="dark"] .book-title a:hover {
    color: #4dabf7;
}

[data-theme="dark"] .book-authors {
    color: #b0b0b0;
}

[data-theme="dark"] .book-meta {
    border-top-color: #404040;
}

[data-theme="dark"] .book-size {
    background: #404040;
    color: #b0b0b0;
}

[data-theme="dark"] .book-year {
    color: #999;
}

[data-theme="dark"] .book-language {
    background: #1a365d;
    color: #63b3ed;
}

[data-theme="dark"] .stats-bar {
    background: #2a2a2a;
    border: 1px solid #404040;
}

[data-theme="dark"] .search-box {
    background: #2a2a2a;
    border-color: #404040;
    color: #e0e0e0;
}

[data-theme="dark"] .search-box:focus {
    border-color: #4dabf7;
}

[data-theme="dark"] .search-box::placeholder {
    color: #888;
}

/* Dark theme subject borders */
[data-theme="dark"] .subject-math {
    border-left-color: #ff8a80;
}
[data-theme="dark"] .subject-physics {
    border-left-color: #64ffda;
}
[data-theme="dark"] .subject-geology {
    border-left-color: #40c4ff;
}
[data-theme="dark"] .subject-literature {
    border-left-color: #b9f6ca;
}

/* Mobile dark theme adjustments */
@media screen and (max-width: 768px) {
    [data-theme="dark"] .nav-links {
        background-color: #1f1f1f;
    }

    [data-theme="dark"] .nav-links a {
        border-bottom: 1px solid #333;
    }

    [data-theme="dark"] .nav-links a:hover {
        background-color: #333;
    }

    .theme-toggle {
        margin-left: 0;
        margin-right: 1rem;
    }
}

/* Exercises page dark theme */
[data-theme="dark"] .filter-btn {
    background: #2a2a2a;
    border-color: #404040;
    color: #e0e0e0;
}

[data-theme="dark"] .filter-btn:hover,
[data-theme="dark"] .filter-btn.active {
    background: #007bff;
    border-color: #007bff;
    color: white;
}

[data-theme="dark"] .filter-btn.math.active {
    background: #ff6b6b;
    border-color: #ff6b6b;
}

[data-theme="dark"] .filter-btn.physics.active {
    background: #4ecdc4;
    border-color: #4ecdc4;
}

[data-theme="dark"] .filter-btn.chemistry.active {
    background: #45b7d1;
    border-color: #45b7d1;
}

[data-theme="dark"] .exercise-card {
    background: #2a2a2a;
    border-color: #404040;
}

[data-theme="dark"] .exercise-card:hover {
    background: #333;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .exercise-title {
    color: #f0f0f0;
}

[data-theme="dark"] .exercise-problem {
    color: #e0e0e0;
}

[data-theme="dark"] .exercise-solution {
    background: #1f1f1f;
    border-color: #404040;
    color: #e0e0e0;
}

[data-theme="dark"] .solution-toggle {
    background: #28a745;
    color: white;
}

[data-theme="dark"] .solution-toggle:hover {
    background: #218838;
}

[data-theme="dark"] .solution-toggle.showing {
    background: #6c757d;
}

[data-theme="dark"] .tag {
    background: #404040;
    color: #e0e0e0;
}

[data-theme="dark"] .coming-soon {
    background: #2a2a2a;
    color: #b0b0b0;
}

[data-theme="dark"] .subject-title.math {
    border-bottom-color: #ff8a80;
    color: #f0f0f0;
}

[data-theme="dark"] .subject-title.physics {
    border-bottom-color: #64ffda;
    color: #f0f0f0;
}

[data-theme="dark"] .subject-title.chemistry {
    border-bottom-color: #40c4ff;
    color: #f0f0f0;
}

[data-theme="dark"] .exercise-card.math {
    border-left-color: #ff8a80;
}

[data-theme="dark"] .exercise-card.physics {
    border-left-color: #64ffda;
}

[data-theme="dark"] .exercise-card.chemistry {
    border-left-color: #40c4ff;
}

/* Overview page dark theme */
[data-theme="dark"] .content-card {
    background: #2a2a2a;
    border: 1px solid #404040;
}

[data-theme="dark"] .content-card:hover {
    background: #333;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .content-card h3 {
    color: #f0f0f0;
}

[data-theme="dark"] .content-card p {
    color: #b0b0b0;
}

[data-theme="dark"] .content-card.coming-soon {
    background: #1f1f1f;
    border-color: #333;
}

[data-theme="dark"] .content-card.coming-soon h3 {
    color: #888;
}

[data-theme="dark"] .content-card.coming-soon p {
    color: #888;
}

[data-theme="dark"] .card-link {
    background: #0d6efd;
    color: #fff;
}

[data-theme="dark"] .card-link:hover {
    background: #0b5ed7;
}

/* Table of Contents dark theme */
[data-theme="dark"] .toc-section {
    background: #2a2a2a;
    border: 1px solid #404040;
}

[data-theme="dark"] .toc-section h3 {
    color: #f0f0f0;
}

[data-theme="dark"] .toc-link {
    background: #1f1f1f;
    color: #4dabf7;
    border-color: #404040;
}

[data-theme="dark"] .toc-link:hover {
    border-color: #4dabf7;
    background: #4dabf7;
    color: white;
}

/* Breadcrumb dark theme */
[data-theme="dark"] .breadcrumb a {
    color: #4dabf7;
}

[data-theme="dark"] .breadcrumb span {
    color: #e0e0e0;
}

/* Section descriptions dark theme */
[data-theme="dark"] .section-description {
    color: #b0b0b0;
}

/* Topic tags dark theme */
[data-theme="dark"] .topic-tag {
    background: #404040;
    color: #e0e0e0;
}

/* Coming soon badge dark theme */
[data-theme="dark"] .coming-soon-badge {
    background: #ffc107;
    color: #000;
}

/* Featured section dark theme */
[data-theme="dark"] .featured-link {
    color: #4dabf7;
}

[data-theme="dark"] .featured-link:hover {
    background: #333;
}

/* Notes page dark theme */
[data-theme="dark"] .note-card {
    background: #2a2a2a;
    border-color: #404040;
}

[data-theme="dark"] .note-card:hover {
    background: #333;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .note-title {
    color: #f0f0f0;
}

[data-theme="dark"] .note-source {
    color: #4dabf7;
}

[data-theme="dark"] .note-source:hover {
    color: #63b3ed;
}

[data-theme="dark"] .note-preview {
    color: #b0b0b0;
}

[data-theme="dark"] .note-status.completed {
    background: #1e3a2e;
    color: #90ee90;
}

[data-theme="dark"] .note-status.in-progress {
    background: #3d3516;
    color: #ffd700;
}

[data-theme="dark"] .note-status.planned {
    background: #404040;
    color: #b0b0b0;
}

[data-theme="dark"] .tag {
    background: #1a365d;
    color: #63b3ed;
}

[data-theme="dark"] .tag:hover {
    background: #4dabf7;
    color: white;
}

[data-theme="dark"] .note-date,
[data-theme="dark"] .note-chapters {
    color: #888;
}

[data-theme="dark"] .note-meta {
    border-top-color: #404040;
}

[data-theme="dark"] .quick-access {
    background: #2a2a2a;
    border: 1px solid #404040;
}

[data-theme="dark"] .quick-access .section-title {
    color: #f0f0f0;
    border-bottom-color: #51cf66;
}

[data-theme="dark"] .quick-link {
    background: #1f1f1f;
    color: #e0e0e0;
    border: 2px solid #404040;
}

[data-theme="dark"] .quick-link:hover {
    background: #4dabf7;
    color: white;
    box-shadow: 0 4px 12px rgba(77, 171, 247, 0.3);
}

[data-theme="dark"] .filter-btn {
    background: #2a2a2a;
    border-color: #404040;
    color: #e0e0e0;
}

[data-theme="dark"] .filter-btn:hover {
    background: #333;
    border-color: #4dabf7;
}

[data-theme="dark"] .filter-btn.active {
    background: #4dabf7;
    border-color: #4dabf7;
    color: white;
}

[data-theme="dark"] .filter-btn.math.active {
    background: #ff8a80;
    border-color: #ff8a80;
}

[data-theme="dark"] .filter-btn.physics.active {
    background: #64ffda;
    border-color: #64ffda;
    color: #000;
}

[data-theme="dark"] .filter-btn.geology.active {
    background: #40c4ff;
    border-color: #40c4ff;
    color: #000;
}

[data-theme="dark"] .filter-btn.literature.active {
    background: #b9f6ca;
    border-color: #b9f6ca;
    color: #000;
}

[data-theme="dark"] .subject-math {
    border-left-color: #ff8a80;
}

[data-theme="dark"] .subject-physics {
    border-left-color: #64ffda;
}

[data-theme="dark"] .subject-geology {
    border-left-color: #40c4ff;
}

[data-theme="dark"] .subject-literature {
    border-left-color: #b9f6ca;
}

/* Dark theme modal styles */
[data-theme="dark"] .modal {
    background-color: rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] .modal-content {
    background-color: #2a2a2a;
    color: #e0e0e0;
    border: 1px solid #404040;
}

[data-theme="dark"] .close {
    color: #ccc;
}

[data-theme="dark"] .close:hover {
    color: #fff;
}

[data-theme="dark"] .modal-content h3 {
    color: #f0f0f0;
}

[data-theme="dark"] .recent-note-item {
    border-bottom-color: #404040;
}

[data-theme="dark"] .recent-note-title {
    color: #f0f0f0;
}

[data-theme="dark"] .recent-note-date {
    color: #b0b0b0;
}

[data-theme="dark"] .favorite-item {
    background: #1f1f1f;
    border-color: #404040;
}

[data-theme="dark"] .favorite-title {
    color: #f0f0f0;
}

[data-theme="dark"] .favorite-subject {
    color: #b0b0b0;
}

[data-theme="dark"] .template-item {
    background: #1f1f1f;
    border-color: #404040;
}

[data-theme="dark"] .template-item h4 {
    color: #f0f0f0;
}

[data-theme="dark"] .template-preview {
    background: #404040;
    color: #e0e0e0;
}

[data-theme="dark"] .template-preview p {
    color: #b0b0b0;
}

/* Dark theme for favorites help text */
[data-theme="dark"] .favorites-help p {
    color: #b0b0b0;
}

/* Dark theme for modal header and buttons */
[data-theme="dark"] .modal-header {
    background: #1f1f1f;
    border-bottom-color: #404040;
}

[data-theme="dark"] .download-btn {
    background: #28a745;
    color: white;
}

[data-theme="dark"] .download-btn:hover {
    background: #218838;
}

[data-theme="dark"] .close {
    color: #ccc;
}

[data-theme="dark"] .close:hover {
    color: #fff;
}
