/* Q-Learning Maze Solver CSS */


/* All styles are prefixed with 'ql-' to avoid conflicts */


/* Variables */

#ql-maze-solver-container {
    --ql-cell-size: 35px;
    /* Optimized for 7x7 maze on mobile */
    --ql-primary-color: #3498db;
    --ql-secondary-color: #2ecc71;
    --ql-wall-color: #34495e;
    --ql-path-color: #ecf0f1;
    --ql-start-color: #e74c3c;
    --ql-goal-color: #2ecc71;
    --ql-agent-color: #f39c12;
    --ql-visited-color: rgba(52, 152, 219, 0.3);
    --ql-optimal-path-color: rgba(46, 204, 113, 0.5);
}


/* Main container styling */

#ql-maze-solver-container {
    font-family: 'Arial', sans-serif;
    margin: 0;
    padding: 10px;
    background-color: #f5f6fa;
    color: #2c3e50;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}


/* Headings */

#ql-maze-solver-container h1 {
    text-align: center;
    color: #2c3e50;
    font-size: 1.5rem;
    margin: 10px 0;
}

#ql-maze-solver-container h2 {
    text-align: center;
    color: #2c3e50;
    font-size: 1.2rem;
    margin: 8px 0;
}

#ql-maze-solver-container h3 {
    font-size: 1.1rem;
    margin: 10px 0;
}


/* Controls container */

.ql-controls-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    background-color: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}


/* Parameter groups */

.ql-parameter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 100px;
}

.ql-parameter-group label {
    font-weight: bold;
    font-size: 0.9rem;
}

.ql-parameter-group input,
.ql-parameter-group select {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}


/* Buttons */

.ql-button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    width: 100%;
    margin-top: 10px;
}

.ql-button-group button {
    background-color: var(--ql-primary-color);
    color: white;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.2s;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.9rem;
    flex: 1;
    min-width: 80px;
    max-width: 150px;
}

.ql-button-group button:hover {
    background-color: #2980b9;
}

.ql-button-group button:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}


/* Visualization container */

.ql-visualization-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}


/* Maze container */

.ql-maze-container {
    background-color: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
}

#ql-maze {
    display: grid;
    gap: 1px;
    background-color: var(--ql-wall-color);
    border: 2px solid var(--ql-wall-color);
    border-radius: 4px;
    margin: 10px 0;
}


/* Cell styling */

.ql-cell {
    width: var(--ql-cell-size);
    height: var(--ql-cell-size);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #555;
    position: relative;
    transition: background-color 0.3s;
}

.ql-wall {
    background-color: var(--ql-wall-color);
}

.ql-path {
    background-color: var(--ql-path-color);
}

.ql-start {
    background-color: var(--ql-start-color);
}

.ql-goal {
    background-color: var(--ql-goal-color);
}

.ql-agent {
    background-color: var(--ql-agent-color);
    border-radius: 50%;
    width: 70%;
    height: 70%;
    position: absolute;
    z-index: 1;
}

.ql-visited {
    background-color: var(--ql-visited-color);
}

.ql-optimal-path {
    background-color: var(--ql-optimal-path-color);
}


/* Stats container */

.ql-stats-container {
    background-color: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    min-width: 250px;
    max-width: 100%;
    width: 100%;
}

.ql-stat-item {
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.ql-stat-item span {
    font-weight: bold;
}


/* Progress bar */

#ql-trainingProgress {
    width: 100%;
    height: 16px;
    margin-top: 10px;
    background-color: #ecf0f1;
    border-radius: 8px;
    overflow: hidden;
}

#ql-progressBar {
    height: 100%;
    width: 0;
    background-color: var(--ql-secondary-color);
    transition: width 0.3s;
}


/* Q-values container */

#ql-q-values-container {
    max-height: 200px;
    overflow-y: auto;
    margin-top: 15px;
    font-size: 0.9rem;
}


/* Error message */

#ql-error-message {
    color: #e74c3c;
    text-align: center;
    margin-top: 8px;
    font-weight: bold;
    font-size: 0.9rem;
}


/* Q-value display */

.ql-q-value-display {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
    padding: 8px;
    background-color: #f8f9fa;
    border-radius: 4px;
    margin-top: 8px;
}

.ql-q-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4px;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 70px;
}

.ql-q-cell-header {
    font-weight: bold;
    margin-bottom: 4px;
    font-size: 0.85rem;
}

.ql-q-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
    width: 100%;
}

.ql-q-action {
    text-align: center;
    font-size: 9px;
    padding: 2px;
}

.ql-q-action.ql-max {
    background-color: rgba(46, 204, 113, 0.2);
    font-weight: bold;
}


/* Legend */

.ql-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
    font-size: 0.85rem;
}

.ql-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ql-legend-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
}


/* Legend color classes */

.ql-start-color {
    background-color: var(--ql-start-color);
}

.ql-goal-color {
    background-color: var(--ql-goal-color);
}

.ql-wall-color {
    background-color: var(--ql-wall-color);
}

.ql-agent-color {
    background-color: var(--ql-agent-color);
}

.ql-visited-color {
    background-color: var(--ql-visited-color);
}

.ql-optimal-path-color {
    background-color: var(--ql-optimal-path-color);
}


/* Responsive styles */

@media (min-width: 768px) {
    #ql-maze-solver-container {
        --ql-cell-size: 45px;
        /* Larger cell size for desktop */
        padding: 20px;
    }
    #ql-maze-solver-container h1 {
        font-size: 2rem;
    }
    #ql-maze-solver-container h2 {
        font-size: 1.5rem;
    }
    .ql-button-group button {
        flex: 0 1 auto;
    }
    .ql-stats-container {
        width: auto;
    }
}

@media (max-width: 480px) {
    #ql-maze-solver-container {
        --ql-cell-size: 28px;
        /* Even smaller for very small screens */
    }
    .ql-parameter-group {
        width: calc(50% - 10px);
        min-width: 0;
    }
}