/* styles.css - Dark theme styling for Pathfinder game */

body {
    font-family: 'Segoe UI', sans-serif;
    background: #0f172a;
    color: #f1f5f9;
    margin: 0;
    padding: 0;
    overflow: hidden;
    height: 100vh;
}

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

header {
    padding: 15px 20px;
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #475569;
}

h1 {
    margin: 0 0 10px 0;
    font-size: 1.5rem;
    text-align: center;
}

/* Tab Bar */
.tab-bar {
    display: flex;
    gap: 0;
    justify-content: center;
    border-bottom: 2px solid #475569;
}

.tab {
    padding: 12px 30px;
    background: #1e293b;
    border: none;
    border-bottom: 3px solid transparent;
    color: #cbd5e1;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 6px 6px 0 0;
    margin-bottom: -2px;
}

.tab:hover {
    background: #334155;
    color: #f1f5f9;
}

.tab.active {
    background: #334155;
    color: #3b82f6;
    border-bottom: 3px solid #3b82f6;
}

/* Tab Panels */
.tab-panel {
    display: none;
    width: 100%;
    height: calc(100vh - 120px);
    overflow-y: auto;
    padding: 20px;
}

.tab-panel.active {
    display: block;
}

.canvas-container {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.canvas-container.race-mode {
    flex-direction: row;
    flex-wrap: nowrap;
}

.canvas-container.race-mode .canvas-section {
    flex: 1;
    min-width: 0;
}

.canvas-container.algo-race-mode {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 15px;
    max-width: 1000px;
    margin: 0 auto;
}

.canvas-container.algo-race-mode .canvas-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.canvas-container.algo-race-mode .canvas-section h3 {
    font-size: 1rem;
    margin-bottom: 8px;
}

.canvas-container.algo-race-mode .canvas-section canvas {
    width: 100%;
    max-width: 400px;
    height: auto;
    background: #0f172a;
    border: 2px solid #475569;
    border-radius: 4px;
}

.race-label {
    display: block;
    margin-bottom: 5px;
    color: #aaa;
    font-size: 0.85rem;
}

header .controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.tab-panel .controls {
    margin-bottom: 12px;
    background: #1e293b;
    padding: 10px 15px;
    border-radius: 6px;
    display: flex;
    gap: 10px;
    align-items: center;
    font-size: 0.9rem;
    border: 1px solid #475569;
}

button {
    padding: 8px 16px;
    cursor: pointer;
    background: #3b82f6;
    border: none;
    color: white;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.9rem;
    transition: 0.2s;
}

button:hover {
    background: #2563eb;
}

button.secondary {
    background: #64748b;
}

button:disabled {
    background: #334155;
    cursor: not-allowed;
}

.canvas-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.canvas-section h3 {
    margin-bottom: 10px;
    color: #eee;
    font-size: 1.2rem;
}

#gameCanvas, #raceCanvas, #raceUserCanvas {
    background: #0f172a;
    border: 2px solid #475569;
    border-radius: 4px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    max-width: 100%;
    height: auto;
}

