/* =====================================================
   HABITAT EXPLORER CHALLENGE - COMPLETE STYLESHEET
   Design: Immersive Ecosystem Discovery
   ===================================================== */

:root {
    /* Colors - Ecosystem theme */
    --habitat-primary: #2E7D32;
    --habitat-forest: #4CAF50;
    --habitat-wetland: #0288D1;
    --habitat-urban: #757575;
    --habitat-grassland: #F9A825;
    --habitat-accent: #8BC34A;
    --habitat-success: #66BB6A;
    --habitat-error: #EF5350;
    
    /* Spacing */
    --habitat-space-xs: 0.25rem;
    --habitat-space-sm: 0.5rem;
    --habitat-space-md: 1rem;
    --habitat-space-lg: 1.5rem;
    --habitat-space-xl: 2rem;
    
    /* Typography */
    --habitat-font-body: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    --habitat-font-heading: 'Fredoka', 'Poppins', sans-serif;
}

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

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

.habitat-explorer-challenge input,
.habitat-explorer-challenge textarea,
.habitat-explorer-challenge select {
    user-select: text;
}

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

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

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

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

.habitat-explorer-challenge .detective-stat-value {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--habitat-primary);
    font-family: var(--habitat-font-heading);
    text-shadow: 0 1px 2px rgba(46, 125, 50, 0.1);
}

/* Enhanced progress bar with ecosystem gradient */
.habitat-explorer-challenge .detective-mini-progress {
    height: 4px !important;
    background: rgba(46, 125, 50, 0.1) !important;
}

.habitat-explorer-challenge .detective-mini-progress-fill {
    background: linear-gradient(90deg, #2E7D32 0%, #4CAF50 30%, #8BC34A 60%, #F9A825 100%) !important;
    box-shadow: 0 0 12px rgba(76, 175, 80, 0.4), 0 2px 4px rgba(46, 125, 50, 0.3) !important;
    position: relative;
    border-radius: 0 2px 2px 0;
}

.habitat-explorer-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: progressFlow 2s ease-in-out infinite;
}

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

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

.habitat-phase-indicator {
    background: linear-gradient(135deg, var(--habitat-primary) 0%, var(--habitat-forest) 100%);
    border-radius: 20px;
    padding: var(--habitat-space-xl);
    margin-bottom: var(--habitat-space-xl);
    text-align: center;
    color: white;
    box-shadow: 0 8px 24px rgba(46, 125, 50, 0.3);
    position: relative;
    overflow: hidden;
}

.habitat-phase-indicator::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: subtleGlow 4s ease-in-out infinite;
}

@keyframes subtleGlow {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(10px, 10px); }
}

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

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

.habitat-phase-description {
    font-size: 1rem;
    opacity: 0.95;
    margin: 0;
    line-height: 1.6;
    position: relative;
    z-index: 1;
}

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

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

