/* Global reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    touch-action: manipulation;
}

/* Main container - adapts to iframe or standalone */
.container {
    width: 100%;
    height: 450px; /* Default iframe height */
    display: flex;
    flex-direction: column;
    position: relative;
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
}

/* Standalone mode - full viewport height */
@media (min-height: 500px) {
    body:not(.iframe-mode) .container {
        height: 90vh;
    }
}

/* Info icon for header tooltip */
.info-icon {
    position: absolute;
    top: 8px;
    right: 12px;
    font-size: 20px;
    cursor: pointer;
    z-index: 100;
    background: rgba(255, 255, 255, 0.9);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
}

.info-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 10px rgba(0,0,0,0.25);
}

/* Tooltip styling */
.tooltip {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(33, 33, 33, 0.95);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
    max-width: 80%;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.tooltip.show {
    opacity: 1;
}

/* Main experiment area - horizontal layout */
.experiment-area {
    display: flex;
    flex: 1;
    gap: 12px;
    padding: 8px 12px;
    overflow: hidden;
}

/* Left control panel */
.control-panel {
    width: 280px;
    background: white;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
}

.panel-title {
    font-size: 16px;
    font-weight: 700;
    color: #2e7d32;
    text-align: center;
    padding-bottom: 8px;
    border-bottom: 2px solid #81c784;
}

/* Light option buttons */
.light-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.light-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 600;
    color: #424242;
    min-height: 48px;
}

.light-btn:hover {
    border-color: #66bb6a;
    background: #f1f8e9;
    transform: translateX(4px);
    box-shadow: 0 3px 8px rgba(0,0,0,0.12);
}

.light-btn.active {
    border-color: #43a047;
    background: #e8f5e9;
    box-shadow: 0 3px 10px rgba(67, 160, 71, 0.3);
}

.light-btn .icon {
    font-size: 24px;
}

.light-btn .label {
    flex: 1;
}

/* Time control slider */
.time-control {
    background: #f5f5f5;
    padding: 12px;
    border-radius: 10px;
}

.control-label {
    font-size: 14px;
    font-weight: 600;
    color: #424242;
    margin-bottom: 8px;
    text-align: center;
}

#timeSlider {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: #dcedc8;
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

#timeSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #43a047;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
}

#timeSlider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: #2e7d32;
}

#timeSlider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #43a047;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.day-markers {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #757575;
    margin-top: 4px;
}

/* Action buttons */
.action-buttons {
    display: flex;
    gap: 8px;
}

.action-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    white-space: nowrap;
}

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

.reset-btn:hover {
    background: #f4511e;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(244, 81, 30, 0.3);
}

/* Observation box */
.observation-box {
    background: #fff9c4;
    border-radius: 10px;
    padding: 12px;
    border-left: 4px solid #fbc02d;
}

.obs-title {
    font-size: 13px;
    font-weight: 700;
    color: #f57f17;
    margin-bottom: 6px;
}

.obs-text {
    font-size: 12px;
    color: #424242;
    line-height: 1.5;
}

/* Right display panel */
.display-panel {
    flex: 1;
    background: white;
    border-radius: 12px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    overflow: hidden;
    position: relative;
}

.plant-container {
    width: 100%;
    height: 100%;
    position: relative;
}

/* Background that changes with light intensity */
.background {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 20px;
    transition: background 0.5s ease;
}

.no-light-bg {
    background: linear-gradient(to bottom, #1a237e 0%, #283593 50%, #3949ab 100%);
}

.some-light-bg {
    background: linear-gradient(to bottom, #81d4fa 0%, #4fc3f7 50%, #29b6f6 100%);
}

.bright-light-bg {
    background: linear-gradient(to bottom, #fff59d 0%, #ffeb3b 30%, #81d4fa 100%);
}

/* Sun indicator */
.sun-indicator {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    opacity: 0;
    transition: all 0.5s ease;
}

.some-light-bg .sun-indicator {
    background: radial-gradient(circle, #fff59d 0%, #ffeb3b 50%, transparent 70%);
    opacity: 0.6;
    box-shadow: 0 0 30px #ffeb3b;
}

.bright-light-bg .sun-indicator {
    background: radial-gradient(circle, #fff59d 0%, #ffeb3b 50%, #fdd835 70%);
    opacity: 1;
    box-shadow: 0 0 50px #fdd835;
}

/* Plant pot */
.pot {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    z-index: 1;
}

.pot-rim {
    width: 120px;
    height: 12px;
    background: #d84315;
    border-radius: 6px 6px 0 0;
    position: relative;
    z-index: 3;
}

.pot-body {
    width: 110px;
    height: 70px;
    background: linear-gradient(to bottom, #e64a19 0%, #d84315 100%);
    margin: 0 auto;
    border-radius: 0 0 8px 8px;
    position: relative;
    z-index: 2;
}

.soil {
    width: 110px;
    height: 25px;
    background: #5d4037;
    position: absolute;
    top: 12px;
    left: 5px;
    border-radius: 50% 50% 0 0;
    z-index: 4;
}

/* Plant structure */
.plant {
    position: absolute;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 0;
    transition: height 0.5s ease;
    z-index: 5;
}

.stem {
    width: 10px;
    height: 100%;
    background: linear-gradient(to right, #558b2f 0%, #689f38 50%, #558b2f 100%);
    border-radius: 5px;
    position: relative;
}

/* Leaves */
.leaf {
    position: absolute;
    width: 30px;
    height: 20px;
    background: #66bb6a;
    border-radius: 0 50% 50% 0;
    opacity: 0;
    transition: all 0.5s ease;
}

.leaf-left-1 {
    left: -25px;
    bottom: 20%;
    transform: rotate(-45deg);
}

.leaf-right-1 {
    right: -25px;
    bottom: 20%;
    transform: rotate(45deg) scaleX(-1);
}

.leaf-left-2 {
    left: -25px;
    bottom: 50%;
    transform: rotate(-30deg);
}

.leaf-right-2 {
    right: -25px;
    bottom: 50%;
    transform: rotate(30deg) scaleX(-1);
}

.leaf-top {
    left: 50%;
    top: -15px;
    transform: translateX(-50%) rotate(90deg);
    width: 35px;
    height: 25px;
    border-radius: 50%;
}

/* Wilted/unhealthy leaves for no light */
.plant.unhealthy .leaf {
    background: #9e9d24;
}

.plant.unhealthy .stem {
    background: linear-gradient(to right, #827717 0%, #9e9d24 50%, #827717 100%);
}

/* Day counter */
.day-counter {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 700;
    color: #2e7d32;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* Learning summary at bottom */
.learning-summary {
    background: white;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
}

.summary-icon {
    font-size: 24px;
}

.summary-text {
    flex: 1;
    font-size: 13px;
    color: #424242;
    font-weight: 500;
    line-height: 1.4;
}

/* Responsive adjustments for smaller screens */
@media (max-width: 768px) {
    .control-panel {
        width: 240px;
    }
    
    .light-btn {
        font-size: 13px;
        padding: 8px 12px;
    }
    
    .pot {
        width: 100px;
    }
    
    .pot-rim {
        width: 100px;
    }
    
    .pot-body {
        width: 90px;
        height: 60px;
    }
    
    .soil {
        width: 90px;
    }
}