/* CSS Custom Properties for Modern Color Scheme */
:root {
    /* Primary Colors - Vibrant and kid-friendly */
    --primary-blue: #4A90E2;
    --primary-purple: #8B5CF6;
    --primary-green: #10B981;
    --primary-orange: #F59E0B;
    --primary-pink: #EC4899;

    /* Neutral Colors */
    --dark-blue: #1E293B;
    --medium-gray: #64748B;
    --light-gray: #F1F5F9;
    --white: #FFFFFF;

    /* Background and text colors (for theme switching) */
    --bg-primary: #F8FAFC;
    --bg-secondary: #E2E8F0;
    --text-primary: #1E293B;
    --text-secondary: #64748B;
    --card-bg: #F8FAFC;
    --border-color: rgba(0, 0, 0, 0.08);

    /* Gradient Colors */
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-3: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* Spacing */
    --spacing-xs: 0.4rem;
    --spacing-sm: 0.8rem;
    --spacing-md: 1.2rem;
    --spacing-lg: 1.6rem;
    --spacing-xl: 2.4rem;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;

    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-base: 300ms ease-in-out;
    --transition-slow: 500ms ease-in-out;
}

/* Night Mode Theme */
html.night-mode,
body.night-mode {
    --bg-primary: #0F172A;
    --bg-secondary: #1E293B;
    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --card-bg: #1E293B;
    --border-color: rgba(255, 255, 255, 0.1);
    --light-gray: #1E293B;
    --dark-blue: #F1F5F9;
    --medium-gray: #94A3B8;
    --white: #0F172A;

    /* Adjust shadows for night mode */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 10px 10px -5px rgba(0, 0, 0, 0.5);
}

/* General styles */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Lexend', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: background-color var(--transition-base), color var(--transition-base);
}

/* Header styles */
header {
    background: var(--gradient-1);
    padding-bottom: 0.25rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-md);
    line-height: 1;
}

.site-title {
    color: var(--white);
    font-size: 2.1rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin: 0;
    padding: calc(var(--spacing-sm) * 0.68) 0;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    line-height: 1.2;
}

/* Logo styles */
.site-title img {
    height: 50px;
    width: auto;
    margin: 0 auto;
}

/* Show white logo by default (light mode) */
.logo-light {
    display: block !important;
}

.logo-dark {
    display: none !important;
}

/* Show black logo in night mode */
html.night-mode .logo-light,
body.night-mode .logo-light {
    display: none !important;
}

html.night-mode .logo-dark,
body.night-mode .logo-dark {
    display: block !important;
}

/* Navigation styles */
.main-nav {
    background-color: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    margin-bottom: 0;
}

.main-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.25rem;
}

/* Grade Level Header Styles */
.grade-level-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md);
    background: var(--gradient-3);
    color: var(--white);
    border-radius: var(--radius-lg);
    margin: 0.3rem 0;
    cursor: pointer;
    transition: var(--transition-base);
    box-shadow: var(--shadow-md);
}

.grade-level-header:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.grade-level-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.toggle-icon {
    font-size: 1.5rem;
    font-weight: bold;
    padding: 0 var(--spacing-sm);
    transition: transform var(--transition-base);
}

.grade-level-header[aria-expanded="true"] .toggle-icon {
    transform: rotate(180deg);
}

.grade-level-content {
    padding: var(--spacing-md);
    background-color: var(--light-gray);
    border-radius: var(--radius-lg);
    margin-top: 0.3rem;
    margin-bottom: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
    animation: slideDown var(--transition-base);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Accessibility Focus Styles */
.grade-level-header:focus {
    outline: 3px solid var(--primary-blue);
    outline-offset: 2px;
}

.main-nav li {
    margin: 0;
}

.main-nav > ul > li > a,
.main-nav > ul > li > .dropdown > a {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    text-decoration: none;
    padding: 0 1.25rem;
    height: 2.8rem;
    font-weight: 500;
    font-size: 1rem;
    transition: all var(--transition-base);
    position: relative;
    border-radius: var(--radius-sm);
    margin-top: 0.25rem;
    margin-bottom: 0.25rem;
    line-height: 1;
}

.main-nav > ul > li > a:hover,
.main-nav > ul > li > .dropdown > a:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.main-nav > ul > li > a::after,
.main-nav > ul > li > .dropdown > a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background-color: var(--white);
    transition: all var(--transition-base);
    transform: translateX(-50%);
}

.main-nav > ul > li > a:hover::after,
.main-nav > ul > li > .dropdown > a:hover::after {
    width: 80%;
}

/* Dropdown Menu Styles */
.main-nav .dropdown {
    position: relative;
}

.main-nav .dropdown > a {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.main-nav .dropdown > a::after {
    display: none;
}

.main-nav .dropdown > a .dropdown-arrow {
    font-size: 0.7rem;
    transition: transform var(--transition-base);
    margin-left: 0.25rem;
}

.main-nav .dropdown:hover > a .dropdown-arrow {
    transform: rotate(180deg);
}

.main-nav .dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    width: max-content;
    min-width: 200px;
    max-width: 300px;
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-base);
    z-index: 1000;
    margin: 0.5rem 0 0 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
}

