/* app.css - Hauptstyles für MBI SchoolTool */

:root {
    --xp-color: #9c27b0;
    --credits-color: #ffc107;
    --bronze-color: #cd7f32;
    --silver-color: #c0c0c0;
    --gold-color: #ffd700;
}

body { background-color: #f4f6f9; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }

.login-container { max-width: 400px; margin-top: 100px; }

/* Status Panel */
.status-panel {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    padding: 20px;
    color: white;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.status-panel .student-name {
    font-family: 'Fredoka One', cursive;
    font-size: 1.5rem;
    margin-bottom: 15px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    background: rgba(255,255,255,0.15);
    padding: 8px 12px;
    border-radius: 8px;
}

.status-value {
    font-family: 'Fredoka One', cursive;
    font-size: 1.2rem;
}

.xp-icon { color: #e1bee7; }
.credits-icon { color: #ffeb3b; }

/* Progress bars */
.topic-progress {
    display: flex;
    gap: 4px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.progress-slot {
    width: 28px;
    height: 28px;
    border-radius: 5px;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    cursor: pointer;
    transition: all 0.3s;
}

.progress-slot:hover { transform: scale(1.1); }
.progress-slot.level1 { background: #2196f3; }
.progress-slot.level2 {
    background: linear-gradient(135deg, #2196f3, #90caf9);
    box-shadow: 0 0 8px rgba(192,192,192,0.8);
}
.progress-slot.level3 {
    background: linear-gradient(135deg, #ffd700, #ffeb3b);
    box-shadow: 0 0 12px rgba(255,215,0,0.8);
    animation: goldGlow 2s ease-in-out infinite;
}

@keyframes goldGlow {
    0%, 100% { box-shadow: 0 0 8px rgba(255,215,0,0.6); }
    50% { box-shadow: 0 0 16px rgba(255,215,0,1); }
}

/* Free Flight Rocket Button */
.progress-slot.rocket-btn {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
    animation: rocketPulse 2s infinite;
}

.progress-slot.rocket-btn:hover {
    transform: scale(1.15);
}

.progress-slot.rocket-btn.disabled {
    background: #aaa;
    animation: none;
    opacity: 0.6;
}

.progress-slot.rocket-btn.hidden {
    display: none;
}

.progress-slot.rocket-btn.active {
    background: linear-gradient(135deg, #00b894, #00cec9);
    animation: rocketActive 1.5s infinite;
}

/* Free Flight Light Button (Plane Icon) */
.progress-slot.rocket-btn.light {
    background: linear-gradient(135deg, #6ca8d8, #4a89c4);
    animation: rocketPulseLight 2.5s infinite;
}

.progress-slot.rocket-btn.light.active {
    background: linear-gradient(135deg, #5fb3a1, #2e8b74);
    animation: rocketActive 1.5s infinite;
}

@keyframes rocketPulseLight {
    0%, 100% { box-shadow: 0 0 6px rgba(74, 137, 196, 0.5); }
    50% { box-shadow: 0 0 12px rgba(74, 137, 196, 0.85); }
}

@keyframes rocketPulse {
    0%, 100% { box-shadow: 0 0 8px rgba(238, 90, 36, 0.6); }
    50% { box-shadow: 0 0 16px rgba(238, 90, 36, 1); }
}

@keyframes rocketActive {
    0%, 100% { box-shadow: 0 0 8px rgba(0, 184, 148, 0.6); }
    50% { box-shadow: 0 0 16px rgba(0, 184, 148, 1); }
}

/* Free Flight Banner */
.free-flight-banner {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border: 1px solid #64b5f6;
    border-radius: 8px;
}

/* Free Flight Celebration Icon */
.free-flight-unlock-icon {
    width: 120px;
    height: 120px;
    margin: 0 auto;
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    animation: rocketBounce 1s ease-in-out;
    box-shadow: 0 8px 32px rgba(238, 90, 36, 0.4);
}

@keyframes rocketBounce {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

/* Badges */
.badges-container { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.badge-item {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
    font-size: 0.9rem;
}
.badge-item:hover { transform: scale(1.2); }

/* Topic & Goals */
.topic-header {
    background-color: #e8eaf6;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 5px solid #3f51b5;
    cursor: pointer;
    transition: background-color 0.2s;
}
.topic-header:hover { background-color: #c5cae9; }

.goal-row {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    position: relative;
    transition: all 0.3s ease;
}

/* Goal Status Styles */
.goal-row.goal-level1-done {
    border: 2px solid #4caf50;
}

.goal-row.goal-cloze-done {
    border: 2px solid #4caf50;
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.3);
}

.goal-row.goal-all-done {
    border: 2px solid #4caf50;
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.3);
}

.goal-status-icon {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    z-index: 10;
}

.goal-status-icon.checkmark {
    background: #4caf50;
    color: white;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.5);
}

.goal-status-icon.crown {
    background: linear-gradient(135deg, #ffd700, #ffeb3b);
    color: #856404;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.6);
    animation: crownPulse 2s ease-in-out infinite;
}

@keyframes crownPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.goal-title { font-weight: bold; color: #555; margin-bottom: 15px; display: block; }

/* Task Cards */
.task-card {
    width: 130px;
    height: 110px;
    border: 2px solid #ddd;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    background: white;
    padding: 8px;
}
.task-card:hover:not(.locked) { transform: translateY(-5px); box-shadow: 0 5px 15px rgba(0,0,0,0.1); }
.task-card.card-instruction { background-color: #e3f2fd; border-color: #90caf9; color: #1565c0; }
.task-card.status-done { background-color: #e8f5e9; border-color: #a5d6a7; color: #2e7d32; }
.task-card.status-submitted { background-color: #fff3cd; border-color: #ffecb5; color: #856404; }
.task-card.status-validating { background-color: #e1f5fe; border-color: #4fc3f7; color: #0277bd; }
.task-card.status-improve { background-color: #f8d7da; border-color: #f5c6cb; color: #721c24; }
.task-card.locked { background-color: #f8f9fa; border-color: #eee; color: #aaa; cursor: not-allowed; }
.task-card.status-skipped { background-color: #f3e5f5; border-color: #ce93d8; color: #7b1fa2; }

/* Cloze Button (Orange Card) */
.task-card.card-cloze {
    background: linear-gradient(135deg, #ff9800, #f57c00);
    border-color: #e65100;
    color: white;
}
.task-card.card-cloze:hover:not(.locked):not(.status-done) {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(255, 152, 0, 0.4);
}
.task-card.card-cloze.status-done {
    background: linear-gradient(135deg, #4caf50, #388e3c);
    border-color: #2e7d32;
    color: white;
}
.task-card.card-cloze.locked {
    background: linear-gradient(135deg, #bdbdbd, #9e9e9e);
    border-color: #757575;
    color: rgba(255,255,255,0.7);
    cursor: not-allowed;
}

/* Crowd Control Locked Tasks */
.task-card.crowd-locked {
    background-color: #fff8e1;
    border-color: #ffcc80;
    color: #e65100;
}
.task-card.crowd-locked:hover {
    cursor: pointer;
    transform: none;
    box-shadow: none;
}

/* Level Badges with Emojis */
.level-badge {
    position: absolute;
    top: 4px;
    right: 2px;
    font-size: 0.9rem;
    padding: 2px 6px;
    border-radius: 6px;
    line-height: 1;
    filter: grayscale(100%);
}

.icon-large { font-size: 1.4rem; margin-bottom: 5px; }

/* Logbook Row */
.logbook-row {
    background: linear-gradient(135deg, #fff3e0, #ffe0b2);
    border: none;
    border-radius: 5px;
    padding: 15px 20px;
    margin-top: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.logbook-row .logbook-icon {
    font-size: 1.8rem;
    color: #e65100;
}

.logbook-row .logbook-text {
    flex: 1;
    color: #e65100;
    font-weight: 500;
}

.logbook-row .btn-logbook {
    background: linear-gradient(135deg, #ff9800, #f57c00);
    border: none;
    color: white;
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: bold;
    transition: all 0.3s;
}

.logbook-row .btn-logbook:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.4);
}

/* Completed Logbook Entry */
.logbook-entry {
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    border: none;
    border-radius: 5px;
    padding: 15px 20px;
    margin-top: 15px;
}

.logbook-entry-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    color: #2e7d32;
    font-weight: bold;
}

.logbook-entry-text {
    padding: 12px 15px;
    border-radius: 8px;
    font-size: 1rem;
    line-height: 1.6;
    color: #333;
}

/* Code-Blöcke in Cloze/Logbuch */
.cloze-code-block {
    border: 1px solid black;
    font-weight: bold;
    color: #000000;
    padding: 12px 16px;
    border-radius: 6px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.95rem;
    line-height: 1.5;
    overflow-x: auto;
    margin: 12px 0;
    white-space: pre-wrap;
}

/* Logbuch-Eintrag Titel */
.logbook-entry-title {
    margin: 0 0 10px 0;
    font-size: 1.1rem;
}

/* Overlays */
.overlay-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.overlay-content {
    background: white;
    border-radius: 20px;
    padding: 30px 40px;
    text-align: center;
    max-width: 500px;
    width: 100%;
    position: relative;
    animation: popIn 0.4s ease-out;
}

.overlay-content.large {
    max-width: 800px;
    max-height: 85vh;
    overflow-y: auto;
    text-align: left;
}

@keyframes popIn {
    0% { transform: scale(0.7); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Confetti */
.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    z-index: 10000;
    pointer-events: none;
}

/* Flying Reward Animation */
.flying-reward {
    position: fixed;
    font-size: 1.4rem;
    font-weight: bold;
    z-index: 10001;
    pointer-events: none;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Cloze */
.cloze-input {
    border: 2px dashed #3f51b5;
    border-radius: 5px;
    padding: 4px 10px;
    margin: 0 4px;
    min-width: 80px;
    text-align: center;
    font-size: inherit;
}
.cloze-input:focus { outline: none; border-color: #1a237e; }
.cloze-input.correct { border-color: #4caf50; background: #e8f5e9; border-style: solid; }
.cloze-input.incorrect { border-color: #f44336; background: #ffebee; border-style: solid; }

/* Word Pool Container */
#clozeWordPool {
    background: #f5f5f5;
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
}

.word-pool-label {
    font-weight: 600;
    color: #666;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.word-pool-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.word-chip {
    background: #fff;
    border: 2px solid #3f51b5;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 1rem;
    color: #3f51b5;
    cursor: default;
    user-select: all;
}

.word-chip:hover {
    background: #e8eaf6;
}

.text-purple { color: #9c27b0; }

/* Queue Status */
#queueStatus {
    border-top: 3px solid #ffc107;
}

/* Close button for cloze */
.cloze-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #f5f5f5;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.cloze-close-btn:hover {
    background: #e0e0e0;
    transform: scale(1.1);
}

/* Details/Summary Blocks (Collapsible Content) */
.content-details {
    margin: 1rem 0;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: #f8f9fa;
    overflow: hidden;
}

.content-details summary {
    padding: 12px 16px;
    cursor: pointer;
    font-weight: 500;
    background: #fff;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.content-details summary::-webkit-details-marker {
    display: none;
}

.content-details summary::before {
    content: '\f054';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.75rem;
    transition: transform 0.2s;
}

.content-details[open] summary::before {
    transform: rotate(90deg);
}

.content-details[open] summary {
    border-bottom: 1px solid #dee2e6;
}

.content-details .details-content {
    padding: 16px;
}

.content-details .details-content > :first-child {
    margin-top: 0;
}

.content-details .details-content > :last-child {
    margin-bottom: 0;
}

/* ==================== TTS (Text-to-Speech) ==================== */

/* TTS Segment (clickable text) */
.tts-segment {
    cursor: pointer;
    border-radius: 4px;
    transition: box-shadow 0.2s;
    position: relative;
    display: inline-block;
    z-index:1000;
}

/* shadow to help reading */
.tts-segment:hover {
  padding: 5px 10px;
  margin: -5px -10px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.9), 0 0 0 9999px rgba(0, 0, 0, 0.2);
}

/* Hover Tooltip */
.tts-segment::after {
    content: 'Vorlesen';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #222;
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 16px;
    white-space: nowrap;
    z-index: 100;
    margin-bottom: 5px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    pointer-events: none;
}

.tts-segment:hover::after {
    opacity: 100;
    visibility: visible;
    transition: opacity 0.2s, visibility 0.2s;
}

.tts-segment.reading {
  z-index: 1010;
  padding: 5px 10px;
  margin: -5px -10px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.9), 0 0 0 9999px rgba(0, 0, 0, 0.7);
}

/*
.tts-segment:focus {
  padding: 5px 10px;
  margin: -5px -10px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.9), 0 0 0 9999px rgba(0, 0, 0, 0.7);
}
*/

/* Reading Tooltip - click to stop! */
.tts-segment.reading::after {
    content: 'Klicken zum stoppen';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    color: black;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 16px;
    white-space: nowrap;
    z-index: 1011;
    margin-bottom: 5px;
    opacity: 100;
    visibility: visible;
    pointer-events: none;
}

/* Inline progress bar - uses --progress CSS variable set by JS */
.tts-segment.reading::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  height: 4px;
  background-color: #007bff;
  border-radius: 0 0 4px 4px;
  width: var(--progress, 0%);
  transition: width 0.1s linear;
}

/* Loading animation for generating state */
@keyframes tts-loading-stripes {
  from { background-position: 1rem 0; }
  to { background-position: 0 0; }
}

/* Generating state: animated striped progress bar */
.tts-segment.reading.generating::before {
  width: 100% !important;
  background-color: #6c757d;
  background-image: linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.15) 25%,
    transparent 25%,
    transparent 50%,
    rgba(255, 255, 255, 0.15) 50%,
    rgba(255, 255, 255, 0.15) 75%,
    transparent 75%,
    transparent
  );
  background-size: 1rem 1rem;
  animation: tts-loading-stripes 1s linear infinite;
}

/* Tooltip text while loading */
.tts-segment.reading.generating::after {
  content: 'Laden...';
}



/*

.tts-segment::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #333;
    margin-bottom: 0;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.2s, visibility 0.2s;
    pointer-events: none;
}
*/


/* TTS Overlay */
.tts-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    padding: 20px;
}

.tts-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Spotlight (highlighted text container) */
.tts-spotlight {
    background: white;
    padding: 40px 50px;
    border-radius: 16px;
    max-width: 700px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s;
}

.tts-overlay.active .tts-spotlight {
    transform: scale(1);
}

/* Text being read */
.tts-text {
    font-size: 1.5rem;
    line-height: 1.8;
    color: #333;
    text-align: left;
}

/* Inline code in spotlight */
.tts-text code.inline-code,
.tts-text code {
    background: #e9ecef;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.95em;
}

/* Progress Bar */
.tts-progress-bar {
    height: 4px;
    background: #e9ecef;
    border-radius: 2px;
    margin-top: 30px;
    overflow: hidden;
}

.tts-progress {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    width: 0%;
    transition: width 0.1s linear;
}

/* Controls */
.tts-controls {
    margin-top: 20px;
}

.tts-close {
    background: #f8f9fa;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tts-close:hover {
    background: #e9ecef;
    color: #333;
    transform: scale(1.1);
}

/* Loading State */
.tts-loading .tts-text::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #667eea;
    border-top-color: transparent;
    border-radius: 50%;
    animation: tts-spin 1s linear infinite;
    margin-left: 10px;
    vertical-align: middle;
}

@keyframes tts-spin {
    to { transform: rotate(360deg); }
}

/* Error State */
.tts-error {
    padding: 20px;
    text-align: center;
}

.tts-error p {
    margin: 10px 0;
    color: #666;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .tts-spotlight {
        padding: 25px 20px;
        margin: 10px;
    }

    .tts-text {
        font-size: 1.2rem;
        line-height: 1.6;
    }

    .tts-segment::after,
    .tts-segment::before {
        display: none;
    }
}

/* ==================== Lesson Calendar ==================== */

.lesson-calendar {
    table-layout: fixed !important;
    border-collapse: collapse;
    width: 100%;
}

.lesson-calendar th,
.lesson-calendar td {
    vertical-align: middle;
}

/* Fixed column widths via CSS */
.lesson-calendar th:first-child,
.lesson-calendar td:first-child {
    width: 70px !important;
    min-width: 70px;
    max-width: 70px;
}

/* Day columns: equal widths */
.lesson-calendar th:not(:first-child),
.lesson-calendar td:not(:first-child) {
    width: calc((100% - 70px) / 5);
}

.lesson-slot {
    height: 50px;
    cursor: pointer;
    transition: background-color 0.2s;
    position: relative;
    vertical-align: top;
    padding: 2px !important;
    overflow: visible; /* Allow multi-period blocks to overflow */
    box-sizing: border-box;
}

.lesson-slot:hover:not(.has-lesson) {
    background-color: rgba(13, 110, 253, 0.1);
}

.lesson-slot.today {
    background-color: rgba(13, 202, 240, 0.08);
}

.lesson-slot.has-lesson {
    cursor: default;
    padding: 0 !important;
    position: relative;
    z-index: 10; /* Ensure multi-period blocks overlay subsequent rows */
}

.lesson-block {
    color: white;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.75rem;
    overflow: hidden;
    cursor: pointer;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 15; /* Above other cells */
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-sizing: border-box;
}

.lesson-block-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.lesson-block-content strong {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.8rem;
}

.lesson-block-content small {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.85;
}

.lesson-status-icon {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 0.7rem;
    opacity: 0.8;
}

.lesson-block:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    filter: brightness(1.05);
}

/* Lesson block colors based on status */
.lesson-block.bg-secondary {
    background: linear-gradient(135deg, #6c757d, #5a6268) !important;
}

.lesson-block.bg-primary {
    background: linear-gradient(135deg, #0d6efd, #0a58ca) !important;
}

.lesson-block.bg-warning {
    background: linear-gradient(135deg, #ffc107, #e0a800) !important;
    color: #212529 !important;
}

.lesson-block.bg-success {
    background: linear-gradient(135deg, #198754, #146c43) !important;
}

/* Lesson Grade Detail Styles */
#gradesTable tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.05);
}

#gradesTable .edit-grade-btn {
    opacity: 0.3;
    transition: opacity 0.2s;
}

#gradesTable tbody tr:hover .edit-grade-btn {
    opacity: 1;
}

/* Grade color coding */
.grade-excellent { color: #198754; font-weight: bold; }
.grade-good { color: #0dcaf0; }
.grade-satisfactory { color: #ffc107; }
.grade-poor { color: #dc3545; }

/* Basics circles in grade table */
.basics-circles {
    font-family: monospace;
    letter-spacing: 2px;
}

/* Ampel dots display */
.ampel-dots {
    display: inline-flex;
    gap: 2px;
}

.ampel-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.ampel-dot.green { background-color: #28a745; }
.ampel-dot.yellow { background-color: #ffc107; }
.ampel-dot.red { background-color: #dc3545; }
.ampel-dot.none { background-color: #dee2e6; }

/* Student detail modal */
#studentDetailModal .card-header {
    font-weight: 600;
}

#studentDetailModal .deduction-check {
    cursor: pointer;
}

/* Stats cards on detail page */
.card.bg-primary, .card.bg-success, .card.bg-info, .card.bg-warning {
    transition: transform 0.2s;
}

.card.bg-primary:hover, .card.bg-success:hover, .card.bg-info:hover, .card.bg-warning:hover {
    transform: translateY(-2px);
}

/* Live Mode: Hide grading columns and stats */
.live-mode .col-score-qty,
.live-mode .col-score-qual,
.live-mode .col-total,
.live-mode .col-grade {
    display: none !important;
}

.live-mode .stats-card-grades {
    display: none !important;
}

/* Absent students card */
#absentStudentsCard .badge {
    font-size: 0.85rem;
    font-weight: 500;
}

/* Topic tags in detail view */
.topic-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    background-color: #e9ecef;
    color: #495057;
}

.topic-tag .remove-topic {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.topic-tag .remove-topic:hover {
    opacity: 1;
    color: #dc3545;
}

/* Lesson status toggle button */
.status-toggle-btn {
    min-width: 140px;
}

/* ==================== TUTOR MODE ==================== */

/* Tutor Button Card (Magenta) */
.task-card.card-tutor {
    background: linear-gradient(135deg, #d946ef, #a855f7);
    border-color: #9333ea;
    color: white;
}
.task-card.card-tutor:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(217, 70, 239, 0.4);
}
.task-card.card-tutor.tutor-in-progress {
    background: linear-gradient(135deg, #e879f9, #c084fc);
    animation: tutorPulse 2s ease-in-out infinite;
}
.task-card.card-tutor.tutor-done {
    background: linear-gradient(135deg, #4caf50, #388e3c);
    border-color: #2e7d32;
}

@keyframes tutorPulse {
    0%, 100% { box-shadow: 0 0 8px rgba(217, 70, 239, 0.4); }
    50% { box-shadow: 0 0 20px rgba(217, 70, 239, 0.8); }
}

/* Tutor Focus Overlay */
#tutor-focus-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#tutor-focus-overlay.active {
    opacity: 1;
    visibility: visible;
}

.tutor-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.tutor-frame-wrapper {
    position: relative;
    width: 90vw;
    height: 90vh;
    max-width: 1230px;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    z-index: 1;
    transform: scale(0.95);
    transition: transform 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

#tutor-focus-overlay.active .tutor-frame-wrapper {
    transform: scale(1);
}

.tutor-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.tutor-close-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.tutor-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    color: #666;
    font-size: 1.2rem;
    z-index: 5;
}

@media (max-width: 768px) {
    .tutor-frame-wrapper {
        width: 100vw;
        height: 100vh;
        max-width: 100vw;
        border-radius: 0;
    }
}

/* ==================== GAME FOCUS MODE ==================== */

/* Game Launcher Button */
.game-launcher {
    text-align: center;
}

.game-launcher-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    padding: 15px 30px;
    font-size: 1.1rem;
    border-radius: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.game-launcher-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
    background: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);
}

.game-launcher-btn:active:not(:disabled) {
    transform: translateY(-1px);
}

.game-launcher-btn:disabled {
    background: linear-gradient(135deg, #aaa 0%, #888 100%);
    cursor: not-allowed;
    opacity: 0.7;
    box-shadow: none;
}

/* Game Focus Overlay - Fullscreen Container */
#game-focus-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000; /* Above Bootstrap Modal (1055), below Celebration (9999) */
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#game-focus-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Game Frame Wrapper */
.game-frame-wrapper {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    background: #1a1a2e;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

#game-focus-overlay.active .game-frame-wrapper {
    transform: scale(1);
}

/* Game Iframe */
.game-frame-wrapper iframe {
    display: block;
    border: none;
    border-radius: 12px;
}

/* Close hint at top */
.game-overlay-hint {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
    white-space: nowrap;
}

/* Loading indicator */
.game-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a1a2e;
    color: white;
    font-size: 1.2rem;
}

.game-loading i {
    margin-right: 10px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .game-frame-wrapper {
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }

    .game-frame-wrapper iframe {
        border-radius: 0;
    }

    .game-launcher-btn {
        width: 100%;
        padding: 12px 20px;
        font-size: 1rem;
    }

    .game-overlay-hint {
        display: none;
    }
}
