/* 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%);
    height: 100vh;
    overflow: hidden;
}

/* Container styles - responsive height */
.container {
    width: 100%;
    height: 450px; /* Default iframe height */
    max-height: 90vh; /* For new tab */
    padding: 10px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-y: auto;
}

/* Phase indicator */
.phase-indicator {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
    background: #f8f9fa;
    border-radius: 25px;
    padding: 5px;
}

.phase {
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 14px;
}

.phase.active {
    background: #007bff;
    color: white;
    box-shadow: 0 2px 8px rgba(0,123,255,0.3);
}

.phase:not(.active):hover {
    background: #e9ecef;
}

/* Phase content */
.phase-content {
    display: none;
    flex: 1;
    overflow-y: auto;
}

.phase-content.active {
    display: flex;
    flex-direction: column;
}

/* Setup Phase Styles */
.setup-container {
    display: flex;
    gap: 20px;
    flex: 1;
}

.dye-selection {
    flex: 1;
}

.dye-selection h3 {
    font-size: 16px;
    margin-bottom: 10px;
    color: #333;
}

.dye-bottles {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.dye-bottle {
    cursor: grab;
    text-align: center;
    transition: transform 0.2s ease;
    padding: 8px;
    border-radius: 8px;
    background: #f8f9fa;
    border: 2px solid transparent;
}

.dye-bottle:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-color: #007bff;
}

.dye-bottle:active {
    cursor: grabbing;
}

.bottle {
    width: 40px;
    height: 60px;
    background: #ddd;
    border-radius: 5px 5px 15px 15px;
    margin: 0 auto 5px;
    position: relative;
    overflow: hidden;
}

.liquid {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 70%;
    border-radius: 0 0 12px 12px;
}