.main-nav .dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.main-nav .dropdown-menu li {
    margin: 0;
    padding: 0;
    list-style: none;
    display: block;
    width: 100%;
}

.main-nav .dropdown-menu li:not(:last-child) {
    border-bottom: 1px solid var(--light-gray);
}

.main-nav .dropdown-menu li:first-child a {
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.main-nav .dropdown-menu li:last-child a {
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.main-nav .dropdown-menu a {
    display: block;
    color: var(--dark-blue);
    font-size: 0.9rem;
    text-align: center;
    text-decoration: none;
    transition: all var(--transition-fast);
    padding: 0.875rem 0;
    margin: 0;
}

.main-nav .dropdown-menu a:hover {
    background-color: var(--primary-purple);
    color: var(--white);
}

.main-nav .dropdown-menu a::after {
    display: none;
}

/* Mobile and Tablet Navigation */
@media (max-width: 1024px) {
    .main-nav ul {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }

    .main-nav a {
        text-align: center;
        padding: 0.75rem 1rem;
        font-size: clamp(1.25rem, 3.5vw, 1.75rem);
    }

    /* Mobile Dropdown Styles */
    .main-nav .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        background: rgba(255, 255, 255, 0.1);
        margin-top: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height var(--transition-base);
        width: 100%;
        max-width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .main-nav .dropdown.active .dropdown-menu {
        max-height: 500px;
    }

    .main-nav .dropdown > a {
        justify-content: center;
    }

    .main-nav .dropdown-menu li {
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        width: 100%;
        max-width: 90vw;
        display: flex;
        justify-content: center;
    }

    .main-nav .dropdown-menu a {
        color: var(--white);
        padding: 0.5rem 0;
        font-size: 1.1rem;
        text-align: center;
        width: 100%;
        max-width: 100%;
        display: block;
    }

    .main-nav .dropdown-menu a:hover {
        background-color: rgba(255, 255, 255, 0.15);
        color: var(--primary-orange);
        transform: none;
    }

    /* Full width night mode toggle on mobile and tablet */
    .night-mode-toggle {
        justify-content: center;
        width: 100%;
    }
}

/* Night Mode Toggle Slider */
.night-mode-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    cursor: pointer;
    position: relative;
    height: 2.8rem;
    padding: 0 1rem;
    margin: 0.25rem 0;
}

.night-mode-toggle input[type="checkbox"] {
    display: none;
}

.night-mode-toggle .slider {
    width: 3.25rem;
    height: 1.75rem;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 2.125rem;
    position: relative;
    transition: all var(--transition-base);
    flex-shrink: 0;
}

.night-mode-toggle .slider::before {
    content: '';
    position: absolute;
    height: 1.25rem;
    width: 1.25rem;
    left: 0.125rem;
    bottom: 0.125rem;
    background-color: white;
    border-radius: 50%;
    transition: all var(--transition-base);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.night-mode-toggle input[type="checkbox"]:checked + .slider {
    background: rgba(139, 92, 246, 0.3);
    border-color: rgba(139, 92, 246, 0.5);
}

.night-mode-toggle input[type="checkbox"]:checked + .slider::before {
    transform: translateX(1.5rem);
}

.night-mode-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
}

.night-mode-toggle:hover .slider {
    background: rgba(255, 255, 255, 0.3);
}

.night-mode-toggle input[type="checkbox"]:checked:hover + .slider {
    background: rgba(139, 92, 246, 0.4);
}

.night-mode-toggle:focus-within {
    outline: 2px solid var(--white);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

.night-mode-toggle .sun-icon,
.night-mode-toggle .moon-icon {
    font-size: 1.3rem;
    transition: all var(--transition-base);
    line-height: 1;
    flex-shrink: 0;
}

.night-mode-toggle .sun-icon {
    opacity: 1;
}

.night-mode-toggle .moon-icon {
    opacity: 0.5;
}

/* Use :has() selector to target sun icon when checkbox is checked */
.night-mode-toggle:has(input[type="checkbox"]:checked) .sun-icon {
    opacity: 0.5;
}

.night-mode-toggle input[type="checkbox"]:checked ~ .moon-icon {
    opacity: 1;
}

/* Night mode styling - lavender purple with white borders for better visibility */
html.night-mode .night-mode-toggle .slider,
body.night-mode .night-mode-toggle .slider {
    background: rgba(255, 255, 255, 0.2) !important;
    border: 2px solid rgba(255, 255, 255, 0.3) !important;
}

html.night-mode .night-mode-toggle input[type="checkbox"]:checked + .slider,
body.night-mode .night-mode-toggle input[type="checkbox"]:checked + .slider {
    background: rgba(139, 92, 246, 0.35) !important;
    border: 2px solid rgba(255, 255, 255, 0.5) !important;
}

html.night-mode .night-mode-toggle:hover .slider,
body.night-mode .night-mode-toggle:hover .slider {
    background: rgba(255, 255, 255, 0.3) !important;
}

html.night-mode .night-mode-toggle input[type="checkbox"]:checked:hover + .slider,
body.night-mode .night-mode-toggle input[type="checkbox"]:checked:hover + .slider {
    background: rgba(139, 92, 246, 0.5) !important;
    border-color: rgba(255, 255, 255, 0.6) !important;
}

html.night-mode .night-mode-toggle .slider::before,
body.night-mode .night-mode-toggle .slider::before {
    background-color: white !important;
}

/* Grid layout for topics */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-md);
    margin-top: var(--spacing-sm);
}

