/* Modern, beginner-friendly styling */
* {
    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;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.header p {
    font-size: 1.2em;
    opacity: 0.9;
}

/* Main Content Layout */
.main-content {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 20px;
    margin-bottom: 20px;
}

/* Form Styling */
.input-section h2,
.visualization-section h2 {
    color: white;
    margin-bottom: 15px;
    font-size: 1.5em;
}

.form-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #4a5568;
}

.input-group input,
.input-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.input-group input:focus,
.input-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-group textarea {
    height: 80px;
    resize: vertical;
    font-family: monospace;
}

.input-group small {
    display: block;
    margin-top: 5px;
    color: #718096;
    font-size: 14px;
}

.generate-btn {
    width: 100%;
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    border: none;
    padding: 15px;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(72, 187, 120, 0.4);
}

/* Canvas and Visualization */
.canvas-container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    margin-bottom: 15px;
}

#canvas {
    display: block;
    margin: 0 auto;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: #f8f9fa;
}

/* Legend */
.canvas-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 2px solid #ccc;
}

.wall-color { background-color: #2d3748; }
.obstacle-color { background-color: #e53e3e; }
.path-color { background-color: #3182ce; }
.robot-color { background-color: #48bb78; }

/* Loading Animation */
.loading {
    text-align: center;
    padding: 40px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Playback Controls */
.playback-controls {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.control-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.control-btn:hover {
    background: #5a6fd8;
}

.delete-btn {
    background: #e53e3e;
}

.delete-btn:hover {
    background: #c53030;
}

.progress-container {
    flex: 1;
    margin-left: 20px;
}

.progress-slider {
    width: 100%;
    margin-bottom: 10px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #718096;
}

/* Information Panel */
.info-panel {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.info-panel h3 {
    color: #2d3748;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.stat-item {
    padding: 15px;
    background: #f7fafc;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.stat-label {
    display: block;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 5px;
}

.explanation-content {
    line-height: 1.6;
    color: #4a5568;
    background: #f7fafc;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #48bb78;
}

/* Trajectory Management */
.trajectory-section {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.trajectory-section h2 {
    color: #2d3748;
    margin-bottom: 20px;
}

.trajectory-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.trajectory-select {
    flex: 1;
    padding: 10px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    min-width: 200px;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .canvas-legend {
        gap: 10px;
    }
    
    .legend-item {
        font-size: 12px;
    }
    
    .playback-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .progress-container {
        margin-left: 0;
        margin-top: 15px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Hover Effects and Animations */
.form-card:hover,
.canvas-container:hover {
    transform: translateY(-2px);
    transition: transform 0.3s ease;
}

.stat-item:hover {
    background: #edf2f7;
    transition: background-color 0.3s ease;
}

.loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    text-align: center;
    padding: 40px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.canvas-container {
    position: relative;
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    margin-bottom: 15px;
}