.algo-race-controls {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.algo-grid-stats {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-top: 15px;
}

.algo-stat-item {
    text-align: center;
    padding: 10px;
    background: #1e293b;
    border-radius: 4px;
    border: 1px solid #475569;
}

.algo-stat-item h4 {
    margin: 0 0 8px 0;
    color: #3b82f6;
    font-size: 0.95rem;
}

.algo-stat-item .stat-box {
    font-size: 0.85rem;
    margin: 4px 0;
}

@media (max-width: 900px) {
    .canvas-container.algo-race-mode {
        grid-template-columns: 1fr;
        grid-template-rows: repeat(4, 1fr);
    }
    
    .algo-grid-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1600px) {
    .canvas-container.race-mode {
        flex-direction: column;
    }
    
    .canvas-container.race-mode .canvas-section {
        width: 100%;
    }
}

.race-stats {
    display: flex;
    gap: 25px;
    justify-content: center;
    margin: 12px 0;
    padding: 12px;
    background: #1e293b;
    border-radius: 6px;
    font-size: 0.9rem;
    border: 1px solid #475569;
}

.race-section {
    text-align: center;
}

.race-section h3 {
    margin-bottom: 8px;
    color: #3b82f6;
    font-size: 1rem;
}

.difficulty-selector {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.difficulty-btn {
    padding: 6px 12px;
    font-size: 0.9rem;
    background: #334155;
    border: 2px solid #475569;
    color: #cbd5e1;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.difficulty-btn:hover {
    background: #475569;
    border-color: #64748b;
}

.difficulty-btn.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
    font-weight: bold;
}

.start-race-btn {
    margin-top: 15px;
    padding: 10px 20px;
    background: #3b82f6;
    border: none;
    color: white;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
    width: 100%;
}

.start-race-btn:hover:not(:disabled) {
    background: #2563eb;
}

.start-race-btn:disabled {
    background: #334155;
    cursor: not-allowed;
    opacity: 0.7;
}

.algo-select {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    background: #1e293b;
    border: 2px solid #475569;
    color: #f1f5f9;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color 0.2s;
}

.algo-select:hover {
    border-color: #64748b;
}

.algo-select:focus {
    outline: none;
    border-color: #3b82f6;
}

.execution-mode-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

.execution-mode-btn {
    flex: 1;
    padding: 8px 12px;
    font-size: 0.9rem;
    background: #334155;
    border: 2px solid #475569;
    color: #cbd5e1;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.execution-mode-btn:hover {
    background: #475569;
    border-color: #64748b;
}

.execution-mode-btn.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
    font-weight: bold;
}

#raceResultSection h3 {
    margin-bottom: 8px;
    font-size: 1.1rem;
}

#raceResultSection p {
    margin: 8px 0 0 0;
    color: #eee;
    font-size: 0.9rem;
    line-height: 1.4;
}

.stats {
    display: flex;
    gap: 20px;
    font-size: 0.95rem;
    margin-bottom: 12px;
}


.stat-box {
    text-align: center;
}

.val {
    font-size: 1.3rem;
    font-weight: bold;
    color: #3b82f6;
}

kbd {
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: 3px;
    padding: 2px 6px;
    font-family: monospace;
    font-size: 0.85em;
    color: #f1f5f9;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Simulation Stats */
.simulate-btn {
    background: #9C27B0 !important;
}

.simulate-btn:hover:not(:disabled) {
    background: #7B1FA2 !important;
}

.simulation-stats {
    width: 100%;
    margin-top: 20px;
    padding: 15px;
    background: #1e293b;
    border-radius: 6px;
    border: 1px solid #475569;
}

.simulation-stats h3 {
    margin: 0 0 15px 0;
    color: #3b82f6;
    text-align: center;
}

.sim-progress {
    text-align: center;
    margin-bottom: 15px;
    color: #aaa;
    font-size: 0.9rem;
}

.sim-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.sim-table th,
.sim-table td {
    padding: 10px 15px;
    text-align: center;
    border-bottom: 1px solid #444;
}

.sim-table th {
    background: #1e293b;
    color: #3b82f6;
    font-weight: 600;
}

.sim-table td {
    color: #f1f5f9;
}

.sim-table tr:hover td {
    background: #334155;
}

.sim-table .accuracy-optimal {
    color: #3b82f6;
    font-weight: bold;
}

.sim-table .accuracy-good {
    color: #60a5fa;
}

.sim-table .accuracy-medium {
    color: #fbbf24;
}

.sim-table .accuracy-poor {
    color: #f87171;
}

.sim-table .fastest {
    color: #3b82f6;
    font-weight: bold;
}

.sim-note {
    margin-top: 15px;
    padding: 10px;
    background: #1e293b;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #cbd5e1;
    line-height: 1.5;
}

.sim-note strong {
    color: #3b82f6;
}