.grid-item {
    background-color: var(--card-bg);
    padding: var(--spacing-lg);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    border-left: 4px solid var(--primary-blue);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.grid-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--gradient-3);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--transition-base);
}

.grid-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.grid-item:hover::before {
    transform: scaleX(1);
}

.grid-item:nth-child(4n+1) {
    border-left-color: var(--primary-blue);
}

.grid-item:nth-child(4n+2) {
    border-left-color: var(--primary-purple);
}

.grid-item:nth-child(4n+3) {
    border-left-color: var(--primary-green);
}

.grid-item:nth-child(4n+4) {
    border-left-color: var(--primary-orange);
}

.grid-item h3 {
    color: var(--dark-blue);
    margin-top: 0;
    font-weight: 600;
}

.grid-item h4 {
    color: var(--primary-blue);
    margin-bottom: var(--spacing-sm);
    font-weight: 600;
    font-size: 1.1rem;
}

.grid-item p {
    margin-bottom: var(--spacing-xs);
    color: var(--medium-gray);
    line-height: 1.7;
}

.grid-item strong {
    color: var(--primary-purple);
    font-weight: 600;
    background-color: rgba(139, 92, 246, 0.1);
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-sm);
}

/* Main content styles */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-md);
}

section {
    margin-bottom: var(--spacing-lg);
}

/* Footer styles */
footer {
    background: var(--gradient-1);
    color: var(--white);
    text-align: center;
    padding: calc(var(--spacing-md) / 2);
    margin-top: var(--spacing-lg);
    font-size: 0.95rem;
}

/* Grade overview styles */
.grade-overview {
    margin: var(--spacing-lg) 0;
    padding: var(--spacing-lg);
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border-radius: var(--radius-xl);
    border: 2px solid rgba(74, 144, 226, 0.2);
}

.grade-overview h2 {
    color: var(--dark-blue);
    font-weight: 700;
    margin-top: 0;
}

.grade-overview ul {
    list-style-type: none;
    margin-left: 0;
    padding-left: 0;
}

.grade-overview li {
    padding-left: 1.75rem;
    position: relative;
    margin-bottom: var(--spacing-sm);
    color: var(--medium-gray);
}

.grade-overview li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--primary-green);
    font-weight: bold;
    font-size: 1.2rem;
}

/* Standards grid section styles */
.standards-grid {
    margin-bottom: var(--spacing-lg);
}

/* Domain section styles */
.domain-section {
    margin: var(--spacing-lg) 0;
    padding: var(--spacing-lg);
    padding-top: 1.1rem;
    border: 2px solid rgba(74, 144, 226, 0.2);
    border-radius: var(--radius-xl);
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    transition: all var(--transition-base);
}

.domain-section:hover {
    border-color: var(--primary-blue);
    box-shadow: var(--shadow-md);
}

