/* ============================================
   Law of Reflection - Interactive Simulation
   Responsive CSS for iframe and full-screen
   ============================================ */

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

/* Main container - responsive layout */
.container {
    display: flex;
    gap: 15px;
    width: 100%;
    max-width: 1200px;
    height: auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    flex-wrap: wrap;
}

/* Control panel - primary panel */
.control-panel {
    flex: 1;
    min-width: 320px;
    max-width: 500px;
    padding: 20px;
    background: #f8f9fa;
    overflow-y: auto;
    max-height: 90vh;
    border-radius: 8px;
}

/* Panel header styling */
.panel-header {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
    cursor: help;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Slider section - MODIFIED: removed top margin since no header above it */
.slider-section {
    margin-bottom: 20px;
    margin-top: 0;
}

.slider-section label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

input[type="range"] {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, #FF6B6B, #4ECDC4);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

/* Webkit slider thumb styling */
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    border: 3px solid #667eea;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
    transition: all 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.6);
}

/* Firefox slider thumb styling */
input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    border: 3px solid #667eea;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
    transition: all 0.2s ease;
}

input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.6);
}

.angle-display {
    font-size: 16px;
    font-weight: bold;
    color: #667eea;
    min-width: 60px;
    text-align: right;
    background: white;
    padding: 6px 12px;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

/* Diagram container - MODIFIED: reduced height and padding for ultra-compact view, eliminates negative y-axis */
.diagram-container {
    margin: 15px 0;
    background: white;
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e0e0e0;
    /* MODIFIED: Set max-height to constrain diagram size */
    max-height: 180px;
}

#reflectionDiagram {
    width: 100%;
    height: auto;
    display: block;
}

/* Button group */
.button-group {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin: 15px 0;
}

/* Button styling */
.btn {
    padding: 10px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

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

.btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

.btn-primary:hover {
    background: linear-gradient(135deg, #5568d3, #6a3f8f);
}

.btn-secondary {
    background: linear-gradient(135deg, #4ECDC4, #44A08D);
    color: white;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #45b8b8, #3a9680);
}

.btn-danger {
    background: linear-gradient(135deg, #FF6B6B, #EE5A6F);
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #ff5555, #e84a5f);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Data table styling */
.data-table-container {
    background: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e0e0e0;
    margin-top: 15px;
}

.table-header {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    cursor: help;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.data-table thead {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.data-table th {
    padding: 10px;
    text-align: center;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.2px;
}

.data-table td {
    padding: 10px;
    text-align: center;
    border-bottom: 1px solid #e0e0e0;
    color: #555;
}

.data-table tbody tr:hover {
    background: #f0f0f0;
    transition: background 0.2s ease;
}

.data-table tbody tr:nth-child(even) {
    background: #f8f9fa;
}

.table-message {
    text-align: center;
    color: #999;
    font-size: 12px;
    padding: 15px;
    font-style: italic;
}

/* Graph panel */
.graph-panel {
    flex: 1;
    min-width: 320px;
    max-width: 500px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    overflow-y: auto;
    max-height: 90vh;
    transition: all 0.3s ease;
}

.graph-panel.hidden {
    display: none;
}

/* Graph toggles - MODIFIED: Changed from flex-direction column to row for inline horizontal layout */
.graph-toggles {
    display: flex;
    flex-direction: row;
    gap: 15px;
    margin-bottom: 15px;
    background: white;
    padding: 12px;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    flex-wrap: wrap;
    align-items: center;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #555;
    cursor: pointer;
    user-select: none;
    font-weight: 500;
    white-space: nowrap;
}

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

/* Canvas styling */
#graphCanvas {
    width: 100%;
    height: auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e0e0e0;
    display: block;
    margin-bottom: 15px;
}

/* Graph legend */
.graph-legend {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    background: white;
    padding: 12px;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

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

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 2px;
    flex-shrink: 0;
}

/* Responsive design for smaller screens */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
        max-height: 100vh;
    }

    .control-panel,
    .graph-panel {
        max-width: 100%;
        max-height: 50vh;
    }

    .button-group {
        grid-template-columns: 1fr;
    }

    .graph-legend {
        grid-template-columns: 1fr;
    }

    /* Stack toggles vertically on smaller screens */
    .graph-toggles {
        flex-direction: column;
        align-items: flex-start;
    }

    body {
        min-height: auto;
    }
}

/* Iframe-specific adjustments */
@media (max-height: 500px) {
    .control-panel,
    .graph-panel {
        max-height: 450px;
    }

    .diagram-container {
        margin: 10px 0;
        padding: 8px;
        max-height: 160px;
    }

    .button-group {
        margin: 10px 0;
        gap: 8px;
    }

    .btn {
        padding: 8px 10px;
        font-size: 11px;
    }
}

/* Tooltip styling */
[title] {
    cursor: help;
    position: relative;
}

/* Scrollbar styling */
.control-panel::-webkit-scrollbar,
.graph-panel::-webkit-scrollbar {
    width: 6px;
}

.control-panel::-webkit-scrollbar-track,
.graph-panel::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.control-panel::-webkit-scrollbar-thumb,
.graph-panel::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 3px;
}

.control-panel::-webkit-scrollbar-thumb:hover,
.graph-panel::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}