* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    min-height: 100vh;
    overflow: hidden;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.header {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 20px 40px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.header h1 {
    font-size: 32px;
    margin-bottom: 8px;
}

.header p {
    font-size: 14px;
    opacity: 0.8;
}

/* Navigation links */
.nav-link, a.nav-link {
    color: #667eea;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    background: rgba(102, 126, 234, 0.1);
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 600;
    display: inline-block;
}

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

/* Main content */
.content {
    display: flex;
    flex: 1;
    gap: 20px;
    padding: 20px;
    overflow: hidden;
}

/* Control panel (left side) */
.control-panel {
    width: 280px;
    background: #252525;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.control-panel h2 {
    font-size: 18px;
    color: #e0e0e0;
    margin-bottom: 12px;
}

.panel-section {
    border-bottom: 1px solid #404040;
    padding-bottom: 16px;
}

.panel-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.info-text {
    font-size: 14px;
    color: #b0b0b0;
    margin-bottom: 12px;
    display: block; /* ensure labels receive bottom margin like paragraphs */
}

.info-box {
    background: #323232;
    padding: 12px;
    border-radius: 8px;
    font-size: 13px;
}

.info-box p {
    margin: 6px 0;
    color: #e0e0e0;
}

/* Buttons */
.btn {
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin-bottom: 8px;
}

.btn:last-child {
    margin-bottom: 0;
}

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

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

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

.btn-secondary {
    background: #404040;
    color: #e0e0e0;
    border: 1px solid #505050;
}

.btn-secondary:hover {
    background: #505050;
}

/* Resolution dropdown */
.resolution-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #505050;
    border-radius: 8px;
    background: #404040;
    color: #e0e0e0;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 8px;
}

.resolution-select:hover {
    background: #505050;
    border-color: #606060;
}

.resolution-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.resolution-select option {
    background: #404040;
    color: #e0e0e0;
    padding: 8px;
}

/* Visualization panel (right side) */
.visualization-panel {
    flex: 1;
    background: #2a2a2a;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0;
    overflow: hidden;
}

.image-container {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #1f1f1f;
    padding: 10px;
}

.env-canvas {
    max-width: 95%;
    max-height: 95%;
    cursor: crosshair;
    display: block;
}

.agents-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.agent-marker {
    position: absolute;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 3px solid white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    transform: translate(-50%, -50%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.agent-1 { background: #FF4444; }
.agent-2 { background: #44FF44; }
.agent-3 { background: #4444FF; }
.agent-4 { background: #FFFF44; }

/* Loading bar */
.loading-bar {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(42, 42, 42, 0.98);
    gap: 30px;
}

.loading-text {
    font-size: 18px;
    color: #e0e0e0;
    font-weight: 600;
}

.progress-bar {
    width: 80px;
    height: 80px;
    border: 4px solid #404040;
    border-top: 4px solid #667eea;
    border-right: 4px solid #764ba2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.progress-fill {
    display: none;
}

.loading-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.loading-details {
    display: flex;
    gap: 12px;
    align-items: center;
    color: #cfcfcf;
    font-size: 13px;
}

.loading-details .detail-label {
    color: #9aa0ff;
    font-weight: 700;
}

.loading-elapsed {
    color: #e0e0e0;
    font-size: 14px;
    font-weight: 600;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* GIF container */
.gif-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #1f1f1f;
    padding: 10px;
}

.episode-gif {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* Video container */
.video-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #1f1f1f;
    padding: 10px;
}

.episode-video {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

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

.control-panel::-webkit-scrollbar-track {
    background: #323232;
    border-radius: 10px;
}

.control-panel::-webkit-scrollbar-thumb {
    background: #505050;
    border-radius: 10px;
}

.control-panel::-webkit-scrollbar-thumb:hover {
    background: #707070;
}

/* Responsive design */
@media (max-width: 1024px) {
    .content {
        flex-direction: column;
        gap: 15px;
    }

    .control-panel {
        width: 100%;
        max-height: 150px;
    }

    .visualization-panel {
        flex: 1;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 15px 20px;
    }

    .header h1 {
        font-size: 24px;
    }

    .content {
        padding: 10px;
    }

    .control-panel {
        width: 100%;
    }

    .btn {
        font-size: 13px;
        padding: 10px 12px;
    }
}