.domain-section h3 {
    color: var(--dark-blue);
    margin-top: 0;
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 3px solid var(--primary-blue);
    font-weight: 700;
    font-size: 1.5rem;
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Add these styles for the home page */

.hero {
    text-align: center;
    padding: var(--spacing-md) var(--spacing-lg);
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border: 2px solid rgba(74, 144, 226, 0.2);
    margin-bottom: var(--spacing-md);
    border-radius: var(--radius-xl);
}

.hero h2 {
    color: var(--dark-blue);
    font-size: 2.25rem;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: var(--spacing-sm);
}

.intro-text {
    font-size: 1.2rem;
    max-width: 800px;
    margin: 0 auto;
    color: var(--medium-gray);
    line-height: 1.6;
}

.grade-selection {
    padding: 0 0 var(--spacing-md) 0;
}

.grade-selection h2 {
    color: var(--dark-blue);
    font-weight: 700;
    font-size: 2rem;
    margin-bottom: var(--spacing-md);
}

.grade-card {
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border: 2px solid rgba(74, 144, 226, 0.2);
    border-radius: var(--radius-xl);
    padding: var(--spacing-md);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

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

.grade-card h3 {
    color: var(--dark-blue);
    padding: 0 0 var(--spacing-sm) 0;
    margin: 0 0 var(--spacing-md) 0;
    font-weight: 700;
    text-align: center;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 2px solid rgba(74, 144, 226, 0.3);
}

.grade-card ul {
    list-style: none;
    padding: 0;
}

.grade-card li {
    margin: 0;
}

.grade-card a {
    color: var(--dark-blue);
    text-decoration: none;
    padding: var(--spacing-sm);
    display: block;
    transition: all var(--transition-base);
    border-radius: var(--radius-md);
    font-weight: 500;
    position: relative;
    padding-left: 1.5rem;
}

.grade-card a::before {
    content: '→';
    position: absolute;
    left: 0.5rem;
    opacity: 0;
    transition: all var(--transition-base);
    color: var(--primary-blue);
}

.grade-card a:hover {
    background-color: rgba(74, 144, 226, 0.15);
    padding-left: 2rem;
    color: var(--primary-blue);
}

.grade-card a:hover::before {
    opacity: 1;
}

/* Unavailable worksheet links */
.worksheet-link.unavailable {
    color: var(--gray-400, #9CA3AF);
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
    position: relative;
}

.worksheet-link.unavailable::before {
    content: '🔒';
    opacity: 0.5;
    color: var(--gray-400, #9CA3AF);
}

.worksheet-link.unavailable::after {
    content: ' (Coming Soon)';
    font-size: 0.75em;
    color: var(--gray-500, #6B7280);
    font-style: italic;
    margin-left: 0.25rem;
}

.worksheet-link.unavailable:hover {
    background-color: transparent;
    padding-left: 1.5rem;
    color: var(--gray-400, #9CA3AF);
}

/* Night mode adjustments for unavailable links */
body.night-mode .worksheet-link.unavailable {
    color: var(--gray-600, #4B5563);
}

body.night-mode .worksheet-link.unavailable::after {
    color: var(--gray-600, #4B5563);
}

.cta-button {
    display: inline-block;
    padding: 1rem 2rem;
    background: var(--gradient-3);
    color: var(--white);
    text-decoration: none;
    border-radius: var(--radius-lg);
    margin-top: var(--spacing-md);
    transition: all var(--transition-base);
    font-weight: 600;
    box-shadow: var(--shadow-md);
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* For Users Container - Two Column Layout */
.for-users-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin: var(--spacing-md) 0 0 0;
}

.for-parents, .student-section {
    padding: var(--spacing-lg);
    margin: 0;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05) 0%, rgba(74, 144, 226, 0.05) 100%);
    border-radius: var(--radius-xl);
    border-left: 4px solid var(--primary-green);
}

.student-section {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.05) 0%, rgba(236, 72, 153, 0.05) 100%);
    border-left-color: var(--primary-orange);
}

.for-parents h2, .student-section h2 {
    color: var(--dark-blue);
    font-weight: 700;
    font-size: 1.8rem;
    margin-top: 0;
}

.for-parents ul, .student-section ul {
    color: var(--medium-gray);
    line-height: 1.8;
}

.for-parents p, .student-section p {
    color: var(--medium-gray);
    font-size: 1.1rem;
    line-height: 1.7;
}

.for-parents a, .student-section a {
    display: block;
    margin: 0 auto;
    text-align: center;
    width: fit-content;
}

/* Expandable Card Styles */
.grid-item.expanded {
    grid-column: 1 / -1;
    transform: translateY(0);
}

.grid-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--spacing-md);
}

.grid-item-title {
    flex: 1;
}

.expand-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--light-gray);
    border-radius: 50%;
    transition: all var(--transition-base);
    font-size: 1.2rem;
    color: var(--primary-blue);
}

.grid-item:hover .expand-icon {
    background-color: var(--primary-blue);
    color: var(--white);
    transform: rotate(90deg);
}

.grid-item.expanded .expand-icon {
    background-color: var(--primary-blue);
    color: var(--white);
    transform: rotate(180deg);
}

.grid-item-summary {
    margin-top: var(--spacing-sm);
}

.grid-item-details {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height var(--transition-slow), opacity var(--transition-base), margin-top var(--transition-base);
}

.grid-item.expanded .grid-item-details {
    max-height: 2000px;
    opacity: 1;
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-lg);
    border-top: 2px solid var(--light-gray);
}

.grid-item-details h5 {
    color: var(--primary-purple);
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
}

.grid-item-details h5:first-child {
    margin-top: 0;
}

.grid-item-details p {
    color: var(--medium-gray);
    line-height: 1.8;
    margin-bottom: var(--spacing-sm);
}

.grid-item-details ul {
    color: var(--medium-gray);
    line-height: 1.8;
    margin-left: var(--spacing-lg);
    margin-bottom: var(--spacing-sm);
}

.grid-item-details li {
    margin-bottom: var(--spacing-xs);
}

.example-box {
    background-color: rgba(74, 144, 226, 0.05);
    border-left: 4px solid var(--primary-blue);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    margin: var(--spacing-md) 0;
}

.example-box strong {
    display: block;
    color: var(--primary-blue);
    margin-bottom: var(--spacing-xs);
    font-size: 1.05rem;
}

/* Tab Layout Styles */
.tab-container {
    display: flex;
    gap: 1.5rem;
    margin-top: 1rem;
    align-items: stretch;
}

.tab-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 280px;
    max-width: 320px;
}

.tab-button {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tab-button::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary-purple);
    transform: scaleY(0);
    transition: transform var(--transition-base);
}

.tab-button:hover {
    border-color: var(--primary-purple);
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
}

.tab-button:focus {
    outline: 2px solid var(--primary-purple);
    outline-offset: 2px;
}

.tab-button.active {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(139, 92, 246, 0.05) 100%);
    border-color: var(--primary-purple);
    box-shadow: var(--shadow-md);
}

.tab-button.active::before {
    transform: scaleY(1);
}

.tab-button h4 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    transition: color var(--transition-base);
}

.tab-button.active h4 {
    color: var(--primary-purple);
}

.tab-summary {
    margin: 0;
}

.tab-summary p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.tab-summary strong {
    color: var(--primary-blue);
    font-weight: 600;
}

