/* 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%);
    overflow: hidden;
}

/* Main container - adapts to iframe or full screen */
.container {
    width: 100%;
    height: 450px;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    position: relative;
}

/* Adjust height when not in iframe (opened in new tab) */
@media (min-height: 600px) {
    body:not(.iframe-mode) .container {
        height: 90vh;
    }
}

/* Canvas for simulation visualization */
#simulationCanvas {
    flex: 1;
    width: 100%;
    background: linear-gradient(to bottom, #e3f2fd 0%, #f5f5f5 100%);
    cursor: crosshair;
    touch-action: none;
}

/* Control panel styling */
.control-panel {
    background: #f8f9fa;
    padding: 12px 16px;
    border-top: 2px solid #dee2e6;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
}

/* Control group for sliders */
.control-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 200px;
}

.control-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #495057;
    white-space: nowrap;
}

.label-icon {
    font-style: italic;
    font-weight: bold;
    color: #667eea;
    font-size: 16px;
}

.label-text {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Slider styling with enhanced visual feedback */
.slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #dee2e6;
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: background 0.3s ease;
}

.slider:hover {
    background: #ced4da;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

.slider::-webkit-slider-thumb:active {
    transform: scale(1.1);
}

.slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

/* Toggle group for checkboxes */
.toggle-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 12px;
    color: #495057;
    user-select: none;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.toggle-label:hover {
    background: #e9ecef;
}

.toggle-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #667eea;
}

.toggle-text {
    font-weight: 500;
    white-space: nowrap;
}

/* Information panel styling */
.info-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    width: 100%;
    padding: 8px;
    background: #ffffff;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.info-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    padding: 4px 8px;
    background: #f8f9fa;
    border-radius: 4px;
    border-left: 3px solid #667eea;
}

.info-label {
    font-weight: 600;
    color: #495057;
}

.info-value {
    font-weight: 700;
    color: #667eea;
    font-family: 'Courier New', monospace;
}

/* Tooltip styling */
.tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.85);
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 1000;
    max-width: 300px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    line-height: 1.4;
}

.tooltip.show {
    opacity: 1;
}

/* Responsive adjustments for smaller screens */
@media (max-width: 768px) {
    .control-panel {
        padding: 10px;
        gap: 10px;
    }
    
    .control-group {
        min-width: 150px;
    }
    
    .control-label {
        font-size: 12px;
    }
    
    .toggle-label {
        font-size: 11px;
    }
    
    .info-panel {
        gap: 8px;
    }
    
    .info-item {
        font-size: 11px;
        padding: 3px 6px;
    }
}

/* Accessibility improvements */
.slider:focus,
input[type="checkbox"]:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .control-panel {
        display: none;
    }
    
    .container {
        height: 100vh;
    }
}