/* Reset y base */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; font-family: 'Segoe UI', sans-serif; background: #13202b; color: #e2dddd; }

/* Grid principal */
.grid-container { height: 100vh; display: grid; grid-template-rows: 1fr; }

/* Layout principal flex para header + map + buttons + footer */
.main-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
}

header {
    background: #0056B3;
    padding: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    z-index: 10;
}

h3 {
    margin: 0;
    color: white;
    text-align: center;
    flex-grow: 1;
}


/* Estilo general de la pantalla de carga */
.login {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9); /* Fondo oscuro con transparencia */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999; /* Asegura que esté sobre otros elementos */
}

/* Contenedor de la interfaz de login */
.login-container {
    text-align: center;
    background: #333;
    padding: 30px;
    border-radius: 10px;
    width: 300px;
    color: white;
}

/* Texto para el campo de nombre de usuario */
.login-text {
    margin-bottom: 15px;
}

/* Estilo del campo de texto */
input[type="text"] {
    padding: 10px;
    width: 100%;
    border: none;
    border-radius: 5px;
    font-size: 16px;
}

.button-iniciar
{
    
    margin-top: 5px;
    padding: 10px;
    width: 100%;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    }


.header-buttons { display: flex; gap: 8px; }

.header-button {
    padding: 8px 16px;
    font-size: 14px;
    border: none;
    border-radius: 5px;
    color: white;
    cursor: pointer;
}

#iniciar-recorrido { background: #28a745; }
#terminar-recorrido { background: #dc3545; }

.button-eliminar {
    background: #A30708;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 8px 12px;
    font-size: 14px;
    cursor: pointer;
}
.button-eliminar:hover { background: #d13333; }

/* Mapa – toma todo el espacio disponible */
#map-container {
    flex: 1;
    min-height: 0; /* importante para flex */
    max-height: 600px;
}
#map { height: 100%; width: 100%; }

/* Botones inferiores */
.bottom-buttons {
    display: flex;
    gap: 10px;
    padding: 15px;
    background: #1a2a38;
    justify-content: center;
    flex-wrap: wrap;
}

.category-btn {
    flex: 1;
    min-height: 110px !important;
    min-width: 100px !important;
    padding: 20px 10px;
    font-size: 20px;
    font-weight: bold;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.c1 { background: #0066cc; }
.c1:hover { background: #0055aa; }

.c2 { background: #cc6600; }
.c2:hover { background: #aa5500; }

.c3 { background: #990099; }
.c3:hover { background: #770077; }

/* Footer */
footer {
    background: #333;
    color: white;
    text-align: center;
    padding: 10px;
    font-size: 16px;
}

/* Cargando y login (mantenidos) */
.cargando, .login {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 500px) {
    .category-btn { padding: 15px 8px; font-size: 18px; max-width: 170px; }
}

.estado-btn {
    padding: 10px 20px;
    margin: 5px;
    font-size: 18px;
    font-weight: bold;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 60px; /* Para mobile */
}

.estado-1 { background: #dc3545; } /* Rojo - Malo */
.estado-1:hover { background: #c82333; }

.estado-2 { background: #fd7e14; } /* Naranja - Regular */
.estado-2:hover { background: #fd7e14cc; }

.estado-3 { background: #ffc107; } /* Amarillo - Bueno */
.estado-3:hover { background: #ffc107cc; }

.estado-4 { background: #28a745; } /* Verde claro - Muy bueno */
.estado-4:hover { background: #218838; }

.estado-5 { background: #198754; } /* Verde oscuro - Excelente */
.estado-5:hover { background: #157347; }

.estado-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}