/* 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%);
    /* Responsive height - 450px for iframe, 90vh for full page */
    height: 450px;
    width: 100%;
    overflow: hidden;
    touch-action: manipulation;
}

/* Check if running in full page mode */
@media (min-height: 500px) {
    body {
        height: 90vh;
    }
}

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

/* Graph container with coordinate system */
.graph-container {
    flex: 1;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
    min-height: 250px;
}

/* Canvas for drawing the graph */
#graphCanvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: crosshair;
}

/* Equation display overlay */
.equation-display {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(255, 255, 255, 0.95);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 18px;
    font-weight: bold;
    color: #2c3e50;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border: 2px solid #3498db;
    font-family: 'Courier New', monospace;
}

/* Controls panel */
.controls-panel {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Individual control groups */
.control-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Control labels */
.control-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    cursor: help;
}

.label-text {
    flex: 1;
}

.value-display {
    background: #ecf0f1;
    padding: 4px 8px;
    border-radius: 6px;
    min-width: 40px;
    text-align: center;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: #2c3e50;
}

/* Slider styles */
.slider {
    width: 100%;
    height: 40px;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    cursor: pointer;
    outline: none;
}

/* Slider track */
.slider::-webkit-slider-track {
    background: #ddd;
    height: 8px;
    border-radius: 4px;
    border: none;
}

.slider::-moz-range-track {
    background: #ddd;
    height: 8px;
    border-radius: 4px;
    border: none;
}

/* Slider thumb */
.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    height: 24px;
    width: 24px;
    border-radius: 50%;
    background: #3498db;
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.slider::-moz-range-thumb {
    height: 24px;
    width: 24px;
    border-radius: 50%;
    background: #3498db;
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

/* Hover and active states for sliders */
.slider:hover::-webkit-slider-thumb {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}

.slider:hover::-moz-range-thumb {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}

.slider:active::-webkit-slider-thumb {
    transform: scale(1.2);
}

.slider:active::-moz-range-thumb {
    transform: scale(1.2);
}

/* Different colors for different sliders */
.slope-slider::-webkit-slider-thumb {
    background: #e74c3c;
}

.slope-slider::-moz-range-thumb {
    background: #e74c3c;
}

.intercept-slider::-webkit-slider-thumb {
    background: #27ae60;
}

.intercept-slider::-moz-range-thumb {
    background: #27ae60;
}

/* Reset button */
.reset-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    min-height: 44px; /* Touch-friendly size */
}

.reset-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

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

/* Information tooltip */
.info-tooltip {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    max-width: 200px;
    text-align: center;
}

.info-tooltip.show {
    opacity: 1;
}

/* Mobile responsiveness */
@media (max-width: 480px) {
    .container {
        padding: 6px;
        gap: 6px;
    }
    
    .controls-panel {
        padding: 10px;
        gap: 10px;
    }
    
    .equation-display {
        font-size: 16px;
        padding: 6px 12px;
    }
    
    .control-label {
        font-size: 13px;
    }
    
    .slider {
        height: 44px; /* Larger touch target on mobile */
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .slider::-webkit-slider-track {
        background: #000;
    }
    
    .slider::-moz-range-track {
        background: #000;
    }
}