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

body {
    font-family: Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

/* Container styles - responsive height */
.container {
    width: 100%;
    height: 450px; /* Default iframe height */
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 15px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Adjust height when not in iframe */
@media (min-height: 600px) {
    .container {
        height: 90vh;
        max-height: 800px;
    }
}

/* Main panel container */
.panel-container {
    display: flex;
    flex: 1;
    gap: 10px;
    height: 100%;
}

/* Individual input panels */
.input-panel {
    flex: 1;
    border: 3px solid #333;
    border-radius: 10px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    transition: all 0.3s ease;
    min-width: 0; /* Prevent flex overflow */
}

.input-panel:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

/* Result panel styling */
.result-panel {
    flex: 1.2;
    border: 3px solid #333;
    border-radius: 10px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    transition: all 0.3s ease;
}

.result-panel:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

/* Panel labels */
.panel-label {
    font-size: clamp(0.7rem, 1.5vw, 1rem);
    font-weight: bold;
    text-align: center;
    margin-bottom: 8px;
    padding: 5px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.8);
    width: 100%;
    word-wrap: break-word;
    line-height: 1.2;
}

/* Input fields */
.input-field {
    width: 60px;
    height: 35px;
    font-size: clamp(0.8rem, 1.5vw, 1rem);
    text-align: center;
    border: 2px solid #333;
    border-radius: 5px;
    margin-bottom: 10px;
    background: white;
    transition: all 0.3s ease;
}

.input-field:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.3);
}

/* Vertical sliders */
.vertical-slider {
    writing-mode: bt-lr;
    -webkit-appearance: slider-vertical;
    width: 30px;
    height: 200px;
    flex: 1;
    background: linear-gradient(to top, #ff4444, #ffff44, #44ff44);
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.vertical-slider:hover {
    transform: scale(1.05);
}

.vertical-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: #333;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

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

/* Gender select dropdown */
.gender-select {
    width: 100%;
    height: 40px;
    font-size: clamp(0.8rem, 1.5vw, 1rem);
    border: 2px solid #333;
    border-radius: 5px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.gender-select:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.3);
}

/* Result display */
.result-display {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 10px 0;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    font-weight: bold;
}

#resultValue {
    background: white;
    padding: 8px 12px;
    border: 2px solid #333;
    border-radius: 5px;
    min-width: 80px;
    text-align: center;
    color: #333;
}

.percent-symbol {
    margin-left: 5px;
    font-size: clamp(1rem, 2vw, 1.5rem);
}

/* BAC Status indicator */
.bac-status {
    font-size: clamp(0.8rem, 1.5vw, 1rem);
    font-weight: bold;
    padding: 5px 10px;
    border-radius: 15px;
    text-align: center;
    transition: all 0.3s ease;
    margin-top: 5px;
}

.safe { 
    background: #4CAF50; 
    color: white; 
}

.caution { 
    background: #FF9800; 
    color: white; 
}

.danger { 
    background: #F44336; 
    color: white; 
}

.critical { 
    background: #9C27B0; 
    color: white; 
}

/* Knowledge base (hidden for assessment) */
.knowledge-base {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
    border: 2px solid #333;
}

.formula-section {
    margin-bottom: 20px;
}

.formula-section h3, .bac-effects h3 {
    color: #333;
    margin-bottom: 10px;
}

.formula-section p {
    background: #f0f0f0;
    padding: 10px;
    border-radius: 5px;
    font-family: monospace;
    font-size: 14px;
}

.bac-effects ul, .formula-section ul {
    list-style-type: none;
    padding-left: 0;
}

.bac-effects li, .formula-section li {
    padding: 5px 0;
    border-bottom: 1px solid #eee;
}

/* Error message */
.error-message {
    background: #ffebee;
    color: #c62828;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #e57373;
    margin-top: 10px;
    text-align: center;
    font-weight: bold;
}

/* Tooltip styles */
.container[title]:hover::after {
    content: attr(title);
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 5px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .panel-container {
        flex-direction: column;
        gap: 5px;
    }
    
    .input-panel, .result-panel {
        flex-direction: row;
        height: auto;
        min-height: 60px;
    }
    
    .vertical-slider {
        writing-mode: initial;
        -webkit-appearance: none;
        width: 100px;
        height: 20px;
        flex: 1;
    }
    
    .panel-label {
        flex: 1;
        margin-right: 10px;
        margin-bottom: 0;
    }
}

/* Touch-friendly targets */
@media (pointer: coarse) {
    .input-field, .gender-select {
        min-height: 44px;
    }
    
    .vertical-slider::-webkit-slider-thumb {
        width: 30px;
        height: 30px;
    }
}