/* General Body Styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f7f6;
    color: #333;
    line-height: 1.6;
}

/* Header Styles */
header {
    background-color: #2c3e50;
    color: #ecf0f1;
    padding: 1rem 0;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

header h1 {
    margin: 0;
    font-size: 2.5rem;
}

/* Navigation Styles */
nav {
    background-color: #34495e;
    padding: 0.75rem 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
}

nav ul li {
    margin: 0 15px;
}

nav ul li a {
    color: #ecf0f1;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s ease;
}

nav ul li a:hover {
    color: #3498db;
}

/* Main Content Area */
main {
    padding: 20px;
    max-width: 1200px;
    margin: 20px auto;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.05);
}

/* Section Styling */
section {
    margin-bottom: 30px;
    padding: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    background-color: #fdfdfd;
}

section h2 {
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

/* Grid for Subjects */
.subject-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.subject-card {
    background-color: #ffffff;
    border: 1px solid #ddd;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.subject-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

.subject-card h3 {
    background-color: #3498db;
    color: white;
    padding: 15px;
    margin: 0;
    font-size: 1.5rem;
    text-align: center;
}

.subject-card .card-content {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.subject-card p {
    color: #555;
    margin-bottom: 15px;
}

.subject-card .button-group {
    display: flex;
    justify-content: space-around;
    gap: 10px;
    margin-top: auto; /* Pushes buttons to the bottom */
}

.subject-card .button-group a {
    display: inline-block;
    padding: 10px 15px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    transition: background-color 0.3s ease, color 0.3s ease;
    flex: 1; /* Distribute space evenly */
    text-align: center;
}

.subject-card .button-group .view-btn {
    background-color: #2ecc71;
    color: white;
}

.subject-card .button-group .view-btn:hover {
    background-color: #27ae60;
}

.subject-card .button-group .download-btn {
    background-color: #e67e22;
    color: white;
}

.subject-card .button-group .download-btn:hover {
    background-color: #d35400;
}

.subject-card .access-count {
    font-size: 0.9em;
    color: #777;
    text-align: center;
    margin-top: 10px;
}

/* Markdown Content Display */
.markdown-content {
    background-color: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 25px;
    margin-top: 30px;
}

.markdown-content h1, .markdown-content h2, .markdown-content h3 {
    color: #2c3e50;
    margin-top: 1.5em;
    margin-bottom: 0.8em;
}

.markdown-content p {
    margin-bottom: 1em;
}

.markdown-content ul, .markdown-content ol {
    margin-left: 20px;
    margin-bottom: 1em;
}

.markdown-content pre {
    background-color: #eee;
    padding: 15px;
    border-radius: 5px;
    overflow-x: auto;
}

.markdown-content code {
    font-family: 'Consolas', 'Monaco', monospace;
    background-color: #e8e8e8;
    padding: 2px 4px;
    border-radius: 3px;
}

/* Cookie Consent Banner */
.cookie-consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #333;
    color: white;
    padding: 15px 20px;
    text-align: center;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    z-index: 1000;
}

.cookie-consent-banner p {
    margin: 0 20px 0 0;
    flex-grow: 1;
    text-align: left;
}

.cookie-consent-banner button {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 10px 20px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    margin: 4px 2px;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.3s ease;
}

.cookie-consent-banner button:hover {
    background-color: #45a049;
}

/* =============================
   Forced Dark Theme Overrides
   ============================= */
:root, html {
    color-scheme: dark;
    /* Dark theme CSS variables for pages using var() */
    --bg-app: #0b0f14;
    --bg-card: #0f1318;
    --border-color: #1f2937;
    --text-primary: #e5e7eb;
    --text-secondary: #94a3b8;
}

html, body {
    background-color: var(--bg-app);
    color: var(--text-primary);
}

/* Layout containers */
header {
    background-color: #0f1115;
    color: #e5e7eb;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* Class-based header used in pages */
.header {
    background-color: #0f1115;
    color: var(--text-primary);
    padding: 2rem 0;
    text-align: center;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
}
.site-title {
    margin: 0;
    font-size: 2.25rem;
    color: var(--text-primary);
}
.site-subtitle {
    margin-top: 0.5rem;
    color: var(--text-secondary);
}

nav {
    background-color: #0f1115;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
}
nav ul li a {
    color: #e5e7eb;
}
nav ul li a:hover {
    color: #93c5fd;
}

main {
    background-color: #111827; /* slate-800 */
    border-radius: 12px;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.06), 0 8px 24px rgba(0,0,0,0.35);
}

/* Pages use .container instead of <main> */
.container {
    background-color: #111827;
    border-radius: 12px;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.06), 0 8px 24px rgba(0,0,0,0.35);
    padding: 24px;
}

section {
    background-color: #0f1318;
    border-color: #1f2937; /* slate-700 */
}
section h2 {
    color: #e5e7eb;
    border-bottom-color: #2563eb; /* blue-600 */
}

/* Cards */
.subject-card {
    background-color: #0f1318;
    border-color: #1f2937;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}
.subject-card h3 {
    background-color: #2563eb; /* blue-600 */
    color: #ffffff;
}
.subject-card p {
    color: #cbd5e1; /* slate-300 */
}
.subject-card .access-count {
    color: #94a3b8; /* slate-400 */
}

/* Markdown content */
.markdown-content {
    background-color: #0f1318;
    border-color: #1f2937;
}
.markdown-content h1, .markdown-content h2, .markdown-content h3 {
    color: #e5e7eb;
}
.markdown-content pre {
    background-color: #0b1220; /* dark code bg */
    color: #e5e7eb;
}
.markdown-content code {
    background-color: #0b1220;
    color: #e5e7eb;
}

/* Links */
a {
    color: #93c5fd; /* light blue */
}
a:hover {
    color: #60a5fa;
}

/* Buttons used on pages */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: #1f1f1f;
    color: var(--text-primary);
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.08s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}
.btn:hover {
    background-color: #242424;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
}
.btn-primary {
    background-color: #2563eb;
    border-color: #1d4ed8;
    color: #ffffff;
}
.btn-primary:hover {
    background-color: #1d4ed8;
}
.btn-secondary {
    background-color: #e67e22;
    border-color: #d35400;
    color: #ffffff;
}
.btn-secondary:hover {
    background-color: #d35400;
}
.count-badge {
    display: inline-block;
    margin-left: 8px;
    font-size: 0.85em;
    padding: 2px 8px;
    background-color: #1f2937;
    color: #e5e7eb;
    border-radius: 999px;
}

/* Cookie banner */
.cookie-consent-banner {
    background-color: #0f1115;
    color: #e5e7eb;
    box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.06);
}
.cookie-consent-banner button {
    background-color: #22c55e; /* green-500 */
}
.cookie-consent-banner button:hover {
    background-color: #16a34a; /* green-600 */
}

/* Form controls (if any) */
input, textarea, select, button {
    background-color: #0f1318;
    color: #e5e7eb;
    border: 1px solid #1f2937;
}
input::placeholder, textarea::placeholder {
    color: #94a3b8;
}

/* Scrollbar (WebKit-based browsers) */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track {
    background: #0b0f14;
}
::-webkit-scrollbar-thumb {
    background: #1f2937;
    border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover {
    background: #374151;
}

/* Footer Styles */
footer {
    text-align: center;
    padding: 20px;
    margin-top: 40px;
    background-color: #2c3e50;
    color: #ecf0f1;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.1);
}

/* Utility Classes */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 15px;
}

.text-center {
    text-align: center;
}

.hidden {
    display: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .subject-grid {
        grid-template-columns: 1fr;
    }

    .cookie-consent-banner {
        flex-direction: column;
        padding: 10px;
    }

    .cookie-consent-banner p {
        text-align: center;
        margin: 0 0 10px 0;
    }
}