.w-dye { background: #ff6b6b; }
.x-dye { background: #4ecdc4; }
.y-dye { background: #45b7d1; }
.z-dye { background: #96ceb4; }
.f-dye { background: linear-gradient(45deg, #ff6b6b, #4ecdc4); }

.dye-bottle span {
    font-size: 12px;
    font-weight: 500;
}

/* Filter paper container */
.filter-paper-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.filter-paper {
    width: 200px;
    height: 250px;
    background: #f9f9f9;
    border: 2px solid #ddd;
    border-radius: 8px;
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.start-line {
    position: absolute;
    bottom: 40px;
    left: 10px;
    right: 10px;
    height: 2px;
    background: #333;
}

.spot-marker {
    position: absolute;
    bottom: 30px;
    font-size: 20px;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.spot-marker:hover {
    background: #e9ecef;
    transform: scale(1.2);
}

.spot-marker[data-spot="W"] { left: 25px; }
.spot-marker[data-spot="X"] { left: 60px; }
.spot-marker[data-spot="Y"] { left: 95px; }
.spot-marker[data-spot="Z"] { left: 130px; }
.spot-marker[data-spot="F"] { left: 165px; }

.dye-spot {
    position: absolute;
    bottom: 35px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.dye-spot.hidden {
    opacity: 0;
}

.dye-spot[data-spot="W"] { left: 30px; background: #ff6b6b; }
.dye-spot[data-spot="X"] { left: 65px; background: #4ecdc4; }
.dye-spot[data-spot="Y"] { left: 100px; background: #45b7d1; }
.dye-spot[data-spot="Z"] { left: 135px; background: #96ceb4; }
.dye-spot[data-spot="F"] { left: 170px; background: linear-gradient(45deg, #ff6b6b, #4ecdc4); }

/* Process Phase Styles */
.process-container {
    display: flex;
    gap: 20px;
    flex: 1;
}

.basin-setup {
    flex: 1;
}

.basin-setup h3 {
    font-size: 16px;
    margin-bottom: 10px;
    color: #333;
}

.basin {
    width: 150px;
    height: 100px;
    border: 3px solid #333;
    border-radius: 8px;
    position: relative;
    background: #f9f9f9;
    margin-bottom: 10px;
}

.water-level {
    position: absolute;
    bottom: 0;
    width: 100%;
    background: linear-gradient(to top, #4fc3f7, #81d4fa);
    border-radius: 0 0 5px 5px;
    transition: height 0.5s ease;
    height: 0;
}

.depth-marker {
    position: absolute;
    right: -30px;
    bottom: 20px;
    font-size: 12px;
    color: #666;
}

.chromatography-setup {
    flex: 2;
}

.basin-with-paper {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
}

.basin-full {
    width: 200px;
    height: 120px;
    border: 3px solid #333;
    border-radius: 8px;
    position: relative;
    background: #f9f9f9;
}

.water-full {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 25px;
    background: linear-gradient(to top, #4fc3f7, #81d4fa);
    border-radius: 0 0 5px 5px;
}

.filter-paper-in-water {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 10px;
}

.paper-strip {
    width: 120px;
    height: 100px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    position: relative;
}

.start-line-process {
    position: absolute;
    bottom: 15px;
    left: 5px;
    right: 5px;
    height: 1px;
    background: #333;
}

.chromatogram-spots {
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 10px;
    height: 80px;
}

.chromatogram-spot {
    position: absolute;
    bottom: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    transition: all 2s ease;
}

.chromatogram-spot[data-dye="W"] { left: 10px; background: #ff6b6b; }
.chromatogram-spot[data-dye="X"] { left: 30px; background: #4ecdc4; }
.chromatogram-spot[data-dye="Y"] { left: 50px; background: #45b7d1; }
.chromatogram-spot[data-dye="Z"] { left: 70px; background: #96ceb4; }
.chromatogram-spot[data-dye="F"] { left: 90px; background: linear-gradient(45deg, #ff6b6b, #4ecdc4); }

/* Time controls */
.time-controls {
    text-align: center;
}

.time-display {
    margin-top: 10px;
    font-weight: 500;
    color: #333;
}

/* Analysis Phase Styles */
.analysis-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.chromatogram-results h3 {
    font-size: 16px;
    margin-bottom: 10px;
    color: #333;
}

.results-grid {
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.result-column {
    flex: 1;
    text-align: center;
}

.result-column h4 {
    font-size: 14px;
    margin-bottom: 8px;
    color: #555;
}

.final-chromatogram {
    width: 100%;
    height: 120px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    position: relative;
}

/* Assessment section */
.assessment-section {
    text-align: center;
}

.assessment-panel {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin-top: 10px;
    border: 1px solid #dee2e6;
}

.reference-chromatogram {
    margin-bottom: 15px;
}

.reference-chromatogram img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.question p {
    margin-bottom: 10px;
    font-weight: 500;
}

#answer-input {
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 4px;
    margin-right: 10px;
    font-size: 16px;
    width: 60px;
    text-align: center;
    text-transform: uppercase;
}

#answer-input:focus {
    outline: none;
    border-color: #007bff;
}

.feedback {
    margin-top: 10px;
    padding: 10px;
    border-radius: 4px;
    font-weight: 500;
}

.feedback.correct {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.feedback.incorrect {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Button styles */
.next-btn, .fill-btn, .time-btn, .assessment-btn, .submit-btn, .control-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 40px;
    white-space: nowrap;
}

.next-btn, .time-btn, .submit-btn {
    background: #007bff;
    color: white;
}

.next-btn:hover, .time-btn:hover, .submit-btn:hover {
    background: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,123,255,0.3);
}

.fill-btn, .assessment-btn {
    background: #28a745;
    color: white;
}

.fill-btn:hover, .assessment-btn:hover {
    background: #1e7e34;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40,167,69,0.3);
}

.control-btn {
    background: #6c757d;
    color: white;
}

.control-btn:hover {
    background: #545b62;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(108,117,125,0.3);
}

.next-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Controls section */
.controls {
    margin-top: 15px;
    text-align: center;
    border-top: 1px solid #dee2e6;
    padding-top: 10px;
}

/* Utility classes */
.hidden {
    display: none !important;
}

/* Drag and drop styles */
.drag-over {
    background: #e3f2fd !important;
    border-color: #2196f3 !important;
}

.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .setup-container, .process-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .dye-bottles {
        justify-content: center;
    }
    
    .results-grid {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .result-column {
        min-width: 80px;
    }
    
    .phase {
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* Touch-friendly sizing for mobile */
@media (hover: none) and (pointer: coarse) {
    .dye-bottle, .spot-marker, button {
        min-height: 44px;
        min-width: 44px;
    }
    
    .phase {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}