/* Gradebook Component Styles */

/* Force dark color scheme */
.gradebook-section {
    color-scheme: dark !important;
    display: none;
    padding: 2rem;
    background: rgba(0, 0, 0, 0.9);
    border: 4px solid var(--neon-yellow);
    border-radius: 20px;
    margin: 2rem auto;
    max-width: 1200px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 30px rgba(255, 238, 0, 0.3);
}

.gradebook-section.active {
    display: block;
    animation: fadeIn 0.5s ease-out;
}

.gradebook-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, var(--neon-yellow) 0%, transparent 70%);
    opacity: 0.3;
    animation: float 8s ease-in-out infinite;
}

.gradebook-header {
    text-align: center;
    margin-bottom: 3rem;
    position: relative;
}

.gradebook-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 3rem;
    color: var(--deep-ink);
    text-shadow: 
        3px 3px 0 var(--hot-pink),
        6px 6px 0 var(--electric-cyan);
    margin: 0;
    animation: wiggle 2s ease-in-out infinite;
}

.gradebook-subtitle {
    font-family: 'Comic Neue', cursive;
    font-size: 1.2rem;
    color: var(--deep-ink);
    margin-top: 1rem;
}

.progress-overview {
    background: rgba(0, 0, 0, 0.8);
    border: 3px solid var(--deep-ink);
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 5px 5px 0 var(--electric-cyan);
}

.progress-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: rgba(0, 0, 0, 0.8);
    border: 3px solid var(--hot-pink);
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
    transition: all 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px) rotate(2deg);
    box-shadow: 0 8px 0 var(--deep-ink);
}

.stat-value {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 2rem;
    color: var(--deep-ink);
}

.stat-label {
    font-family: 'Comic Neue', cursive;
    font-size: 0.9rem;
    color: var(--deep-ink);
    font-weight: 700;
}

.overall-progress {
    margin-top: 1rem;
}

.progress-bar-container {
    background: rgba(0, 0, 0, 0.8);
    border: 3px solid var(--deep-ink);
    border-radius: 50px;
    height: 40px;
    position: relative;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, 
        var(--hot-pink) 0%, 
        var(--neon-yellow) 50%, 
        var(--electric-cyan) 100%);
    border-radius: 50px;
    transition: width 0.5s ease-out;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 1rem;
}

.progress-percentage {
    font-family: 'Bebas Neue', sans-serif;
    color: var(--deep-ink);
    font-size: 1.2rem;
    text-shadow: 1px 1px 0 white;
}

.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.module-card {
    background: rgba(0, 0, 0, 0.8);
    border: 4px solid var(--deep-ink);
    border-radius: 15px;
    overflow: hidden;
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
    box-shadow: 4px 4px 0 var(--hot-pink);
}

.module-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 
        8px 8px 0 var(--hot-pink),
        8px 8px 0 4px var(--deep-ink);
}

.module-card.completed:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 10px 10px 0 #2E7D32 !important;
}

.module-card.completed {
    background: linear-gradient(135deg, #E8FFE8 0%, #D4FFD4 100%);
    border: 4px solid #4CAF50 !important;
    box-shadow: 6px 6px 0 #2E7D32 !important;
}

.module-card.completed .module-header {
    background: linear-gradient(45deg, #4CAF50, #8BC34A);
}

/* Override for gradebook section */
.gradebook-section .module-card.completed {
    border: 4px solid #4CAF50 !important;
    box-shadow: 6px 6px 0 #2E7D32 !important;
}

.module-card.locked {
    opacity: 0.7;
    cursor: not-allowed;
}

.module-card.locked::after {
    content: '🔒';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    filter: drop-shadow(0 0 10px rgba(0,0,0,0.3));
}

.module-header {
    background: linear-gradient(45deg, var(--electric-cyan), var(--hot-pink));
    padding: 1rem;
    border-bottom: 3px solid var(--deep-ink);
}

.module-number {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 0.9rem;
    color: white;
    text-shadow: 2px 2px 0 var(--deep-ink);
}

.module-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.5rem;
    color: white;
    text-shadow: 2px 2px 0 var(--deep-ink);
    margin: 0;
}

.module-body {
    padding: 1.5rem;
}

.module-description {
    font-family: 'Comic Neue', cursive;
    color: var(--deep-ink);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.module-objectives {
    margin-top: 1rem;
}

.objectives-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--deep-ink);
    margin-bottom: 0.5rem;
}

