/* ============================================
   PROJECTILE MOTION SIMULATOR - STYLES
   ============================================
   This stylesheet defines the visual design for the
   projectile motion interactive simulation.
   Optimized for iframe (450px height) and full browser display (90vh)
   ============================================ */

* {
    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%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

/* Main container - responsive for iframe and full screen */
.container {
    width: 100%;
    max-width: 1200px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 20px;
    padding: 20px;
    max-height: 90vh;
    overflow-y: auto;
}

/* Responsive layout for smaller screens (iframe mode) */
@media (max-width: 900px) {
    .container {
        grid-template-columns: 1fr;
        max-height: 450px;
        overflow-y: auto;
    }
    
    .graph-section {
        grid-column: 1;
    }
}

/* ============================================
   CONTROL PANEL STYLING
   ============================================ */

.control-panel {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.panel-header {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    padding: 8px;
    cursor: help;
    opacity: 0.8;
}

/* Controls section - groups all input controls */
.controls-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* MODIFIED: New control-row class for inline-flex layout of 2 sliders */
.control-row {
    display: inline-flex;
    gap: 10px;
    width: 100%;
}

.control-row .control-group {
    flex: 1;
}

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

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.control-group label {
    font-size: 13px;
    font-weight: 500;
    color: #333;
}

.value-display {
    font-size: 13px;
    font-weight: 600;
    color: #667eea;
    min-width: 40px;
    text-align: right;
}

/* Slider styling */
.slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, #e0e0e0 0%, #667eea 100%);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
    transition: all 0.2s ease;
}

.slider::-webkit-slider-thumb:hover {
    background: #764ba2;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.6);
    transform: scale(1.2);
}

.slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
    transition: all 0.2s ease;
}

.slider::-moz-range-thumb:hover {
    background: #764ba2;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.6);
    transform: scale(1.2);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #999;
    margin-top: 2px;
}

/* Checkbox styling */
.checkbox-group {
    margin-top: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #333;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #667eea;
}

/* ============================================
   BUTTON STYLING
   ============================================ */

.button-group {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.btn {
    flex: 1;
    padding: 10px 12px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

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

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.btn-secondary:hover {
    background: #d0d0d0;
    transform: translateY(-2px);
}

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

/* ============================================
   RESULTS DISPLAY
   ============================================ */

.results-section {
    background: white;
    border-radius: 6px;
    padding: 12px;
    border: 1px solid #e0e0e0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.result-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    background: #f0f4ff;
    border-radius: 4px;
    border-left: 3px solid #667eea;
}

.result-label {
    font-size: 11px;
    color: #666;
    font-weight: 500;
}

.result-value {
    font-size: 16px;
    font-weight: 700;
    color: #667eea;
}

.result-unit {
    font-size: 11px;
    color: #999;
}

/* ============================================
   VISUALIZATION AREA
   ============================================ */

.visualization-area {
    position: relative;
    background: linear-gradient(180deg, #e8f4f8 0%, #f0f8fb 100%);
    border-radius: 8px;
    border: 2px solid #d0e8f2;
    overflow: hidden;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#trajectory-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Info tooltip - centered for iframe visibility */
.info-tooltip {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 12px;
    text-align: center;
    max-width: 200px;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

/* ============================================
   GRAPH SECTION
   ============================================ */

.graph-section {
    grid-column: 2;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

@media (max-width: 900px) {
    .graph-section {
        grid-column: 1;
        grid-template-columns: 1fr 1fr;
    }
}

.graph-container {
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

#height-graph,
#velocity-graph {
    width: 100%;
    height: 150px;
    display: block;
}

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

/* ============================================
   LEGEND
   ============================================ */

.legend {
    grid-column: 1 / -1;
    display: flex;
    gap: 20px;
    justify-content: center;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #333;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */

.container::-webkit-scrollbar {
    width: 8px;
}

.container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.container::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

.container::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.results-section {
    animation: slideIn 0.3s ease;
}

/* ============================================
   ACCESSIBILITY & RESPONSIVE
   ============================================ */

@media (max-height: 600px) {
    .container {
        max-height: 90vh;
    }
    
    .control-group {
        gap: 4px;
    }
    
    .btn {
        padding: 8px 10px;
        font-size: 12px;
    }
}

/* Touch-friendly target sizes */
@media (hover: none) and (pointer: coarse) {
    .slider::-webkit-slider-thumb {
        width: 24px;
        height: 24px;
    }
    
    .slider::-moz-range-thumb {
        width: 24px;
        height: 24px;
    }
    
    .btn {
        padding: 12px 14px;
    }
}