.tab-panels {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.tab-panel {
    display: none;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
    flex: 1;
}

.tab-panel.active {
    display: block;
    animation: fadeIn var(--transition-base);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tab-panel h5 {
    color: var(--primary-purple);
    margin-top: 0;
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.tab-panel p {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 1rem;
}

.tab-panel ul {
    margin: 0.5rem 0 1.5rem 1.5rem;
    padding: 0;
}

.tab-panel li {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

/* Mobile responsive styles for tabs */
@media (max-width: 768px) {
    .tab-container {
        flex-direction: column;
        position: relative;
    }

    .tab-list {
        min-width: 100%;
        max-width: 100%;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
        position: relative;
        padding-bottom: 3px;

        /* Firefox scrollbar styling */
        scrollbar-width: auto;
        scrollbar-color: var(--primary-purple) var(--bg-secondary);
    }

    /* Styled scrollbar for webkit browsers (Chrome, Safari, Edge) */
    .tab-list::-webkit-scrollbar {
        height: 14px;
        width: 14px;
    }

    .tab-list::-webkit-scrollbar-track {
        background: var(--bg-secondary);
        border-radius: 10px;
        margin: 0 4px;
    }

    .tab-list::-webkit-scrollbar-thumb {
        background: var(--primary-purple);
        border-radius: 10px;
        border: 3px solid var(--bg-secondary);
        min-width: 40px;
    }

    .tab-list::-webkit-scrollbar-thumb:hover {
        background: #7c3aed;
        border: 2px solid var(--bg-secondary);
    }

    .tab-list::-webkit-scrollbar-thumb:active {
        background: #6d28d9;
    }

    /* Left gradient fade overlay with chevron */
    /* .tab-container::before {
        content: '←';
        position: absolute;
        left: 0;
        top: 0;
        height: 54px;
        width: 90px;
        background: linear-gradient(to right,
            rgba(139, 92, 246, 0.35) 0%,
            rgba(139, 92, 246, 0.28) 35%,
            rgba(139, 92, 246, 0.18) 55%,
            rgba(139, 92, 246, 0.08) 75%,
            transparent 100%);
        -webkit-mask-image: linear-gradient(to right, black 0%, black 30%, transparent 100%);
        mask-image: linear-gradient(to right, black 0%, black 30%, transparent 100%);
        backdrop-filter: blur(6px) opacity(1);
        -webkit-backdrop-filter: blur(6px) opacity(1);
        border-radius: var(--radius-sm);
        border-top-left-radius: var(--radius-sm);
        border-bottom-left-radius: var(--radius-sm);
        pointer-events: none;
        z-index: 10;
        display: flex;
        align-items: center;
        justify-content: center;
        padding-left: 8px;
        font-size: 3rem;
        font-weight: 900;
        color: var(--primary-orange);
        -webkit-text-stroke: 3px rgba(0, 0, 0, 0.9);
        paint-order: stroke fill;
        text-shadow:
            0 0 16px rgba(255, 255, 255, 1),
            0 0 8px rgba(255, 111, 0, 0.8),
            0 2px 8px rgba(139, 92, 246, 0.5),
            0 4px 12px rgba(0, 0, 0, 0.3);
        filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.2));
        transition: opacity var(--transition-base);
        opacity: 0.85;
    } */

    /* Right gradient fade overlay with chevron */
    /* .tab-container::after {
        content: '→';
        position: absolute;
        right: 0;
        top: 0;
        height: 54px;
        width: 90px;
        background: linear-gradient(to left,
            rgba(139, 92, 246, 0.35) 0%,
            rgba(139, 92, 246, 0.28) 35%,
            rgba(139, 92, 246, 0.18) 55%,
            rgba(139, 92, 246, 0.08) 75%,
            transparent 100%);
        -webkit-mask-image: linear-gradient(to left, black 0%, black 30%, transparent 100%);
        mask-image: linear-gradient(to left, black 0%, black 30%, transparent 100%);
        backdrop-filter: blur(6px) opacity(1);
        -webkit-backdrop-filter: blur(6px) opacity(1);
        border-radius: var(--radius-sm);
        border-top-right-radius: var(--radius-sm);
        border-bottom-right-radius: var(--radius-sm);
        pointer-events: none;
        z-index: 10;
        display: flex;
        align-items: center;
        justify-content: center;
        padding-right: 0px;
        font-size: 3rem;
        font-weight: 900;
        color: var(--primary-orange);
        -webkit-text-stroke: 3px rgba(0, 0, 0, 0.9);
        text-stroke: 3px rgba(0, 0, 0, 0.9);
        paint-order: stroke fill;
        text-shadow:
            0 0 16px rgba(255, 255, 255, 1),
            0 0 8px rgba(255, 111, 0, 0.8),
            0 2px 8px rgba(139, 92, 246, 0.5),
            0 4px 12px rgba(0, 0, 0, 0.3);
        filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.2));
        transition: opacity var(--transition-base);
        opacity: 0.85;
    } */

    /* Night mode adjustments for gradient overlays */
    /* html.night-mode .tab-container::before {
        background: linear-gradient(to right,
            rgba(139, 92, 246, 0.45) 0%,
            rgba(139, 92, 246, 0.35) 35%,
            rgba(139, 92, 246, 0.22) 55%,
            rgba(139, 92, 246, 0.10) 75%,
            transparent 100%);
        -webkit-text-stroke: 3px rgba(0, 0, 0, 0.95);
        text-stroke: 3px rgba(0, 0, 0, 0.95);
        text-shadow:
            0 0 18px rgba(255, 255, 255, 0.8),
            0 0 10px rgba(255, 111, 0, 1),
            0 2px 10px rgba(139, 92, 246, 0.8),
            0 4px 14px rgba(0, 0, 0, 0.6);
        opacity: 0.85;
    } */

    /* html.night-mode .tab-container::after {
        background: linear-gradient(to left,
            rgba(139, 92, 246, 0.45) 0%,
            rgba(139, 92, 246, 0.35) 35%,
            rgba(139, 92, 246, 0.22) 55%,
            rgba(139, 92, 246, 0.10) 75%,
            transparent 100%);
        -webkit-text-stroke: 3px rgba(0, 0, 0, 0.95);
        text-stroke: 3px rgba(0, 0, 0, 0.95);
        text-shadow:
            0 0 18px rgba(255, 255, 255, 0.8),
            0 0 10px rgba(255, 111, 0, 1),
            0 2px 10px rgba(139, 92, 246, 0.8),
            0 4px 14px rgba(0, 0, 0, 0.6);
        opacity: 0.85;
    } */

    /* Hide left gradient when scrolled to start */
    /* .tab-container.at-start::before {
        opacity: 0 !important;
    } */

    /* Hide right gradient when scrolled to end */
    /* .tab-container.at-end::after {
        opacity: 0 !important;
    } */

    .tab-button {
        min-width: 220px;
        flex-shrink: 0;
    }

    /* Disable hover transform on mobile to prevent cutting off active button */
    .tab-button:hover {
        transform: none;
    }

    /* On touch devices, disable hover effects entirely */
    @media (hover: none) {
        .tab-button:hover {
            border-color: var(--border-color);
            box-shadow: none;
        }
    }

    /* Center h2 elements vertically in grade-overview and standards-grid */
    .grade-overview h2,
    .standards-grid h2 {
        text-align: center;
    }

    /* Center h3 elements in domain-section */
    .domain-section h3 {
        text-align: center;
    }

    /* Stack for-users-container on mobile */
    .for-users-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Center h2 titles and buttons on index.html */
    #parents-title,
    #student-title,
    #grade-selection-title {
        text-align: center;
    }

    .for-parents a,
    .student-section a {
        display: block !important;
        margin: 0 auto !important;
        text-align: center;
        max-width: fit-content;
    }

    /* Center grade level links */
    .grade-card ul {
        text-align: center;
    }

    .grade-card li {
        text-align: center;
    }

    /* Shrink hero title to prevent overflow on small screens */
    #hero-title {
        font-size: 1.75rem;
    }

    /* Shrink grade selection title and reduce top margin */
    #grade-selection-title {
        font-size: 1.75rem;
        margin-top: 0.5rem;
    }
}

/* Resources Page - Grade-First Layout with Sidebar */

/* School Section Titles */
.school-section {
    margin: 1.2rem 0;
    padding: 1.2rem;
    border: 2px solid rgba(74, 144, 226, 0.2);
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    transition: all var(--transition-base);
}

.section-title {
    font-size: 1.75rem;
    color: var(--primary-purple);
    margin-bottom: 1rem;
    margin-top: 0;
    font-weight: 600;
}

/* Horizontal Grade Tabs */
.grade-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid var(--border-color);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    padding-top: 6px;
    padding-bottom: 0;
    padding-left: 6px;
    padding-right: 6px;
    margin-bottom: 1.5rem;
}