.objective-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.objective-item {
    font-family: 'Comic Neue', cursive;
    color: var(--deep-ink);
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.objective-item::before {
    content: '✨';
    position: absolute;
    left: 0;
}

.objective-item.completed::before {
    content: '✅';
}

.module-footer {
    padding: 1rem 1.5rem;
    border-top: 2px dashed var(--deep-ink);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.module-score {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    color: var(--hot-pink);
}

.module-status {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--neon-yellow);
    border: 2px solid var(--deep-ink);
    border-radius: 20px;
    font-family: 'Comic Neue', cursive;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
}

.module-status.completed {
    background: var(--electric-cyan);
}

.module-status.in-progress {
    background: var(--hot-pink);
    color: white;
}

/* Module Content View */
.module-content-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(10px);
    z-index: 10001;
    overflow-y: auto;
}

.module-content-modal.active {
    display: block;
}

.module-content-container {
    background: rgba(0, 0, 0, 0.8);
    max-width: 800px;
    margin: 2rem auto;
    border: 4px solid var(--deep-ink);
    border-radius: 20px;
    overflow: hidden;
    animation: slideUp 0.4s ease-out;
}

.module-content-header {
    background: linear-gradient(135deg, var(--hot-pink), var(--electric-cyan));
    padding: 2rem;
    border-bottom: 4px solid var(--deep-ink);
    position: relative;
}

.module-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.8);
    border: 3px solid var(--deep-ink);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.5rem;
    transition: all 0.2s;
}

.module-close-btn:hover {
    transform: rotate(90deg) scale(1.1);
    background: var(--neon-yellow);
}

.module-content-body {
    padding: 2rem;
}

.module-progress-tracker {
    background: linear-gradient(45deg, var(--neon-yellow), var(--electric-cyan));
    border: 3px solid var(--deep-ink);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 2rem;
    text-align: center;
}

.reading-progress {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--deep-ink);
}

.lesson-section {
    margin-bottom: 2rem;
    background: rgba(0, 0, 0, 0.8);
    border: 3px solid var(--deep-ink);
    border-radius: 10px;
    padding: 1.5rem;
    position: relative;
}

.lesson-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.lesson-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.8rem;
    color: var(--deep-ink);
    margin: 0;
}

.lesson-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

.lesson-status {
    font-family: 'Comic Neue', cursive;
    font-weight: 900;
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.8);
    border: 3px solid var(--neon-yellow);
    border-radius: 20px;
    font-size: 1.1rem;
    color: var(--neon-yellow);
}

.lesson-complete-btn {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(45deg, var(--hot-pink), var(--neon-yellow));
    border: 3px solid var(--deep-ink);
    border-radius: 10px;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.lesson-complete-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 0 var(--deep-ink);
}

.quiz-lock-message {
    background: var(--hot-pink);
    color: white;
    padding: 1.5rem;
    border-radius: 10px;
    font-family: 'Comic Neue', cursive;
    font-size: 1.1rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 1rem;
}

.lesson-content {
    font-family: 'Comic Neue', cursive;
    line-height: 1.8;
    color: var(--deep-ink);
}

.quiz-section {
    background: rgba(0, 0, 0, 0.8);
    border: 3px solid var(--deep-ink);
    border-radius: 15px;
    padding: 1.5rem;
    margin-top: 2rem;
}

.quiz-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.5rem;
    color: var(--deep-ink);
    margin-bottom: 1rem;
}

.quiz-question {
    margin-bottom: 1.5rem;
}

.question-text {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    color: var(--deep-ink);
    margin-bottom: 0.75rem;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.quiz-option {
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.8);
    border: 3px solid var(--deep-ink);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Comic Neue', cursive;
}

.quiz-option:hover {
    background: var(--neon-yellow);
    transform: translateX(5px);
}

.quiz-option.selected {
    background: var(--electric-cyan);
    box-shadow: 0 4px 0 var(--deep-ink);
}

.quiz-option.correct {
    background: #90EE90;
    animation: bounce 0.5s;
}

.quiz-option.incorrect {
    background: var(--hot-pink);
    color: white;
    animation: shake 0.3s;
}

.quiz-submit {
    margin-top: 1.5rem;
    padding: 1rem 2rem;
    background: linear-gradient(45deg, var(--hot-pink), var(--neon-yellow));
    border: 3px solid var(--deep-ink);
    border-radius: 10px;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.2rem;
    color: var(--deep-ink);
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.quiz-submit:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 0 var(--deep-ink);
}

.quiz-results {
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.8);
    border: 3px solid var(--deep-ink);
    border-radius: 10px;
    text-align: center;
}

.quiz-score {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 2rem;
    color: var(--hot-pink);
}

.quiz-message {
    font-family: 'Comic Neue', cursive;
    color: var(--deep-ink);
    margin-top: 0.5rem;
}

