/* ============================================
   LIFE CYCLE QUIZ - DRAG & DROP STYLES
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 10px;
}

.container {
    width: 100%;
    max-width: 900px;
    height: auto;
}

/* ============================================
   MAIN PANEL
   ============================================ */

.main-panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-height: 450px;
}

/* Header Section */
.header-section {
    display: flex;
    align-items: center;
    gap: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

.title-icon {
    font-size: 28px;
    cursor: help;
    transition: transform 0.2s;
}

.title-icon:hover {
    transform: rotate(180deg);
}

.organism-selector {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.organism-btn {
    font-size: 24px;
    background: #f5f5f5;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.organism-btn:hover {
    background: #e8f4f8;
    border-color: #667eea;
    transform: scale(1.1);
}

.organism-btn.active {
    background: #667eea;
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* ============================================
   QUIZ CONTENT AREA
   ============================================ */

.quiz-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    flex: 1;
    min-height: 250px;
}

/* Stages Panel (Left) */
.stages-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.panel-label {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stages-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 2px dashed #ddd;
    min-height: 200px;
}

/* Draggable Stage Item */
.stage-item {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 16px;
    border-radius: 6px;
    cursor: grab;
    user-select: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
}

.stage-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.5);
}

.stage-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.stage-item.placed {
    opacity: 0.3;
    pointer-events: none;
}

.stage-emoji {
    font-size: 18px;
}

/* Timeline Panel (Right) */
.timeline-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.timeline-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    min-height: 200px;
    overflow-y: auto;
}

/* Drop Zone */
.drop-zone {
    background: white;
    border: 2px dashed #ccc;
    border-radius: 6px;
    padding: 12px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.drop-zone:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.drop-zone.active {
    border-color: #667eea;
    background: #e8f0ff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.drop-zone-label {
    font-size: 12px;
    color: #999;
    font-weight: 600;
    min-width: 60px;
}

.drop-zone-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 30px;
}

.dropped-item {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    justify-content: space-between;
}

.remove-item-btn {
    background: rgba(255, 255, 255, 0.3);
    border: none;
    color: white;
    border-radius: 3px;
    padding: 2px 6px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
}

.remove-item-btn:hover {
    background: rgba(255, 255, 255, 0.5);
}

.drop-zone-correct {
    border-color: #4caf50;
    background: #f1f8f4;
}

.drop-zone-correct .dropped-item {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
}

.drop-zone-incorrect {
    border-color: #f44336;
    background: #fef5f5;
}

.drop-zone-incorrect .dropped-item {
    background: linear-gradient(135deg, #f44336 0%, #da190b 100%);
}

/* ============================================
   BUTTON GROUP
   ============================================ */

.button-group {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-check {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    flex: 1;
    min-width: 120px;
}

.btn-check:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-check:active {
    transform: translateY(0);
}

.btn-reset {
    background: #f5f5f5;
    color: #333;
    border: 2px solid #ddd;
    flex: 1;
    min-width: 100px;
}

.btn-reset:hover {
    background: #efefef;
    border-color: #999;
}

.btn-analytics {
    background: #ff9800;
    color: white;
    flex: 1;
    min-width: 120px;
}

.btn-analytics:hover {
    background: #f57c00;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.4);
}

/* ============================================
   FEEDBACK SECTION
   ============================================ */

.feedback-section {
    background: #f5f5f5;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    animation: slideIn 0.3s ease;
}

.feedback-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.feedback-icon {
    font-size: 28px;
}

.feedback-text {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.feedback-correct {
    background: #e8f5e9;
    border-left: 4px solid #4caf50;
}

.feedback-correct .feedback-text {
    color: #2e7d32;
}

.feedback-incorrect {
    background: #ffebee;
    border-left: 4px solid #f44336;
}

.feedback-incorrect .feedback-text {
    color: #c62828;
}

/* ============================================
   ANALYTICS PANEL
   ============================================ */

.analytics-panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 20px;
    margin-top: 20px;
    animation: slideIn 0.3s ease;
}

.analytics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.analytics-header h3 {
    font-size: 16px;
    color: #333;
    margin: 0;
}

.close-btn {
    background: #f5f5f5;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
}

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

.analytics-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Stats Summary */
.stats-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.stat-label {
    font-size: 12px;
    font-weight: 600;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    margin-top: 8px;
}

/* Log Section */
.log-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.log-header {
    font-size: 13px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.log-container {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 12px;
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.log-entry {
    background: white;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 12px;
    border-left: 3px solid #667eea;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.log-entry.correct {
    border-left-color: #4caf50;
    background: #f1f8f4;
}

.log-entry.incorrect {
    border-left-color: #f44336;
    background: #fef5f5;
}

.log-time {
    font-weight: 600;
    color: #999;
    min-width: 50px;
}

.log-text {
    flex: 1;
    margin: 0 10px;
    color: #333;
}

.log-result {
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
}

.log-result.correct {
    background: #4caf50;
    color: white;
}

.log-result.incorrect {
    background: #f44336;
    color: white;
}

/* Organism Performance */
.organism-performance {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.perf-header {
    font-size: 13px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.perf-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.perf-item {
    background: white;
    padding: 12px;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #e0e0e0;
}

.perf-organism {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    color: #333;
}

.perf-organism-emoji {
    font-size: 20px;
}

.perf-stats {
    display: flex;
    gap: 15px;
    font-size: 12px;
}

.perf-stat {
    text-align: center;
}

.perf-stat-label {
    color: #999;
    font-size: 11px;
    text-transform: uppercase;
}

.perf-stat-value {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

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

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

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

@media (max-width: 768px) {
    .quiz-content {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .stats-summary {
        grid-template-columns: 1fr;
    }

    .button-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .organism-selector {
        justify-content: space-around;
    }
}

/* ============================================
   IFRAME OPTIMIZATION
   ============================================ */

@media (max-height: 600px) {
    .main-panel {
        min-height: auto;
        padding: 15px;
    }

    .quiz-content {
        min-height: 180px;
    }

    .stages-container,
    .timeline-container {
        min-height: 150px;
    }

    .button-group {
        gap: 5px;
    }

    .btn {
        padding: 8px 12px;
        font-size: 13px;
    }
}