/* =====================================================
   SOUND MAPPING CHALLENGE - COMPLETE STYLESHEET
   Design: Interactive Map-Based Learning
   ===================================================== */

:root {
    /* Colors - Nature/Map theme */
    --map-primary: #2C5530;
    --map-forest: #4CAF50;
    --map-wetland: #2196F3;
    --map-urban: #9E9E9E;
    --map-grassland: #FFC107;
    --map-accent: #00BCD4;
    --map-success: #4CAF50;
    --map-error: #F44336;
    
    /* Spacing */
    --map-space-xs: 0.25rem;
    --map-space-sm: 0.5rem;
    --map-space-md: 1rem;
    --map-space-lg: 1.5rem;
    --map-space-xl: 2rem;
    
    /* Typography */
    --map-font-body: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    --map-font-heading: 'Fredoka', 'Poppins', sans-serif;
}

/* =====================================================
   MAIN CONTAINER
   ===================================================== */

.sound-mapping-challenge {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #E8F5E9 0%, #E1F5FE 100%);
    font-family: var(--map-font-body);
    user-select: none;
    display: flex;
    flex-direction: column;
    z-index: 99999;
}

.sound-mapping-challenge input,
.sound-mapping-challenge textarea {
    user-select: text;
}

/* =====================================================
   PROGRESS & STATS
   ===================================================== */

.sound-mapping-challenge .detective-modal-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: var(--map-space-lg);
}

.sound-mapping-challenge .detective-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 4px;
}

.sound-mapping-challenge .detective-stat-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--map-primary);
    font-family: var(--map-font-heading);
}

.sound-mapping-challenge .detective-stat-value {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--map-primary);
    font-family: var(--map-font-heading);
    text-shadow: 0 1px 2px rgba(44, 85, 48, 0.1);
}

/* Enhanced progress bar with green/blue gradient */
.sound-mapping-challenge .detective-mini-progress {
    height: 4px !important;
    background: rgba(44, 85, 48, 0.1) !important;
}

.sound-mapping-challenge .detective-mini-progress-fill {
    background: linear-gradient(90deg, #2C5530 0%, #4CAF50 40%, #2196F3 70%, #00BCD4 100%) !important;
    box-shadow: 0 0 12px rgba(76, 175, 80, 0.4), 0 2px 4px rgba(44, 85, 48, 0.3) !important;
    position: relative;
    border-radius: 0 2px 2px 0;
}

.sound-mapping-challenge .detective-mini-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: progressPulse 2s ease-in-out infinite;
}

@keyframes progressPulse {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

/* =====================================================
   PHASE INDICATORS
   ===================================================== */

.map-phase-indicator {
    background: linear-gradient(135deg, var(--map-primary) 0%, var(--map-forest) 100%);
    border-radius: 16px;
    padding: var(--map-space-xl);
    margin-bottom: var(--map-space-xl);
    text-align: center;
    color: white;
    box-shadow: 0 8px 24px rgba(44, 85, 48, 0.3);
}

.map-phase-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    padding: var(--map-space-sm) var(--map-space-lg);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: var(--map-space-sm);
    backdrop-filter: blur(10px);
}

.map-phase-title {
    font-family: var(--map-font-heading);
    font-size: 2rem;
    font-weight: 700;
    margin: var(--map-space-sm) 0;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.map-phase-description {
    font-size: 1rem;
    opacity: 0.95;
    margin: 0;
    line-height: 1.6;
}

/* =====================================================
   HABITAT CARDS (Phase 1)
   ===================================================== */

.habitat-cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--map-space-lg);
    margin: var(--map-space-xl) 0;
}

.habitat-card {
    background: white;
    border-radius: 20px;
    padding: var(--map-space-xl);
    cursor: pointer;
    transition: all 0.3s;
    border: 3px solid transparent;
    position: relative;
    overflow: hidden;
}

.habitat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
    background: var(--habitat-color, #4CAF50);
}

.habitat-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
    border-color: var(--habitat-color, #4CAF50);
}