/* Achievements */
.achievements-section {
    background: linear-gradient(45deg, #FFE5F1, var(--cream-pop));
    border: 3px solid var(--deep-ink);
    border-radius: 15px;
    padding: 1.5rem;
    margin-top: 2rem;
    margin-bottom: 2.5rem;
    box-shadow: 5px 5px 0 var(--neon-yellow);
}

.achievements-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.8rem;
    color: var(--deep-ink);
    text-align: center;
    margin-bottom: 1rem;
}

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 1rem;
}

.achievement-badge {
    width: 100px !important;
    height: 100px !important;
    position: relative;
    perspective: 1000px;
    background: transparent !important;
    border: none !important;
}

/* Achievement Image Container - 3D token with depth */
.achievement-image-container {
    --coin-depth: 20px;
    width: 100px;
    height: 100px;
    position: absolute;
    top: 0;
    left: 0;
    transform-style: preserve-3d;
    transform-origin: 50px 50px;
    transition: transform 2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

/* Base for both faces */
.achievement-image {
    position: absolute;
    top: -3px;
    left: -3px;
    width: 106px;
    height: 106px;
    object-fit: cover;
    border-radius: 50%;
    display: block;
    border: 3px solid var(--deep-ink);
    backface-visibility: hidden;
    transform-origin: center;
}

/* Front face of the token */
.achievement-front {
    transform: translateZ(calc(var(--coin-depth) / 2));
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

/* Back face of the token */
.achievement-back {
    transform: translateZ(calc(var(--coin-depth) / -2)) rotateY(180deg);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

/* Coin edge */
.achievement-edge {
    position: absolute;
    top: -3px;
    left: -3px;
    width: 106px;
    height: 106px;
    border-radius: 50%;
    background: #777;
    border: 3px solid var(--deep-ink);
    transform: translateZ(0);
}

/* 3D Wiggle Animation */
@keyframes achievementWiggle {
    0% {
        transform: rotateY(0deg);
    }
    25% {
        transform: rotateY(-30deg);
    }
    50% {
        transform: rotateY(0deg);
    }
    75% {
        transform: rotateY(30deg);
    }
    100% {
        transform: rotateY(0deg);
    }
}

/* Apply wiggle on hover for earned achievements */
.achievement-badge.earned:hover .achievement-image-container {
    animation: achievementWiggle 0.8s ease-in-out;
}

/* Locked achievement badges */
.achievement-badge.locked .achievement-image {
    filter: grayscale(1);
    opacity: 0.6;
}

.achievement-badge.earned {
    background: transparent !important;
}

.achievement-badge:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.achievement-tooltip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--deep-ink);
    color: white;
    padding: 0.5rem;
    border-radius: 5px;
    font-family: 'Comic Neue', cursive;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.achievement-badge:hover .achievement-tooltip {
    opacity: 1;
}

/* Promotion Celebration */
.promotion-celebration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, 
        rgba(76, 175, 80, 0.9), 
        rgba(139, 195, 74, 0.9), 
        rgba(156, 204, 101, 0.9));
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 20000;
    animation: rainbow 3s linear infinite;
}

.promotion-celebration.active {
    display: flex;
}

.celebration-content {
    background: rgba(0, 0, 0, 0.8);
    border: 5px solid var(--deep-ink);
    border-radius: 30px;
    padding: 3rem;
    text-align: center;
    max-width: 500px;
    animation: bounce 1s ease-in-out infinite;
}

.celebration-emoji {
    font-size: 5rem;
    animation: spin 1s linear infinite;
}

.celebration-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 3rem;
    color: var(--deep-ink);
    text-shadow: 3px 3px 0 #4CAF50;
    margin: 1rem 0;
}

.celebration-message {
    font-family: 'Comic Neue', cursive;
    font-size: 1.2rem;
    color: var(--deep-ink);
    margin-bottom: 2rem;
}

.celebration-button {
    padding: 1rem 2rem;
    background: linear-gradient(45deg, #4CAF50, #8BC34A);
    border: 3px solid var(--deep-ink);
    border-radius: 20px;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.5rem;
    color: var(--deep-ink);
    cursor: pointer;
    transition: all 0.2s;
}

.celebration-button:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 0 var(--deep-ink);
}

/* Dark Theme for Gradebook - Matching Report Card */
/* Force ALL elements to have dark backgrounds */
.gradebook-section,
.gradebook-section *,
.gradebook-section div,
.gradebook-section section,
.gradebook-section article {
    color: white !important;
    background-color: transparent !important;
}

.gradebook-section {
    background: rgba(0, 0, 0, 0.9) !important;
    border-color: var(--neon-yellow) !important;
    box-shadow: 0 0 30px rgba(255, 238, 0, 0.3) !important;
}

.progress-overview,
.module-card,
.quiz-container,
.quiz-results,
.module-progress-bar {
    background: rgba(0, 0, 0, 0.8) !important;
    border-color: var(--electric-cyan) !important;
    box-shadow: 0 0 20px rgba(0, 229, 238, 0.3) !important;
}

