/* Global styles and reset */
* {
    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 - responsive height based on context */
.container {
    width: 100%;
    height: 450px; /* Default for iframe */
    display: flex;
    background: white;
    position: relative;
}

/* If opened in new tab, use 90vh */
@media (min-height: 600px) {
    body:not(.iframe-mode) .container {
        height: 90vh;
    }
}

/* Left panel - simulation area (60% width) */
.left-panel {
    flex: 0 0 60%;
    display: flex;
    flex-direction: column;
    background: linear-gradient(to bottom, #f0f4f8 0%, #d9e2ec 100%);
    border-right: 2px solid #ccc;
    position: relative;
}

/* Canvas for simulation */
#simulationCanvas {
    flex: 1;
    width: 100%;
    cursor: pointer;
}

/* Control panel at bottom of left panel */
.controls {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.95);
    border-top: 1px solid #ddd;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
}

/* Control buttons */
.control-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.control-btn:active {
    transform: scale(0.95);
}

/* Slider container */
.slider-container {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.slider-label {
    font-size: 12px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
}

/* Range slider styling */
#frequencySlider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

#frequencySlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

#frequencySlider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

#frequencySlider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.value-display {
    font-size: 12px;
    font-weight: 700;
    color: #667eea;
    min-width: 45px;
    text-align: right;
}

/* Right panel - information and graphs (40% width) */
.right-panel {
    flex: 0 0 40%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    background: #f8f9fa;
    overflow-y: auto;
}

/* Tooltip that shows on hover */
.info-tooltip {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 11px;
    line-height: 1.4;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.container:hover .info-tooltip {
    opacity: 1;
}

/* Force display section */
.force-display {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.force-item {
    background: white;
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: all 0.3s ease;
    cursor: help;
}

.force-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.force-label {
    font-size: 10px;
    font-weight: 600;
    color: #666;
    margin-bottom: 4px;
}

.force-value {
    font-size: 14px;
    font-weight: 700;
    color: #333;
    margin-bottom: 4px;
}

.force-arrow {
    font-size: 18px;
    font-weight: bold;
}

/* MODIFIED: Changed weight arrow color to green */
.weight-arrow {
    color: #2ecc71;
}

.normal-arrow {
    color: #3498db;
}

.net-arrow {
    color: #2ecc71;
}

/* Acceleration display */
.acceleration-display {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.accel-item {
    background: white;
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    text-align: center;
    cursor: help;
}

.accel-label {
    font-size: 10px;
    font-weight: 600;
    color: #666;
    margin-bottom: 4px;
}

.accel-value {
    font-size: 13px;
    font-weight: 700;
    color: #333;
}

/* Graph container */
.graph-container {
    background: white;
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    flex: 1;
    min-height: 120px;
    display: flex;
    flex-direction: column;
}

.graph-title {
    font-size: 11px;
    font-weight: 600;
    color: #666;
    margin-bottom: 6px;
    text-align: center;
}

#graphCanvas {
    flex: 1;
    width: 100%;
}

/* Key concepts section */
.concepts-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.concept-item {
    background: white;
    border-radius: 6px;
    padding: 6px 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 10px;
    cursor: help;
    transition: all 0.3s ease;
}

.concept-item:hover {
    transform: translateX(3px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.concept-icon {
    font-size: 16px;
    font-weight: bold;
    color: #667eea;
    min-width: 20px;
    text-align: center;
}

.concept-text {
    font-weight: 500;
    color: #333;
}

/* Responsive adjustments for smaller screens */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    
    .left-panel, .right-panel {
        flex: 1;
    }
    
    .force-display {
        grid-template-columns: repeat(3, 1fr);
    }
}