/* Reset and base styles for consistent rendering */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Comic Sans MS', cursive, sans-serif;
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
    overflow: hidden;
}

/* Main container that adapts to iframe (450px) or full screen (90vh) */
.container {
    width: 100%;
    height: 450px; /* Default for iframe */
    padding: 10px;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Full screen mode detection - when not in iframe */
@media screen and (min-height: 500px) {
    .container {
        height: 90vh;
        padding: 20px;
    }
}

/* Tooltip for header information - cognitive load reduction */
.tooltip {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    max-width: 250px;
}

/* Show tooltip on main panel hover */
.main-panel:hover .tooltip {
    opacity: 1;
    visibility: visible;
}

/* Main interactive panel with visual hierarchy */
.main-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 16px;
    padding: 15px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    position: relative;
}

/* Chart container using flexbox for responsive layout */
.chart-container {
    flex: 1;
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    gap: 8px;
    padding: 20px 10px;
    background: #fafafa;
    border-radius: 12px;
    margin-bottom: 15px;
}

/* Individual fruit bar styling with touch-friendly targets */
.fruit-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s ease;
    min-width: 60px;
    padding: 5px;
}

/* Hover and active states for interaction feedback */
.fruit-bar:hover {
    transform: translateY(-3px);
}

.fruit-bar:active {
    transform: translateY(-1px);
}

/* Fruit information section */
.fruit-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 8px;
}

/* Large emoji images for visual appeal and recognition */
.fruit-image {
    font-size: 2.5em;
    margin-bottom: 4px;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.2));
}

/* Simple, clear labels following Singapore curriculum style */
.fruit-label {
    font-size: 12px;
    font-weight: bold;
    color: #333;
    text-align: center;
}

/* Bar container for the actual chart bars */
.bar-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 120px;
    position: relative;
}

/* Colorful bars with gradients for visual appeal */
.bar {
    width: 40px;
    border-radius: 8px 8px 0 0;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

/* Individual fruit bar colors with gradients */
.apple-bar {
    background: linear-gradient(to top, #ff6b6b, #ff8e8e);
}

.banana-bar {
    background: linear-gradient(to top, #ffd93d, #ffe066);
}

.orange-bar {
    background: linear-gradient(to top, #ff8c42, #ffab66);
}

.grape-bar {
    background: linear-gradient(to top, #9b59b6, #b370cf);
}

.strawberry-bar {
    background: linear-gradient(to top, #e74c3c, #f16c5c);
}

/* Vote display styling - hidden initially for discovery learning */
.vote-display {
    margin-top: 8px;
    font-size: 18px;
    font-weight: bold;
    color: #2c3e50;
    background: white;
    padding: 4px 8px;
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Show votes when bar is clicked */
.fruit-bar.clicked .vote-display {
    opacity: 1;
}

/* Instructions section for guidance */
.instructions {
    text-align: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 14px;
    color: #495057;
}

/* Most popular fruit indicator */
.most-popular {
    margin-top: 10px;
    padding: 8px 12px;
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    border-radius: 20px;
    font-weight: bold;
    color: #333;
    display: inline-block;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
}

.crown {
    font-size: 1.2em;
    margin-right: 5px;
}

/* Mobile-first responsive design */
@media (max-width: 480px) {
    .chart-container {
        gap: 4px;
        padding: 15px 5px;
    }
    
    .fruit-bar {
        min-width: 50px;
    }
    
    .fruit-image {
        font-size: 2em;
    }
    
    .fruit-label {
        font-size: 10px;
    }
    
    .bar {
        width: 35px;
    }
    
    .bar-container {
        height: 100px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .fruit-bar {
        min-width: 70px;
        padding: 8px;
    }
    
    .bar {
        width: 45px;
    }
}