/* 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: hidden;
}

/* Main container with responsive height */
.container {
    width: 100%;
    height: 450px; /* Default iframe height */
    display: flex;
    flex-direction: column;
    padding: 8px;
    gap: 8px;
}

/* Responsive height for full browser */
@media (min-height: 500px) and (min-width: 800px) {
    .container {
        height: 90vh;
        padding: 12px;
        gap: 12px;
    }
}

/* Control panel styling */
.control-panel {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    backdrop-filter: blur(10px);
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 120px;
    flex: 1;
}

.bounds-group {
    display: flex;
    gap: 12px;
    flex: 1;
}

.bounds-group .control-group {
    min-width: 100px;
}

/* Form elements styling */
label {
    font-size: 12px;
    font-weight: 600;
    color: #555;
    white-space: nowrap;
}

select, input[type="number"] {
    padding: 6px 8px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 12px;
    background: white;
    transition: all 0.3s ease;
    height: 32px;
}

select:focus, input[type="number"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Range slider styling */
input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e1e5e9;
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    background: #5a6fd8;
}

/* Canvas container */
.canvas-container {
    flex: 1;
    background: white;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#graph-canvas {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Results panel */
.results-panel {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-around;
    gap: 12px;
    backdrop-filter: blur(10px);
}

.result-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1;
    padding: 8px;
    border-radius: 8px;
    background: rgba(102, 126, 234, 0.1);
    transition: all 0.3s ease;
}

.result-item:hover {
    background: rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
}

.result-item .label {
    font-size: 11px;
    font-weight: 600;
    color: #666;
    text-align: center;
}

.result-item span:last-child {
    font-size: 14px;
    font-weight: 700;
    color: #333;
    text-align: center;
}

/* Tooltip styling */
.tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1000;
    max-width: 200px;
    text-align: center;
}

.tooltip.show {
    opacity: 1;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .control-panel {
        padding: 8px;
        gap: 8px;
    }
    
    .bounds-group {
        flex-direction: column;
        gap: 8px;
    }
    
    .results-panel {
        padding: 8px;
        gap: 8px;
    }
    
    .result-item .label {
        font-size: 10px;
    }
    
    .result-item span:last-child {
        font-size: 12px;
    }
    
    label {
        font-size: 11px;
    }
    
    select, input[type="number"] {
        font-size: 11px;
        height: 28px;
        padding: 4px 6px;
    }
}

/* Touch-friendly targets */
@media (hover: none) and (pointer: coarse) {
    input[type="range"]::-webkit-slider-thumb {
        width: 24px;
        height: 24px;
    }
    
    .control-group {
        min-height: 44px;
    }
    
    select, input[type="number"] {
        min-height: 44px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
}