.grade-tab-button {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-bottom: none;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
    position: relative;
    margin-bottom: -2px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.grade-tab-button:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.05) 0%, rgba(139, 92, 246, 0.02) 100%);
    color: var(--primary-purple);
    border-color: var(--primary-purple);
}

.grade-tab-button.active {
    background: var(--card-bg);
    color: var(--primary-purple);
    border-color: var(--primary-purple);
    border-bottom: 2px solid var(--card-bg);
    font-weight: 600;
}

/* Grade Panels Container */
.grade-panels {
    margin-top: 0;
}

.grade-panel {
    display: none;
}

.grade-panel.active {
    display: block;
    animation: fadeIn var(--transition-base);
}

/* Two-Column Layout: Sidebar + Content */
.content-layout {
    display: flex;
    gap: 2rem;
    margin-top: 1rem;
}

/* Left Sidebar - Vertical Domain Tabs */
.domain-sidebar {
    flex: 0 0 220px;
    min-width: 220px;
}

.domain-tabs {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: sticky;
    top: 20px;
}

.domain-tab-button {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-base);
    text-align: left;
    position: relative;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.domain-tab-button::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary-purple);
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.domain-tab-button:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.05) 0%, rgba(139, 92, 246, 0.02) 100%);
    color: var(--primary-purple);
    border-color: var(--primary-purple);
}

.domain-tab-button:hover::before {
    opacity: 0.3;
}

.domain-tab-button.active {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(139, 92, 246, 0.05) 100%);
    color: var(--primary-purple);
    border-color: var(--primary-purple);
    font-weight: 600;
}

.domain-tab-button.active::before {
    opacity: 1;
}