.habitat-explore-card {
    background: white;
    border-radius: 24px;
    padding: var(--habitat-space-xl);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border: 3px solid transparent;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.habitat-explore-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 120px;
    background: var(--card-gradient, linear-gradient(135deg, #4CAF50 0%, #66BB6A 100%));
    opacity: 0.1;
    transition: all 0.4s;
}

.habitat-explore-card:hover {
    transform: translateY(-12px) scale(1.02);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.15);
    border-color: var(--card-color, #4CAF50);
}

.habitat-explore-card:hover::before {
    height: 100%;
    opacity: 0.15;
}

.habitat-explore-card.forest { --card-color: #4CAF50; --card-gradient: linear-gradient(135deg, #4CAF50 0%, #66BB6A 100%); }
.habitat-explore-card.wetland { --card-color: #0288D1; --card-gradient: linear-gradient(135deg, #0288D1 0%, #039BE5 100%); }
.habitat-explore-card.urban { --card-color: #757575; --card-gradient: linear-gradient(135deg, #757575 0%, #9E9E9E 100%); }
.habitat-explore-card.grassland { --card-color: #F9A825; --card-gradient: linear-gradient(135deg, #F9A825 0%, #FBC02D 100%); }

.habitat-icon-large {
    font-size: 4rem;
    text-align: center;
    margin-bottom: var(--habitat-space-md);
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.habitat-title {
    font-family: var(--habitat-font-heading);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--card-color, #4CAF50);
    text-align: center;
    margin-bottom: var(--habitat-space-md);
    position: relative;
    z-index: 1;
}

.habitat-description {
    text-align: center;
    font-size: 0.95rem;
    color: #555;
    line-height: 1.6;
    margin-bottom: var(--habitat-space-lg);
    position: relative;
    z-index: 1;
}

.habitat-features-list {
    background: rgba(0, 0, 0, 0.02);
    border-radius: 12px;
    padding: var(--habitat-space-md);
    margin-bottom: var(--habitat-space-md);
    position: relative;
    z-index: 1;
}

.habitat-feature-item {
    display: flex;
    align-items: center;
    gap: var(--habitat-space-sm);
    padding: var(--habitat-space-sm);
    font-size: 0.9rem;
    color: #333;
}

.habitat-birds-preview {
    display: flex;
    gap: var(--habitat-space-sm);
    justify-content: center;
    margin-top: var(--habitat-space-md);
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.bird-preview-pill {
    background: var(--card-color, #4CAF50);
    color: white;
    padding: var(--habitat-space-sm) var(--habitat-space-md);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.explore-btn {
    width: 100%;
    padding: var(--habitat-space-md) var(--habitat-space-lg);
    background: linear-gradient(135deg, var(--card-color, #4CAF50), var(--card-gradient));
    color: white;
    border: none;
    border-radius: 12px;
    font-family: var(--habitat-font-heading);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: var(--habitat-space-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    position: relative;
    z-index: 1;
}

.explore-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

/* =====================================================
   FOOD WEB BUILDER (Phase 2)
   ===================================================== */

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

.foodweb-diagram {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: var(--habitat-space-xl);
    align-items: center;
    margin: var(--habitat-space-xl) 0;
    padding: var(--habitat-space-xl);
    background: linear-gradient(135deg, #F1F8E9 0%, #E8F5E9 100%);
    border-radius: 16px;
}

.foodweb-column {
    display: flex;
    flex-direction: column;
    gap: var(--habitat-space-md);
}

.foodweb-item {
    background: white;
    padding: var(--habitat-space-md);
    border-radius: 12px;
    border: 2px solid #E0E0E0;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: var(--habitat-space-sm);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.foodweb-item:hover {
    transform: translateX(8px);
    border-color: var(--habitat-accent);
    box-shadow: 0 4px 16px rgba(139, 195, 74, 0.3);
}

.foodweb-item.selected {
    background: linear-gradient(135deg, #8BC34A 0%, #9CCC65 100%);
    color: white;
    border-color: #7CB342;
    box-shadow: 0 4px 16px rgba(139, 195, 74, 0.5);
}

.foodweb-item.correct {
    background: linear-gradient(135deg, #66BB6A 0%, #81C784 100%);
    color: white;
    border-color: #4CAF50;
    animation: correctBounce 0.5s;
}

.foodweb-item.incorrect {
    background: linear-gradient(135deg, #EF5350 0%, #E57373 100%);
    color: white;
    border-color: #F44336;
    animation: shake 0.5s;
}

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

.foodweb-connector {
    display: flex;
    flex-direction: column;
    gap: var(--habitat-space-sm);
}

.connection-arrow {
    font-size: 2rem;
    color: var(--habitat-accent);
    text-align: center;
}

.food-item-icon {
    font-size: 1.5rem;
}

.food-item-label {
    font-weight: 600;
    font-size: 0.95rem;
}

/* =====================================================
   ADAPTATION QUIZ (Phase 3)
   ===================================================== */

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

.adaptation-visual {
    background: linear-gradient(135deg, #E8F5E9 0%, #F1F8E9 100%);
    border-radius: 16px;
    padding: var(--habitat-space-xl);
    margin: var(--habitat-space-lg) 0;
    text-align: center;
}

.adaptation-bird-display {
    font-size: 5rem;
    margin-bottom: var(--habitat-space-md);
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.2));
}

.adaptation-question {
    font-family: var(--habitat-font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--habitat-primary);
    margin: var(--habitat-space-lg) 0;
    text-align: center;
}

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

.adaptation-option {
    background: white;
    border: 3px solid #E0E0E0;
    border-radius: 16px;
    padding: var(--habitat-space-lg);
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.adaptation-option:hover {
    border-color: var(--habitat-accent);
    transform: scale(1.05);
    box-shadow: 0 8px 24px rgba(139, 195, 74, 0.3);
}

.adaptation-option.selected {
    background: linear-gradient(135deg, #8BC34A 0%, #9CCC65 100%);
    color: white;
    border-color: #7CB342;
}

.adaptation-option.correct {
    background: linear-gradient(135deg, #66BB6A 0%, #81C784 100%);
    color: white;
    border-color: #4CAF50;
    animation: pulse 0.6s;
}

.adaptation-option.incorrect {
    background: linear-gradient(135deg, #EF5350 0%, #E57373 100%);
    color: white;
    border-color: #F44336;
    animation: shake 0.5s;
}

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

.option-icon {
    font-size: 2.5rem;
    margin-bottom: var(--habitat-space-sm);
}

.option-text {
    font-weight: 600;
    font-size: 1rem;
}

.adaptation-timer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--habitat-space-sm);
    font-family: monospace;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--habitat-accent);
    margin-bottom: var(--habitat-space-md);
}

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

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

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

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

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

.habitat-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(46, 125, 50, 0.4);
}

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

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

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

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

.habitat-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;
}

.habitat-feedback-content {
    background: white;
    border-radius: 24px;
    padding: var(--habitat-space-xl);
    max-width: 650px;
    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);
}

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

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

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

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

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

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

.habitat-info-title {
    font-weight: 700;
    color: var(--habitat-primary);
    margin-bottom: var(--habitat-space-sm);
}

.habitat-info-text {
    margin: 0;
    line-height: 1.6;
    font-size: 0.95rem;
}

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

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

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

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

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

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

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

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

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

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

.habitat-stat-label {
    font-size: 0.85rem;
    color: #666;
    margin-top: var(--habitat-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-exploration-grid {
        grid-template-columns: 1fr;
    }
    
    .habitat-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .foodweb-diagram {
        grid-template-columns: 1fr;
    }
    
    .adaptation-options {
        grid-template-columns: 1fr;
    }
    
    .habitat-phase-title {
        font-size: 1.5rem;
    }
    
    .habitat-results-score {
        font-size: 2rem;
    }
}

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

.habitat-explorer-challenge *:focus {
    outline: 3px solid var(--habitat-accent);
    outline-offset: 2px;
}

