/* ============================================
   INTERACTIVE LAYER - Hotspots, Editor, Exercises
   ============================================ */

/* --- Edit Mode Toggle --- */
.toolbar-btn.active-tool {
    background: #e8733a !important;
}
.toolbar-btn.active-tool svg { fill: #fff !important; }

/* --- Hotspot Base --- */
.interactive-hotspot {
    position: absolute; border-radius: 6px;
    cursor: pointer; z-index: 15;
    pointer-events: auto;
    transition: all 0.2s;
}

/* Hotspot type colors */
.hotspot-text {
    border: 2px dashed rgba(72, 175, 240, 0.7);
    background: rgba(72, 175, 240, 0.08);
}
.hotspot-text:hover {
    background: rgba(72, 175, 240, 0.2);
    border-color: rgba(72, 175, 240, 1);
}

.hotspot-audio {
    border: 2px dashed rgba(155, 89, 182, 0.7);
    background: rgba(155, 89, 182, 0.08);
}
.hotspot-audio:hover {
    background: rgba(155, 89, 182, 0.2);
    border-color: rgba(155, 89, 182, 1);
}

.hotspot-video {
    border: 2px dashed rgba(231, 76, 60, 0.7);
    background: rgba(231, 76, 60, 0.08);
}
.hotspot-video:hover {
    background: rgba(231, 76, 60, 0.2);
    border-color: rgba(231, 76, 60, 1);
}

.hotspot-exercise {
    border: 2px dashed rgba(46, 204, 113, 0.7);
    background: rgba(46, 204, 113, 0.08);
}
.hotspot-exercise:hover {
    background: rgba(46, 204, 113, 0.2);
    border-color: rgba(46, 204, 113, 1);
}

/* Hotspot badge */
.hotspot-badge {
    position: absolute; top: -10px; left: 6px;
    font-size: 9px; font-weight: 700; padding: 2px 6px;
    border-radius: 3px; pointer-events: none;
    white-space: nowrap; z-index: 2;
}
.hotspot-text .hotspot-badge { background: #48aff0; color: #fff; }
.hotspot-audio .hotspot-badge { background: #9b59b6; color: #fff; }
.hotspot-video .hotspot-badge { background: #e74c3c; color: #fff; }
.hotspot-exercise .hotspot-badge { background: #2ecc71; color: #fff; }

/* --- Edit Mode --- */
.edit-mode .interactive-hotspot {
    border-style: solid; cursor: move;
}
.edit-mode .interactive-hotspot:hover {
    box-shadow: 0 0 0 2px #e8733a;
}
.hotspot-delete-btn {
    position: absolute; top: -8px; right: -8px;
    width: 18px; height: 18px; border-radius: 50%;
    background: #e74c3c; color: #fff; border: none;
    font-size: 12px; cursor: pointer; z-index: 3;
    display: flex; align-items: center; justify-content: center;
    line-height: 1; display: none;
}
.edit-mode .hotspot-delete-btn { display: flex; }

/* --- Selection Rectangle (drawing new region) --- */
.selection-rect {
    position: absolute;
    border: 2px dashed #e8733a;
    background: rgba(232, 115, 58, 0.1);
    pointer-events: none; z-index: 20;
}

/* --- Properties Panel (right side) --- */
.properties-panel {
    position: absolute; top: 0; right: 0;
    width: 320px; height: 100%;
    background: #1e1e1e; color: #ddd;
    border-left: 2px solid #e8733a;
    z-index: 70;
    display: flex; flex-direction: column;
    animation: slideRight 0.25s ease-out;
}
@keyframes slideRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}
.properties-header {
    padding: 10px 14px; background: #2a2a2a;
    font-weight: 600; font-size: 13px;
    display: flex; justify-content: space-between; align-items: center;
    flex-shrink: 0;
}
.properties-body {
    flex: 1; overflow-y: auto; padding: 12px;
}
.properties-body label {
    display: block; font-size: 11px; color: #888;
    margin-bottom: 4px; margin-top: 12px;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.properties-body input,
.properties-body textarea,
.properties-body select {
    width: 100%; padding: 8px 10px;
    background: #333; color: #ddd;
    border: 1px solid #555; border-radius: 4px;
    font-size: 13px; font-family: inherit;
    resize: vertical;
}
.properties-body textarea { min-height: 80px; }
.properties-body input:focus,
.properties-body textarea:focus,
.properties-body select:focus {
    border-color: #e8733a; outline: none;
}
.properties-body .field-group { display: none; }
.properties-body .field-group.show { display: block; }
.properties-save-btn {
    width: 100%; padding: 10px; margin-top: 12px;
    background: #e8733a; color: #fff; border: none;
    border-radius: 4px; cursor: pointer; font-size: 13px; font-weight: 600;
}
.properties-save-btn:hover { background: #d1622a; }
.properties-delete-btn {
    width: 100%; padding: 8px; margin-top: 6px;
    background: transparent; color: #e74c3c;
    border: 1px solid #e74c3c; border-radius: 4px;
    cursor: pointer; font-size: 12px;
}
.properties-delete-btn:hover { background: rgba(231,76,60,0.1); }

/* --- Read-Along Panel (bottom) --- */
.readalong-panel {
    position: absolute; bottom: 0; left: 0; right: 0;
    height: 180px; background: #1e1e1e; color: #ddd;
    border-top: 2px solid #48aff0;
    z-index: 60; display: flex; flex-direction: column;
    animation: slideUp 0.3s ease-out;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.readalong-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 6px 14px; background: #2a2a2a; flex-shrink: 0;
    font-size: 12px; font-weight: 600;
}
.readalong-header-controls { display: flex; align-items: center; gap: 6px; }
.readalong-speed {
    background: #333; color: #ddd; border: 1px solid #555;
    padding: 3px 6px; border-radius: 3px; font-size: 12px; cursor: pointer;
}
.readalong-btn {
    background: #444; color: #ddd; border: none;
    padding: 5px 10px; border-radius: 3px; cursor: pointer;
    font-size: 12px; transition: background 0.15s;
}
.readalong-btn.play { background: #48aff0; color: #fff; }
.readalong-btn.play:hover { background: #3498db; }
.readalong-btn.play.playing { background: #e74c3c; }
.readalong-btn:hover { background: #555; }
.readalong-text {
    flex: 1; overflow-y: auto; padding: 10px 16px;
    font-size: 18px; line-height: 2; font-family: 'Segoe UI', Georgia, serif;
}
.readalong-word {
    display: inline; padding: 1px 3px; border-radius: 2px;
    transition: all 0.15s; cursor: pointer;
}
.readalong-word:hover { background: rgba(255,255,255,0.08); }
.readalong-word.active {
    background: #48aff0; color: #fff; font-weight: 600;
    box-shadow: 0 0 8px rgba(72,175,240,0.5);
}
.readalong-word.spoken { color: #666; }

/* --- Audio Mini Player --- */
.audio-mini {
    position: absolute; z-index: 25;
    background: #2a2a2a; border: 2px solid #9b59b6;
    border-radius: 8px; padding: 8px 12px;
    display: flex; align-items: center; gap: 8px;
    font-size: 12px; color: #ddd;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.audio-mini button {
    background: #9b59b6; color: #fff; border: none;
    width: 28px; height: 28px; border-radius: 50%;
    cursor: pointer; font-size: 12px;
}
.audio-mini button:hover { background: #8e44ad; }
.audio-mini .audio-progress {
    flex: 1; height: 4px; background: #444;
    border-radius: 2px; min-width: 60px; cursor: pointer;
}
.audio-mini .audio-progress-fill {
    height: 100%; background: #9b59b6;
    border-radius: 2px; width: 0%; transition: width 0.1s;
}

/* --- Exercise Overlay ---- */
.exercise-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 200; display: flex;
    align-items: center; justify-content: center;
    animation: fadeIn 0.2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.exercise-popup {
    background: #fff; border-radius: 12px;
    width: 90%; max-width: 550px; max-height: 85vh;
    overflow-y: auto; box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    color: #333;
}
.exercise-popup-header {
    background: #2ecc71; color: #fff;
    padding: 14px 18px; border-radius: 12px 12px 0 0;
    font-size: 16px; font-weight: 600;
    display: flex; justify-content: space-between; align-items: center;
}
.exercise-popup-header.video-header { background: #e74c3c; }
.exercise-popup-header.audio-ex-header { background: #9b59b6; }
.exercise-popup-header.static-header { background: #3498db; }
.exercise-popup-close {
    background: none; border: none; color: #fff;
    font-size: 22px; cursor: pointer; padding: 0 4px;
    line-height: 1;
}
.exercise-popup-body { padding: 18px; }

/* --- Exercise: MCQ --- */
.exercise-question { font-size: 15px; margin-bottom: 14px; font-weight: 500; }
.exercise-option {
    display: block; width: 100%; padding: 10px 14px; margin-bottom: 8px;
    background: #f5f5f5; border: 2px solid #ddd; border-radius: 8px;
    cursor: pointer; font-size: 14px; text-align: left;
    transition: all 0.15s;
}
.exercise-option:hover { background: #e8f8f5; border-color: #2ecc71; }
.exercise-option.selected { background: #d5f5e3; border-color: #27ae60; }
.exercise-option.correct { background: #d5f5e3 !important; border-color: #27ae60 !important; }
.exercise-option.wrong { background: #fadbd8 !important; border-color: #e74c3c !important; }
.exercise-feedback {
    padding: 10px; margin-top: 10px; border-radius: 6px;
    font-size: 13px; text-align: center; display: none;
}
.exercise-feedback.show { display: block; }
.exercise-feedback.success { background: #d5f5e3; color: #27ae60; }
.exercise-feedback.error { background: #fadbd8; color: #c0392b; }

/* --- Exercise: Drag & Drop --- */
.exercise-audio-bar {
    background: #f0f0f0; padding: 10px 14px;
    border-radius: 8px; margin-bottom: 14px;
    display: flex; align-items: center; gap: 8px;
}
.exercise-audio-bar audio { flex: 1; height: 32px; }
.drag-items-area {
    display: flex; gap: 12px; flex-wrap: wrap;
    justify-content: center; margin-bottom: 18px;
    padding: 10px; background: #fafafa; border-radius: 8px;
    min-height: 60px;
}
.drag-item {
    width: 60px; height: 60px; border-radius: 8px;
    cursor: grab; user-select: none;
    transition: transform 0.15s, box-shadow 0.15s;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; background: #fff; border: 2px solid #ddd;
    position: relative;
}
.drag-item:active { cursor: grabbing; transform: scale(1.1); }
.drag-item.dragging { opacity: 0.5; z-index: 300; }
.drag-item.placed { border-color: #2ecc71; background: #e8f8f5; }
.drag-item img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; }
.drop-zones-area {
    display: flex; flex-direction: column; gap: 10px;
}
.drop-zone {
    border: 2px dashed #ccc; border-radius: 8px;
    padding: 10px 14px; min-height: 50px;
    display: flex; align-items: center; gap: 10px;
    transition: all 0.2s; background: #fafafa;
}
.drop-zone.hover { border-color: #2ecc71; background: #e8f8f5; }
.drop-zone.filled { border-style: solid; border-color: #2ecc71; }
.drop-zone-placeholder { color: #aaa; font-size: 13px; }
.drop-zone-filled-item {
    width: 42px; height: 42px; border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; background: #d5f5e3; border: 1px solid #27ae60;
    flex-shrink: 0;
}
.drop-zone-filled-item img { width: 100%; height: 100%; object-fit: cover; border-radius: 4px; }
.drop-zone-text { flex: 1; font-size: 14px; }
.exercise-submit-btn {
    display: block; width: 100%; padding: 12px; margin-top: 14px;
    background: #2ecc71; color: #fff; border: none;
    border-radius: 8px; cursor: pointer; font-size: 15px; font-weight: 600;
}
.exercise-submit-btn:hover { background: #27ae60; }
.exercise-submit-btn:disabled { background: #ccc; cursor: default; }

/* --- Exercise: Dropdown --- */
.gap-sentence {
    font-size: 16px; line-height: 2.2; margin-bottom: 16px;
}
.gap-select {
    padding: 4px 8px; font-size: 14px;
    border: 2px solid #3498db; border-radius: 4px;
    background: #fff; cursor: pointer;
    margin: 0 2px;
}
.gap-select.correct-gap { border-color: #27ae60; background: #d5f5e3; }
.gap-select.wrong-gap { border-color: #e74c3c; background: #fadbd8; }

/* --- Exercise: Static Content --- */
.static-content img { max-width: 100%; border-radius: 6px; }
.static-content ul, .static-content ol { margin: 8px 0; padding-left: 20px; }
.static-content li { margin-bottom: 4px; }

/* --- Success Overlay --- */
.success-overlay {
    position: absolute; inset: 0;
    background: rgba(46, 204, 113, 0.9);
    z-index: 10; display: flex;
    flex-direction: column; align-items: center;
    justify-content: center;
    border-radius: 12px;
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes popIn {
    from { transform: scale(0.5); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.success-overlay h2 {
    color: #fff; font-size: 32px; margin-bottom: 4px;
}
.success-overlay p { color: #fff; font-size: 16px; }

/* --- Resume Prompt --- */
.resume-prompt {
    text-align: center; padding: 20px;
}
.resume-prompt p { font-size: 15px; margin-bottom: 16px; }
.resume-prompt button {
    padding: 10px 20px; margin: 0 6px; border: none;
    border-radius: 6px; cursor: pointer; font-size: 14px;
}
.resume-prompt .resume-yes { background: #2ecc71; color: #fff; }
.resume-prompt .resume-no { background: #ddd; color: #333; }

/* --- Progress Badge --- */
.progress-badge {
    position: absolute; bottom: 8px; left: 50%;
    transform: translateX(-50%);
    background: rgba(46, 204, 113, 0.85); color: #fff;
    padding: 3px 10px; border-radius: 10px;
    font-size: 11px; font-weight: 600; z-index: 5;
    pointer-events: none;
}
.progress-badge.incomplete { background: rgba(149, 165, 166, 0.85); }

/* --- On-Page Word Highlight Overlay --- */
.word-highlight-overlay {
    pointer-events: none !important;
}
.page-word-highlight {
    pointer-events: none;
}
.page-word-highlight.active {
    z-index: 2 !important;
}
