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

/* Container adapts to iframe or full browser */
.container {
    width: 100%;
    height: 450px; /* Default iframe height */
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Full browser height when not in iframe */
@media (min-height: 500px) {
    .container {
        height: 90vh;
    }
}

/* Control panel styling */
.control-panel {
    background: rgba(255, 255, 255, 0.95);
    padding: 12px;
    border-bottom: 2px solid #4caf50;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.hormone-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Button styling optimized for touch and mouse */
.hormone-btn, .reset-btn {
    padding: 10px 16px;
    border: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 44px; /* Touch-friendly minimum */
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.hormone-btn {
    background: linear-gradient(135deg, #4caf50, #45a049);
    color: white;
}

.hormone-btn.active {
    background: linear-gradient(135deg, #2e7d32, #388e3c);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transform: translateY(-1px);
}

.hormone-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.reset-btn {
    background: linear-gradient(135deg, #ff9800, #f57c00);
    color: white;
}

.reset-btn:hover {
    background: linear-gradient(135deg, #f57c00, #ef6c00);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

/* Status panel */
.status-panel {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-label {
    font-weight: 600;
    color: #2e7d32;
    font-size: 13px;
}

.status-value {
    padding: 4px 12px;
    border-radius: 15px;
    font-weight: bold;
    font-size: 13px;
}

.status-value.present {
    background: #c8e6c9;
    color: #1b5e20;
}

.status-value.absent {
    background: #ffcdd2;
    color: #c62828;
}

/* Plant container */
.plant-container {
    flex: 1;
    display: flex;
    position: relative;
    background: linear-gradient(to bottom, #87ceeb 0%, #e0f6ff 30%, #e8f5e8 100%);
}

/* Ruler for height measurement */
.ruler {
    width: 60px;
    background: rgba(255, 255, 255, 0.9);
    border-right: 2px solid #666;
    position: relative;
    display: flex;
    flex-direction: column-reverse;
    padding: 10px 5px;
}

.ruler-mark {
    height: calc(100% / 6);
    border-top: 1px solid #666;
    font-size: 11px;
    color: #333;
    display: flex;
    align-items: flex-start;
    padding-left: 5px;
    font-weight: 600;
}

/* Plant area */
.plant-area {
    flex: 1;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding: 20px;
}

/* Soil base */
.soil {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(to bottom, #8d6e63, #5d4037);
    border-radius: 5px 5px 0 0;
}

/* Tomato plant structure */
.tomato-plant {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 1.5s ease-in-out;
    z-index: 2;
}

/* Main stem */
.stem {
    width: 8px;
    height: 120px; /* Initial height */
    background: linear-gradient(to right, #4caf50, #66bb6a);
    border-radius: 4px;
    position: relative;
    transition: height 1.5s ease-in-out;
    box-shadow: inset -2px 0 4px rgba(0, 0, 0, 0.2);
}

/* Leaf pairs */
.leaf-pair {
    position: absolute;
    display: flex;
    width: 80px;
    justify-content: space-between;
    transition: all 1.5s ease-in-out;
}

.leaf-1 { bottom: 30px; }
.leaf-2 { bottom: 60px; }
.leaf-3 { bottom: 90px; }

.leaf {
    width: 25px;
    height: 15px;
    background: linear-gradient(45deg, #4caf50, #66bb6a);
    border-radius: 0 100% 0 100%;
    position: relative;
    transition: all 1.5s ease-in-out;
}

.leaf.left {
    transform: rotate(-30deg);
}

.leaf.right {
    transform: rotate(30deg);
}

.leaf::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1px;
    height: 80%;
    background: #2e7d32;
    transform: translate(-50%, -50%);
}

/* Growing tip */
.growing-tip {
    width: 12px;
    height: 12px;
    background: radial-gradient(circle, #8bc34a, #4caf50);
    border-radius: 50%;
    position: absolute;
    top: -6px;
    transition: all 1.5s ease-in-out;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
}

/* Hormone particles animation */
.hormone-particles {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 1;
}

.hormone-particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: radial-gradient(circle, #ffeb3b, #ffc107);
    border-radius: 50%;
    animation: floatUp 3s linear infinite;
    opacity: 0;
}

@keyframes floatUp {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    50% {
        opacity: 0.8;
        transform: translateY(-50px) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translateY(-100px) scale(0.5);
    }
}

/* Plant growth states */
.tomato-plant.with-hormone .stem {
    height: 200px; /* Taller with hormone */
}

.tomato-plant.with-hormone .leaf-1 { bottom: 40px; }
.tomato-plant.with-hormone .leaf-2 { bottom: 100px; }
.tomato-plant.with-hormone .leaf-3 { bottom: 160px; }

.tomato-plant.with-hormone .leaf {
    width: 35px;
    height: 20px;
}

.tomato-plant.without-hormone .stem {
    height: 80px; /* Shorter without hormone */
}

.tomato-plant.without-hormone .leaf-1 { bottom: 20px; }
.tomato-plant.without-hormone .leaf-2 { bottom: 45px; }
.tomato-plant.without-hormone .leaf-3 { bottom: 65px; }

.tomato-plant.without-hormone .leaf {
    width: 20px;
    height: 12px;
}

/* Tooltip styling */
.tooltip {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #4caf50;
    border-radius: 10px;
    padding: 20px;
    max-width: 300px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.tooltip.show {
    opacity: 1;
    visibility: visible;
}

.tooltip h3 {
    color: #2e7d32;
    margin-bottom: 10px;
    font-size: 16px;
}

.tooltip p {
    color: #333;
    line-height: 1.4;
    font-size: 14px;
}

/* Mobile responsiveness */
@media (max-width: 600px) {
    .control-panel {
        padding: 8px;
        flex-direction: column;
        align-items: stretch;
    }
    
    .hormone-controls {
        justify-content: center;
    }
    
    .status-panel {
        justify-content: center;
        font-size: 12px;
    }
    
    .ruler {
        width: 50px;
    }
    
    .ruler-mark {
        font-size: 10px;
    }
    
    .tooltip {
        max-width: 250px;
        padding: 15px;
    }
}