/* 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, #e8f5e8 0%, #f0f8f0 100%);
    overflow: hidden;
}

/* Main container with responsive height */
.container {
    display: flex;
    width: 100%;
    height: 450px; /* Default iframe height */
    padding: 10px;
    gap: 15px;
}

/* Detect if running in full browser (not iframe) */
@media screen and (min-height: 500px) {
    body:not(.iframe-mode) .container {
        height: 90vh;
    }
}

/* Left panel for controls and plant */
.left-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 200px;
}

/* Right panel for data and graph */
.right-panel {
    flex: 1.2;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 250px;
}

/* Controls section styling */
.controls-section {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.control-group {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.control-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.9em;
    color: #2c5530;
}

/* Info icon styling */
.info-icon {
    cursor: help;
    font-size: 0.8em;
    color: #007acc;
    transition: transform 0.2s ease;
}

.info-icon:hover {
    transform: scale(1.2);
}

/* Slider styling */
.slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    transition: background 0.3s ease;
}

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

.slider::-webkit-slider-thumb:hover {
    background: #45a049;
    transform: scale(1.1);
}

.value-display {
    font-weight: bold;
    color: #2c5530;
    font-size: 0.9em;
    text-align: right;
}

/* Plant container and SVG - MODIFIED: Reduced size to fit better in frame */
.plant-container {
    flex: 0.8; /* Reduced from 1 to 0.8 to make plant container smaller */
    background: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    padding: 8px; /* Reduced padding from 10px to 8px */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    max-height: 180px; /* Added max-height to constrain plant size */
}

.plant-svg {
    max-width: 85%; /* Reduced from 100% to 85% to make plant smaller */
    max-height: 85%; /* Reduced from 100% to 85% to make plant smaller */
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.1));
}

.leaf {
    transition: fill 0.3s ease;
}

/* Sensor panel styling */
.sensor-panel {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    gap: 20px;
}

.sensor-reading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.sensor-label {
    font-size: 0.8em;
    color: #666;
    font-weight: 500;
}

.sensor-value {
    font-size: 1.1em;
    font-weight: bold;
    color: #2c5530;
}

/* Button styling */
.button-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.control-btn {
    flex: 1;
    min-width: 60px;
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

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

.control-btn.primary:hover:not(:disabled) {
    background: #45a049;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.3);
}

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

.control-btn.secondary:hover:not(:disabled) {
    background: #1976D2;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(33, 150, 243, 0.3);
}

.control-btn.tertiary {
    background: #FF9800;
    color: white;
}

.control-btn.tertiary:hover:not(:disabled) {
    background: #F57C00;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(255, 152, 0, 0.3);
}

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

/* Graph container */
.graph-container {
    flex: 1;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
}

#transpirationGraph {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
}

/* Guided mode toggle */
.guided-mode {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
}

.toggle-label input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    width: 40px;
    height: 20px;
    background: #ccc;
    border-radius: 10px;
    position: relative;
    transition: background 0.3s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    top: 2px;
    left: 2px;
    transition: transform 0.3s ease;
}

.toggle-label input:checked + .toggle-slider {
    background: #4CAF50;
}

.toggle-label input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

/* Tooltip styling */
.tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.8em;
    max-width: 200px;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    line-height: 1.3;
}

.tooltip.show {
    opacity: 1;
}

/* Guided instructions */
.guided-instructions {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 193, 7, 0.95);
    color: #333;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s ease;
    max-width: 80%;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.guided-instructions.show {
    opacity: 1;
}

/* Water vapor particle animation - MODIFIED: Much faster animation for ultra-speeded simulation */
.vapor-particle {
    fill: #87CEEB;
    opacity: 0.7;
    animation: float-up 0.3s ease-out infinite; /* Reduced from 1s to 0.3s for ultra-fast animation */
}

@keyframes float-up {
    0% {
        transform: translateY(0) scale(1);
        opacity: 0.7;
    }
    100% {
        transform: translateY(-30px) scale(0.5);
        opacity: 0;
    }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
        gap: 10px;
        padding: 5px;
    }
    
    .left-panel, .right-panel {
        min-width: unset;
    }
    
    .button-group {
        justify-content: space-between;
    }
    
    .control-btn {
        font-size: 0.8em;
        padding: 6px 8px;
    }
    
    .sensor-panel {
        flex-direction: column;
        gap: 10px;
    }
}