.stat-card {
    background: rgba(0, 0, 0, 0.8) !important;
    border-color: var(--hot-pink) !important;
    box-shadow: 0 0 15px rgba(255, 20, 147, 0.3) !important;
}

.achievements-section {
    background: rgba(0, 0, 0, 0.7) !important;
    border-color: var(--neon-yellow) !important;
    box-shadow: 0 0 20px rgba(255, 238, 0, 0.3) !important;
}

.module-header {
    background: rgba(255, 20, 147, 0.3) !important;
    border-color: var(--hot-pink) !important;
}

/* Override ALL white and light backgrounds with higher specificity */
.gradebook-section .gradebook-container,
.gradebook-section .progress-overview,
.gradebook-section .stat-card,
.gradebook-section .modules-section,
.gradebook-section .module-card,
.gradebook-section .module-content,
.gradebook-section .module-progress-tracker,
.gradebook-section .quiz-section,
.gradebook-section .quiz-container,
.gradebook-section .question-card,
.gradebook-section .answer-option,
.gradebook-section .quiz-results,
.gradebook-section .achievements-section,
.gradebook-section .celebration-modal,
.gradebook-section [style*="background: white"],
.gradebook-section [style*="background:#fff"],
.gradebook-section [style*="background:#FFF"],
.gradebook-section [style*="background: #fff"],
.gradebook-section [style*="background: #FFF"] {
    background: rgba(0, 0, 0, 0.8) !important;
}

/* Progress bar specific overrides */
.module-progress-bar,
.module-progress-fill {
    background: rgba(0, 0, 0, 0.6) !important;
}

.module-progress-fill {
    background: linear-gradient(90deg, rgba(255, 20, 147, 0.8), rgba(0, 229, 238, 0.8)) !important;
}

.answer-option {
    background: rgba(255, 238, 0, 0.1) !important;
    border-color: var(--neon-yellow) !important;
    color: white !important;
}

.answer-option:hover {
    background: rgba(255, 238, 0, 0.3) !important;
}

.answer-option.selected {
    background: rgba(255, 238, 0, 0.4) !important;
    border-color: var(--toxic-lime) !important;
}

.module-progress-tracker {
    background: rgba(0, 0, 0, 0.8) !important;
    border-color: var(--neon-yellow) !important;
}

.stat-value,
.gradebook-subtitle,
.objective-item {
    color: var(--neon-yellow) !important;
}

.module-description {
    color: var(--electric-cyan) !important;
}

/* Celebration modal dark theme */
.celebration-modal {
    background: rgba(0, 0, 0, 0.9) !important;
    border-color: var(--toxic-lime) !important;
}

.celebration-title,
.celebration-message {
    color: var(--neon-yellow) !important;
    text-shadow: 2px 2px 0 rgba(255, 20, 147, 0.5) !important;
}

.celebration-button {
    background: linear-gradient(45deg, rgba(76, 175, 80, 0.8), rgba(139, 195, 74, 0.8)) !important;
    color: white !important;
}

/* Force ALL text to be white in gradebook */
.gradebook-section h1,
.gradebook-section h2,
.gradebook-section h3,
.gradebook-section p,
.gradebook-section span,
.gradebook-section div,
.gradebook-section label,
.gradebook-section button {
    color: white !important;
}

/* Specific colored text overrides */
.gradebook-title {
    color: var(--neon-yellow) !important;
}

.stat-value {
    color: var(--toxic-lime) !important;
}

.module-title {
    color: var(--hot-pink) !important;
}

.quiz-score {
    color: var(--electric-cyan) !important;
}

/* ULTIMATE DARK THEME OVERRIDE - NUCLEAR OPTION */
.gradebook-section * {
    background-color: transparent !important;
    background-image: none !important;
}

.gradebook-section {
    background: rgba(0, 0, 0, 0.95) !important;
}

.gradebook-section > div,
.gradebook-section section,
.gradebook-section article,
.gradebook-section .progress-overview,
.gradebook-section .stat-card,
.gradebook-section .module-card,
.gradebook-section .quiz-container,
.gradebook-section .achievements-section {
    background: rgba(0, 0, 0, 0.85) !important;
}

/* Animations */
@keyframes wiggle {
    0%, 100% { transform: rotate(-3deg); }
    50% { transform: rotate(3deg); }
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(180deg); }
}

@keyframes sparkle {
    0%, 100% { box-shadow: 0 0 10px rgba(255, 238, 0, 0.5); }
    50% { box-shadow: 0 0 30px rgba(255, 238, 0, 0.8); }
}

@keyframes rainbow {
    0% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}

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