/* Right Content Area */
.domain-content {
    flex: 1;
    min-width: 0;
}

.domain-panel {
    display: none;
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border: 2px solid rgba(74, 144, 226, 0.2);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.domain-panel.active {
    display: block;
    animation: fadeIn var(--transition-base);
}

/* Make grade-cards inside domain-panel white */
.domain-panel .grade-card {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
}

.domain-panel .grade-card h3 {
    border-bottom: 2px solid var(--border-color);
    font-size: 1.2rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .grade-tabs {
        flex-wrap: nowrap;
        justify-content: flex-start;
    }

    .grade-tab-button {
        min-width: 120px;
        padding: 0.75rem 1.25rem;
        font-size: 0.9rem;
    }

    /* Stack sidebar vertically on mobile */
    .content-layout {
        flex-direction: column;
        gap: 1.5rem;
    }

    .domain-sidebar {
        flex: 1;
        min-width: 100%;
    }

    .domain-tabs {
        flex-direction: row;
        overflow-x: auto;
        position: static;
        gap: 0.5rem;
        padding-bottom: 0.5rem;
    }

    .domain-tab-button {
        min-width: 150px;
        white-space: nowrap;
        text-align: center;
    }

    .domain-tab-button::before {
        width: 100%;
        height: 4px;
        left: 0;
        right: 0;
        top: auto;
        bottom: 0;
        border-radius: 0 0 var(--radius-md) var(--radius-md);
    }
}

/* Related Grades / Footer Sections */
.related-grades {
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border: 2px solid rgba(74, 144, 226, 0.2);
    padding: 1.5rem;
    margin: 1rem 0;
    border-radius: 8px;
    transition: background-color var(--transition-base);
}

.related-grades h2 {
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    text-align: center;
}

.related-grades p,
.related-grades a[href] {
    color: var(--text-secondary);
}

/* Notice/Alert Sections */
.notice {
    background-color: #FEF3C7;
    border-left: 4px solid #F59E0B;
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    border-radius: 4px;
    transition: background-color var(--transition-base), border-color var(--transition-base);
}

.notice p {
    margin: 0;
    color: #92400E;
}

html.night-mode .notice,
body.night-mode .notice {
    background-color: rgba(251, 191, 36, 0.15);
    border-left-color: #FBBF24;
}

html.night-mode .notice p,
body.night-mode .notice p {
    color: #FCD34D;
}

/* About Page Specific Styles */
.about-section {
    color: var(--text-primary);
    transition: background-color var(--transition-base), color var(--transition-base);
}

.about-section h3 {
    color: var(--primary-purple);
}

.about-section p,
.about-section ul li {
    color: var(--text-secondary);
}

.value-card {
    background-color: var(--bg-secondary);
    transition: background-color var(--transition-base);
}

.value-card p {
    color: var(--text-secondary);
}

.team-section {
    background-color: var(--bg-secondary);
    transition: background-color var(--transition-base);
}

.team-section p {
    color: var(--text-secondary);
}

.team-member {
    background-color: var(--card-bg);
    transition: background-color var(--transition-base);
}

.team-member h4 {
    color: var(--text-primary);
}

.team-member p {
    color: var(--text-secondary);
}

.cta-section {
    background-color: var(--bg-secondary);
    transition: background-color var(--transition-base);
}

.cta-section h3 {
    color: var(--text-primary);
}

.cta-section p {
    color: var(--text-secondary);
}

/* For Parents / Student Section */
.for-parents,
.student-section {
    background-color: var(--bg-secondary);
    transition: background-color var(--transition-base);
}

.for-parents h2,
.student-section h2 {
    color: var(--text-primary);
}

.for-parents ul,
.student-section ul {
    color: var(--text-secondary);
}

.for-parents p,
.student-section p {
    color: var(--text-secondary);
}

/* Resources Section */
.resources-section {
    transition: background-color var(--transition-base);
}

.resources-section h2 {
    color: var(--text-primary);
}

.resources-section .intro-text {
    color: var(--text-secondary);
}

/* Override inline styles for night mode compatibility */
html.night-mode .stats-section h3,
html.night-mode .mission-card h4,
html.night-mode .vision-card h4,
html.night-mode .mission-card p,
html.night-mode .vision-card p,
body.night-mode .stats-section h3,
body.night-mode .mission-card h4,
body.night-mode .vision-card h4,
body.night-mode .mission-card p,
body.night-mode .vision-card p {
    color: white !important;
}

/* Ensure proper contrast for specific elements in night mode */
html.night-mode .intro-text,
body.night-mode .intro-text {
    color: var(--text-secondary);
}

html.night-mode .hero,
body.night-mode .hero {
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
    border-color: rgba(74, 144, 226, 0.3);
}

html.night-mode .grade-overview,
body.night-mode .grade-overview {
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
    border-color: rgba(74, 144, 226, 0.3);
}

html.night-mode .grade-overview li,
body.night-mode .grade-overview li {
    color: var(--text-secondary);
}

html.night-mode .domain-section,
body.night-mode .domain-section {
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
    border-color: rgba(74, 144, 226, 0.3);
}

html.night-mode .domain-panel,
body.night-mode .domain-panel {
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%) !important;
    border-color: rgba(74, 144, 226, 0.2) !important;
}

