/* 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%);
    color: #333;
    overflow-x: hidden;
}

/* Container with responsive height */
.container {
    width: 100%;
    height: 450px; /* Default iframe height */
    display: flex;
    gap: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
}

/* Responsive height for full browser */
@media (min-height: 600px) {
    body:not(.iframe-mode) .container {
        height: 90vh;
    }
}

/* Control Panel - Left side */
.control-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 15px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    min-width: 200px;
}

/* Slider Groups */
.slider-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.slider-label {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 5px;
}

.slider {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #4a90e2;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.3);
    transition: all 0.3s ease;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.5);
}

.slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #4a90e2;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.3);
}

.slider-marks {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

/* BMI Output */
.bmi-output {
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.bmi-value {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 5px;
}

.bmi-category {
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* BMI Category Colors */
.bmi-output.underweight {
    background: #e3f2fd;
    border-color: #2196f3;
    color: #1976d2;
}

.bmi-output.healthy {
    background: #e8f5e8;
    border-color: #4caf50;
    color: #2e7d32;
}

.bmi-output.overweight {
    background: #fff3e0;
    border-color: #ff9800;
    color: #f57c00;
}

.bmi-output.obese {
    background: #ffebee;
    border-color: #f44336;
    color: #d32f2f;
}

/* Formula Display */
.formula-display {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    text-align: center;
    border: 1px solid #dee2e6;
}

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

.action-btn {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    background: #4a90e2;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 44px; /* Touch-friendly size */
}

.action-btn:hover {
    background: #357abd;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.action-btn:active {
    transform: translateY(0);
}

/* Human Figure Container */
.figure-container {
    flex: 1.5;
    display: flex;
    justify-content: center;
    align-items: center;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

.human-svg {
    width: 100%;
    max-width: 200px;
    height: auto;
    transition: all 0.3s ease;
}

/* Reference Panel - Right side */
.reference-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 15px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    min-width: 180px;
}

.reference-title {
    font-size: 18px;
    font-weight: bold;
    color: #2c3e50;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 2px solid #ecf0f1;
    cursor: help;
}

.bmi-categories {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.category-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    flex-shrink: 0;
}

.category-text {
    font-size: 13px;
    line-height: 1.3;
}

/* Category Colors */
.underweight .category-color { background: #2196f3; }
.healthy .category-color { background: #4caf50; }
.overweight .category-color { background: #ff9800; }
.obese .category-color { background: #f44336; }

.explanation {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.4;
    border-left: 4px solid #4a90e2;
}

.explanation p {
    cursor: help;
}

/* Questions Panel */
.questions-panel {
    background: #e8f4fd;
    padding: 12px;
    border-radius: 8px;
    border-left: 4px solid #4a90e2;
}

.question-title {
    font-weight: bold;
    margin-bottom: 8px;
    color: #2c3e50;
}

.question-list {
    list-style: none;
    font-size: 13px;
    line-height: 1.4;
}

.question-list li {
    margin-bottom: 6px;
    padding-left: 15px;
    position: relative;
}

.question-list li:before {
    content: "?";
    position: absolute;
    left: 0;
    color: #4a90e2;
    font-weight: bold;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 15% auto;
    padding: 20px;
    border-radius: 12px;
    width: 80%;
    max-width: 500px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
        gap: 10px;
        padding: 10px;
        height: auto;
        min-height: 450px;
    }
    
    .control-panel,
    .reference-panel {
        flex: none;
        min-width: auto;
    }
    
    .figure-container {
        order: -1;
        flex: none;
        height: 200px;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .action-btn {
        width: 100%;
    }
    
    .slider-label {
        font-size: 14px;
    }
    
    .bmi-value {
        font-size: 20px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .slider::-webkit-slider-thumb {
        width: 28px;
        height: 28px;
    }
    
    .action-btn {
        min-height: 48px;
        font-size: 16px;
    }
    
    .category-item {
        padding: 12px 8px;
    }
}