/* Reset and base 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%);
    min-height: 100vh;
    padding: 10px;
}

/* Container styles - increased height to show all options */
.container {
    width: 100%;
    /* Increased height to accommodate all content */
    min-height: calc(100vh - 20px);
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    padding: 15px;
    display: flex;
    flex-direction: column;
    overflow: visible;
}

/* Iframe specific height adjustment */
@media (max-height: 500px) {
    .container {
        min-height: 600px;
    }
}

/* Progress section */
.progress-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px 0;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    margin-right: 15px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #45a049);
    width: 0%;
    transition: width 0.3s ease;
}

.score-display {
    font-weight: bold;
    color: #333;
    font-size: 16px;
    min-width: 80px;
}

/* Assessment area - adjusted for better vertical space */
.assessment-area {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 15px;
    min-height: 500px;
}

.section-title {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
    text-align: center;
    padding: 8px;
    background: #f5f5f5;
    border-radius: 6px;
    cursor: help;
}

/* Graphs section - Adjusted height for better visibility */
.graphs-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 8px;
    min-height: 450px;
    padding: 5px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.graph-item {
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 8px;
    cursor: grab;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.graph-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    border-color: #667eea;
}

.graph-item.dragging {
    opacity: 0.7;
    transform: rotate(5deg);
    cursor: grabbing;
}

.graph-item.matched {
    background: #e8f5e8;
    border-color: #4CAF50;
    cursor: default;
}

/* Graph canvas - Adjusted size */
.graph-canvas {
    width: 100%;
    height: 80px;
    border: 1px solid #eee;
    border-radius: 4px;
    margin-bottom: 5px;
}

.graph-label {
    font-size: 12px;
    color: #666;
    text-align: center;
}

/* Equations section - Increased height to show all zones */
.equations-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 500px;
    padding: 5px;
    overflow-y: auto;
}

.equation-zone {
    background: #f9f9f9;
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 15px;
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
    position: relative;
}

.equation-zone:hover {
    background: #f0f8ff;
    border-color: #667eea;
}

.equation-zone.drag-over {
    background: #e3f2fd;
    border-color: #2196F3;
    border-style: solid;
}

.equation-zone.correct {
    background: #e8f5e8;
    border-color: #4CAF50;
    border-style: solid;
}

.equation-zone.incorrect {
    background: #ffebee;
    border-color: #f44336;
    border-style: solid;
}

.equation-text {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    font-family: 'Courier New', monospace;
}

.equation-zone .graph-item {
    margin-left: 10px;
    min-height: 60px;
    flex-shrink: 0;
}

/* Controls */
.controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
    white-space: nowrap;
}

.btn-check {
    background: #4CAF50;
    color: white;
}

.btn-check:hover {
    background: #45a049;
    transform: translateY(-1px);
}

.btn-reset {
    background: #ff9800;
    color: white;
}

.btn-reset:hover {
    background: #e68900;
    transform: translateY(-1px);
}

.btn-hint {
    background: #2196F3;
    color: white;
}

.btn-hint:hover {
    background: #1976D2;
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Feedback */
.feedback {
    min-height: 40px;
    padding: 10px;
    border-radius: 6px;
    text-align: center;
    font-weight: bold;
    transition: all 0.3s ease;
}

.feedback.success {
    background: #e8f5e8;
    color: #2e7d32;
    border: 1px solid #4CAF50;
}

.feedback.error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #f44336;
}

.feedback.info {
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #2196F3;
}

/* Tooltip */
.tooltip {
    position: absolute;
    background: rgba(0,0,0,0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    max-width: 200px;
    text-align: center;
}

.tooltip.show {
    opacity: 1;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
        min-height: calc(100vh - 20px);
    }
    
    .assessment-area {
        grid-template-columns: 1fr;
        gap: 15px;
        min-height: 800px;
    }
    
    /* Modified for mobile to show all graphs */
    .graphs-container {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: repeat(2, 1fr);
        min-height: 280px;
        max-height: none;
    }
    
    .equations-container {
        min-height: 450px;
    }
    
    .controls {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 200px;
    }
    
    .equation-zone {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .equation-zone .graph-item {
        margin-left: 0;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .graph-item {
        min-height: 90px;
        padding: 10px;
    }
    
    .btn {
        padding: 16px 24px;
        min-height: 48px;
    }
    
    .equation-zone {
        min-height: 100px;
        padding: 20px;
    }
}