.habitat-card.active {
    border-color: var(--habitat-color, #4CAF50);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
}

.habitat-card.forest { --habitat-color: #4CAF50; }
.habitat-card.wetland { --habitat-color: #2196F3; }
.habitat-card.urban { --habitat-color: #9E9E9E; }
.habitat-card.grassland { --habitat-color: #FFC107; }

.habitat-icon {
    font-size: 3rem;
    text-align: center;
    margin-bottom: var(--map-space-md);
}

.habitat-name {
    font-family: var(--map-font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--habitat-color, #4CAF50);
    text-align: center;
    margin-bottom: var(--map-space-sm);
}

.habitat-description {
    text-align: center;
    font-size: 0.9rem;
    color: #666;
    line-height: 1.6;
}

.habitat-birds-list {
    margin-top: var(--map-space-md);
    padding-top: var(--map-space-md);
    border-top: 2px solid #F5F5F5;
}

.habitat-bird-item {
    display: flex;
    align-items: center;
    gap: var(--map-space-sm);
    padding: var(--map-space-sm);
    margin: var(--map-space-xs) 0;
    background: #FAFAFA;
    border-radius: 8px;
    font-size: 0.85rem;
}

/* =====================================================
   INTERACTIVE MAP
   ===================================================== */

.map-container {
    background: white;
    border-radius: 20px;
    padding: var(--map-space-lg);
    margin: var(--map-space-lg) 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    position: relative;
}

.map-legend {
    display: flex;
    justify-content: center;
    gap: var(--map-space-lg);
    margin-bottom: var(--map-space-md);
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: var(--map-space-sm);
    font-size: 0.85rem;
    font-weight: 600;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 2px solid rgba(0, 0, 0, 0.2);
}

.legend-color.forest { background: #4CAF50; }
.legend-color.wetland { background: #2196F3; }
.legend-color.urban { background: #9E9E9E; }
.legend-color.grassland { background: #FFC107; }

.interactive-map {
    width: 100%;
    max-width: 800px;
    height: 500px;
    margin: 0 auto;
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.1);
}

.map-zone {
    position: absolute;
    transition: all 0.3s;
    cursor: pointer;
    border: 3px solid rgba(255, 255, 255, 0.5);
}

.map-zone:hover {
    filter: brightness(1.1);
    transform: scale(1.02);
    border-color: white;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.map-zone.selected {
    border-color: #FFD700;
    border-width: 4px;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
}

/* Zone positions and colors */
.zone-forest {
    background: linear-gradient(135deg, #4CAF50 0%, #66BB6A 100%);
    top: 0;
    left: 0;
    width: 50%;
    height: 50%;
    border-radius: 16px 0 0 0;
}

.zone-wetland {
    background: linear-gradient(135deg, #2196F3 0%, #42A5F5 100%);
    top: 0;
    right: 0;
    width: 50%;
    height: 50%;
    border-radius: 0 16px 0 0;
}

.zone-urban {
    background: linear-gradient(135deg, #9E9E9E 0%, #BDBDBD 100%);
    bottom: 0;
    left: 0;
    width: 50%;
    height: 50%;
    border-radius: 0 0 0 16px;
}

.zone-grassland {
    background: linear-gradient(135deg, #FFC107 0%, #FFD54F 100%);
    bottom: 0;
    right: 0;
    width: 50%;
    height: 50%;
    border-radius: 0 0 16px 0;
}

.zone-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--map-font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    opacity: 0.9;
}

/* Bird markers on map */
.bird-marker {
    position: absolute;
    width: 40px;
    height: 40px;
    background: white;
    border: 3px solid var(--map-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transform: translate(-50%, -50%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: markerDrop 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 100;
}

@keyframes markerDrop {
    0% {
        transform: translate(-50%, -100%) scale(0);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

.bird-marker:hover {
    transform: translate(-50%, -50%) scale(1.15);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.bird-marker.correct {
    border-color: var(--map-success);
    animation: correctPulse 0.6s ease-out;
}

.bird-marker.incorrect {
    border-color: var(--map-error);
    animation: shake 0.5s;
}

@keyframes correctPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.3); }
}

@keyframes shake {
    0%, 100% { transform: translate(-50%, -50%) rotate(0deg); }
    25% { transform: translate(-50%, -50%) rotate(-10deg); }
    75% { transform: translate(-50%, -50%) rotate(10deg); }
}

/* =====================================================
   AUDIO PLAYER
   ===================================================== */

.map-audio-player {
    background: white;
    border-radius: 16px;
    padding: var(--map-space-lg);
    margin: var(--map-space-lg) 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: var(--map-space-lg);
}

.map-play-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--map-primary), var(--map-forest));
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    box-shadow: 0 4px 16px rgba(44, 85, 48, 0.3);
    flex-shrink: 0;
}

.map-play-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(44, 85, 48, 0.5);
}

.map-play-btn:active {
    transform: scale(0.95);
}

.map-play-btn.playing {
    background: linear-gradient(135deg, var(--map-wetland), var(--map-accent));
}

.map-audio-info {
    flex: 1;
}

.map-audio-label {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 4px;
}

.map-audio-title {
    font-family: var(--map-font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--map-primary);
}

.map-play-count {
    font-size: 0.85rem;
    color: #666;
    font-weight: 600;
    padding: var(--map-space-sm) var(--map-space-md);
    background: #F5F5F5;
    border-radius: 12px;
}

/* =====================================================
   QUESTION CARDS
   ===================================================== */

.map-question-card {
    background: white;
    border-radius: 20px;
    padding: var(--map-space-xl);
    margin-bottom: var(--map-space-lg);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.map-question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--map-space-lg);
}

.map-question-number {
    font-family: var(--map-font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--map-primary);
}

.map-timer {
    display: flex;
    align-items: center;
    gap: var(--map-space-sm);
    font-family: monospace;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--map-accent);
}

.map-timer.warning {
    color: var(--map-error);
    animation: timerPulse 1s ease-in-out infinite;
}

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

.map-instruction-box {
    background: linear-gradient(135deg, #E8F5E9 0%, #E1F5FE 100%);
    border-left: 4px solid var(--map-primary);
    border-radius: 12px;
    padding: var(--map-space-lg);
    margin: var(--map-space-lg) 0;
}

.map-instruction-title {
    font-family: var(--map-font-heading);
    font-size: 1rem;
    font-weight: 700;
    color: var(--map-primary);
    margin: 0 0 var(--map-space-sm) 0;
    display: flex;
    align-items: center;
    gap: var(--map-space-sm);
}

.map-instruction-text {
    color: #333;
    line-height: 1.6;
    margin: 0;
    font-size: 0.95rem;
}

/* =====================================================
   BUTTONS
   ===================================================== */

.map-btn {
    padding: var(--map-space-md) var(--map-space-xl);
    border-radius: 12px;
    border: none;
    font-family: var(--map-font-heading);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: var(--map-space-sm);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.map-btn-primary {
    background: linear-gradient(135deg, var(--map-primary), var(--map-forest));
    color: white;
}

.map-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(44, 85, 48, 0.4);
}

.map-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.map-btn-secondary {
    background: white;
    color: var(--map-primary);
    border: 2px solid var(--map-primary);
}

.map-btn-secondary:hover {
    background: #E8F5E9;
    transform: translateY(-2px);
}

/* =====================================================
   FEEDBACK MODALS
   ===================================================== */

.map-feedback-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
    animation: fadeIn 0.3s;
}

.map-feedback-content {
    background: white;
    border-radius: 24px;
    padding: var(--map-space-xl);
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
    animation: slideInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.map-feedback-icon {
    font-size: 4rem;
    text-align: center;
    margin-bottom: var(--map-space-md);
}

.map-feedback-title {
    font-family: var(--map-font-heading);
    font-size: 1.75rem;
    font-weight: 700;
    text-align: center;
    margin: 0 0 var(--map-space-md) 0;
}

.map-feedback-title.correct {
    color: var(--map-success);
}

.map-feedback-title.incorrect {
    color: var(--map-error);
}

.map-feedback-message {
    text-align: center;
    font-size: 1rem;
    line-height: 1.6;
    margin: 0 0 var(--map-space-lg) 0;
    color: #555;
}

/* =====================================================
   RESULTS SCREEN
   ===================================================== */

.map-results-container {
    max-width: 800px;
    margin: 0 auto;
}

.map-results-header {
    text-align: center;
    margin-bottom: var(--map-space-xl);
}

.map-results-icon {
    font-size: 5rem;
    margin-bottom: var(--map-space-md);
}

.map-results-title {
    font-family: var(--map-font-heading);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--map-primary);
    margin: 0 0 var(--map-space-sm) 0;
}

.map-results-score {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--map-primary), var(--map-forest));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.map-results-level {
    display: inline-block;
    background: linear-gradient(135deg, var(--map-primary), var(--map-forest));
    color: white;
    padding: var(--map-space-sm) var(--map-space-xl);
    border-radius: 20px;
    font-weight: 700;
    margin-top: var(--map-space-md);
}

.map-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--map-space-lg);
    margin: var(--map-space-xl) 0;
}

.map-stat-card {
    background: white;
    border-radius: 16px;
    padding: var(--map-space-lg);
    text-align: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.map-stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--map-primary);
    font-family: var(--map-font-heading);
}

.map-stat-label {
    font-size: 0.85rem;
    color: #666;
    margin-top: var(--map-space-sm);
}

/* =====================================================
   ANIMATIONS
   ===================================================== */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* =====================================================
   RESPONSIVE DESIGN
   ===================================================== */

@media (max-width: 768px) {
    .habitat-cards-grid {
        grid-template-columns: 1fr;
    }
    
    .map-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .interactive-map {
        height: 400px;
    }
    
    .map-phase-title {
        font-size: 1.5rem;
    }
    
    .map-results-score {
        font-size: 2rem;
    }
}

/* =====================================================
   ACCESSIBILITY
   ===================================================== */

.sound-mapping-challenge *:focus {
    outline: 3px solid var(--map-accent);
    outline-offset: 2px;
}

