<!DOCTYPE html>
<html lang="es">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{% block title %}Balotario Licencia Clase A - Categoría I{% endblock %}</title>

    <!-- Favicon -->
    <link rel="icon" type="image/svg+xml" href="{{ url_for('static', filename='favicon.svg') }}">
    <link rel="shortcut icon" href="{{ url_for('static', filename='favicon.svg') }}">
    <link rel="manifest" href="{{ url_for('static', filename='site.webmanifest') }}">
    <meta name="theme-color" content="#3498db">

    <link href="{{ url_for('static', filename='css/bootstrap/bootstrap.min.css') }}" rel="stylesheet">
    <link href="{{ url_for('static', filename='css/fontawesome-local.css') }}" rel="stylesheet">
    <link href="{{ url_for('static', filename='css/custom.css') }}" rel="stylesheet">
    <style>
        :root {
            --primary-color: #2c3e50;
            --secondary-color: #3498db;
            --success-color: #27ae60;
            --danger-color: #e74c3c;
            --warning-color: #f39c12;
            --light-bg: #ecf0f1;
        }

        body {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }

        .navbar {
            background: rgba(44, 62, 80, 0.95) !important;
            backdrop-filter: blur(10px);
            box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
        }

        .navbar-brand {
            font-weight: bold;
            color: white !important;
        }

        .nav-link {
            color: rgba(255, 255, 255, 0.8) !important;
            transition: color 0.3s ease;
        }

        .nav-link:hover {
            color: white !important;
        }

        .container-main {
            background: rgba(255, 255, 255, 0.95);
            border-radius: 20px;
            box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
            backdrop-filter: blur(10px);
            margin-top: 2rem;
            margin-bottom: 2rem;
            padding: 2rem;
        }

        .card {
            border: none;
            border-radius: 15px;
            box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
            transition: transform 0.3s ease, box-shadow 0.3s ease;
        }

        .card:hover {
            transform: translateY(-5px);
            box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
        }

        .btn-primary {
            background: linear-gradient(45deg, var(--secondary-color), #5dade2);
            border: none;
            border-radius: 25px;
            padding: 12px 30px;
            font-weight: 600;
            transition: all 0.3s ease;
        }

        .btn-primary:hover {
            background: linear-gradient(45deg, #2980b9, var(--secondary-color));
            transform: translateY(-2px);
            box-shadow: 0 8px 20px rgba(52, 152, 219, 0.3);
        }

        .btn-success {
            background: linear-gradient(45deg, var(--success-color), #58d68d);
            border: none;
            border-radius: 25px;
            padding: 12px 30px;
            font-weight: 600;
        }

        .btn-danger {
            background: linear-gradient(45deg, var(--danger-color), #ec7063);
            border: none;
            border-radius: 25px;
            padding: 12px 30px;
            font-weight: 600;
        }

        .btn-warning {
            background: linear-gradient(45deg, var(--warning-color), #f7dc6f);
            border: none;
            border-radius: 25px;
            padding: 12px 30px;
            font-weight: 600;
            color: white;
        }

        .question-card {
            background: white;
            border-radius: 15px;
            padding: 2rem;
            margin-bottom: 2rem;
            box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
        }

        .option-btn {
            width: 100%;
            text-align: left;
            margin-bottom: 10px;
            padding: 15px 20px;
            border-radius: 10px;
            border: 2px solid #e9ecef;
            background: white;
            transition: all 0.3s ease;
        }

        .option-btn:hover {
            border-color: var(--secondary-color);
            background: rgba(52, 152, 219, 0.1);
        }

        .option-btn.selected {
            border-color: var(--secondary-color);
            background: rgba(52, 152, 219, 0.2);
        }

        .option-btn.correct {
            border-color: var(--success-color);
            background: rgba(39, 174, 96, 0.2);
        }

        .option-btn.incorrect {
            border-color: var(--danger-color);
            background: rgba(231, 76, 60, 0.2);
        }

        .stats-card {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border-radius: 15px;
            padding: 1.5rem;
        }

        .progress {
            height: 10px;
            border-radius: 10px;
            background: rgba(255, 255, 255, 0.2);
        }

        .progress-bar {
            border-radius: 10px;
        }

        .fade-in {
            animation: fadeIn 0.5s ease-in;
        }

        @keyframes fadeIn {
            from {
                opacity: 0;
                transform: translateY(20px);
            }

            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .question-image {
            max-width: 100%;
            height: auto;
            border-radius: 10px;
            margin: 1rem 0;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
        }

        .loading {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 200px;
        }

        .spinner {
            width: 50px;
            height: 50px;
            border: 5px solid #f3f3f3;
            border-top: 5px solid var(--secondary-color);
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }

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

            100% {
                transform: rotate(360deg);
            }
        }
    </style>
</head>

<body>
    <nav class="navbar navbar-expand-lg navbar-dark">
        <div class="container">
            <a class="navbar-brand" href="/">
                <i class="fas fa-car me-2"></i>
                Balotario Licencia A-I
            </a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarNav">
                <ul class="navbar-nav ms-auto">
                    <li class="nav-item">
                        <a class="nav-link" href="/">
                            <i class="fas fa-home me-1"></i>Inicio
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="/study">
                            <i class="fas fa-book me-1"></i>Estudiar
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="/practice">
                            <i class="fas fa-dumbbell me-1"></i>Practicar
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="/exam">
                            <i class="fas fa-clipboard-check me-1"></i>Examen
                        </a>
                    </li>
                    <li class="nav-item">
                        <button class="btn btn-outline-light btn-sm ms-2" id="theme-toggle"
                            title="Cambiar tema (Ctrl+D)">
                            <i class="fas fa-moon" id="theme-icon"></i>
                        </button>
                    </li>
                </ul>
            </div>
        </div>
    </nav>

    <div class="container">
        <div class="container-main">
            {% block content %}{% endblock %}
        </div>
    </div>

    <script src="{{ url_for('static', filename='js/modules/bootstrap/bootstrap.bundle.min.js') }}"></script>
    <script src="{{ url_for('static', filename='js/app.js') }}"></script>

    <!-- Modular JavaScript -->
    <script src="{{ url_for('static', filename='js/modules/base.js') }}"></script>
    <script src="{{ url_for('static', filename='js/modules/question-navigator.js') }}"></script>
    <script src="{{ url_for('static', filename='js/modules/study-mode.js') }}"></script>
    <script src="{{ url_for('static', filename='js/modules/practice-mode.js') }}"></script>
    <script src="{{ url_for('static', filename='js/modules/exam-mode.js') }}"></script>
    <script src="{{ url_for('static', filename='js/modules/stats-display.js') }}"></script>

    <script>
        // Script para el botón de tema
        document.addEventListener('DOMContentLoaded', function () {
            const themeToggle = document.getElementById('theme-toggle');
            const themeIcon = document.getElementById('theme-icon');

            if (themeToggle) {
                themeToggle.addEventListener('click', function () {
                    window.themeManager.toggleTheme();
                    updateThemeIcon();
                    Utils.playSound('click');
                });
            }

            function updateThemeIcon() {
                if (themeIcon && window.themeManager) {
                    const isDark = window.themeManager.currentTheme === 'dark';
                    themeIcon.className = isDark ? 'fas fa-sun' : 'fas fa-moon';
                }
            }

            // Inicializar icono después de que se cargue el themeManager
            setTimeout(() => {
                updateThemeIcon();
                // Asegurar que el tema se aplique al cargar la página
                if (window.themeManager) {
                    window.themeManager.applyTheme();
                }
            }, 100);
        });
    </script>

    {% block scripts %}{% endblock %}
</body>

</html>