html.night-mode .tab-panel,
body.night-mode .tab-panel {
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%) !important;
    border-color: rgba(74, 144, 226, 0.2) !important;
}

html.night-mode .tab-button,
body.night-mode .tab-button {
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%) !important;
    border-color: rgba(74, 144, 226, 0.2) !important;
}

html.night-mode .about-section,
body.night-mode .about-section {
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.25) 0%, rgba(139, 92, 246, 0.25) 100%) !important;
    border-color: rgba(74, 144, 226, 0.4) !important;
}

html.night-mode .grade-tab-button,
body.night-mode .grade-tab-button {
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%) !important;
    border-color: rgba(74, 144, 226, 0.2) !important;
}

html.night-mode .domain-tab-button,
body.night-mode .domain-tab-button {
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%) !important;
    border-color: rgba(74, 144, 226, 0.2) !important;
}

html.night-mode .grade-card,
body.night-mode .grade-card {
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%) !important;
    border-color: rgba(74, 144, 226, 0.2) !important;
}

html.night-mode .grade-card a,
body.night-mode .grade-card a {
    color: #FFFFFF !important;
}

html.night-mode .grade-card a:hover,
body.night-mode .grade-card a:hover {
    color: var(--primary-blue) !important;
}

html.night-mode .grade-card h3,
body.night-mode .grade-card h3 {
    color: #FFFFFF !important;
}

html.night-mode .section-title,
body.night-mode .section-title {
    color: #FFFFFF !important;
}

/* ===================================
   Accessibility Enhancements
   =================================== */

/* Skip to main content link - Hidden until focused */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-purple);
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    font-weight: 600;
    border-radius: 0 0 4px 0;
    z-index: 9999;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 0;
    outline: 3px solid var(--primary-orange);
    outline-offset: 2px;
}

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

/* Enhanced focus indicators for better keyboard navigation */
a:focus,
button:focus,
[role="button"]:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 3px solid var(--primary-purple);
    outline-offset: 2px;
}

/* Special focus style for grade level headers */
.grade-level-header:focus {
    outline: 3px solid var(--primary-purple);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.1);
}


/* Alternative PDF indicator using text */
.file-type {
    font-size: 0.85em;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Ensure sufficient color contrast for content links only (not navigation or buttons) */
main a:not([class*="btn"]):not(.skip-link),
.for-parents a,
.resources-section a {
    color: var(--primary-purple);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

main a:not([class*="btn"]):not(.skip-link):hover,
.for-parents a:hover,
.resources-section a:hover {
    color: var(--primary-blue);
    text-decoration-thickness: 2px;
}

/* Keep navigation links white */
header a,
nav a {
    color: white;
    text-decoration: none;
}

/* High contrast mode for night mode content links */
html.night-mode main a:not([class*="btn"]):not(.skip-link),
html.night-mode .for-parents a,
html.night-mode .resources-section a,
body.night-mode main a:not([class*="btn"]):not(.skip-link),
body.night-mode .for-parents a,
body.night-mode .resources-section a {
    color: #A78BFA;
}

html.night-mode main a:not([class*="btn"]):not(.skip-link):hover,
html.night-mode .for-parents a:hover,
html.night-mode .resources-section a:hover,
body.night-mode main a:not([class*="btn"]):not(.skip-link):hover,
body.night-mode .for-parents a:hover,
body.night-mode .resources-section a:hover {
    color: #C4B5FD;
}

/* Improved focus for interactive grid items */
.grid-item:focus {
    outline: 3px solid var(--primary-purple);
    outline-offset: 2px;
}

/* Enhanced button focus states */
.night-mode-toggle:focus-within {
    outline: 3px solid var(--primary-orange);
    outline-offset: 2px;
    border-radius: 34px;
}

/* Ensure toggle icons are properly sized and visible */
.toggle-icon {
    font-size: 1.5rem;
    line-height: 1;
    user-select: none;
}

/* Reduced motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-color: rgba(0, 0, 0, 0.3);
    }

    html.night-mode,
    body.night-mode {
        --border-color: rgba(255, 255, 255, 0.3);
    }

    a {
        text-decoration-thickness: 2px;
    }

    button,
    [role="button"] {
        border: 2px solid currentColor;
    }
}

/* ===================================
   Sticky Sidebar Ads
   =================================== */

.ad-sidebar {
    position: fixed;
    top: 140px; /* Below header */
    width: 160px;
    max-height: calc(100vh - 160px);
    overflow: hidden;
    z-index: 5;
}

.ad-sidebar-left {
    left: 40px;
}

.ad-sidebar-right {
    right: 40px;
}

/* Hide ads on tablets and mobile */
@media (max-width: 1400px) {
    .ad-sidebar {
        display: none;
    }
}

/* Night mode styling for ads */
html.night-mode .ad-sidebar,
body.night-mode .ad-sidebar {
    opacity: 0.95;
}

/* Footer Banner Ad */
.footer-ad-container {
    width: 100%;
    max-width: 1200px;
    margin: 2rem auto;
    padding: 1rem;
    text-align: center;
    background-color: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

/* Night mode styling for footer ad */
html.night-mode .footer-ad-container,
body.night-mode .footer-ad-container {
    background-color: var(--card-bg);
    opacity: 0.95;
}