/**
 * MASTER.CSS - Estilos globales de LogisTransol
 * Desarrollado por Iñaki Serrano para Webcomunica.solutions
 * Paleta: Azul marino (#1a365d), Gris pizarra (#2d3748), Blanco (#fff), Acento (#3182ce)
 */

/* === RESET Y BASE === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 15px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #f0f2f5;
    color: #2d3748;
    line-height: 1.5;
    min-height: 100vh;
}

a {
    color: #3182ce;
    text-decoration: none;
}

a:hover {
    color: #2c5282;
    text-decoration: underline;
}

img {
    max-width: 100%;
}

/* === LAYOUT PRINCIPAL === */
.contenedor-app {
    display: flex;
    min-height: 100vh;
}

/* === BARRA LATERAL === */
.barra-lateral {
    width: 240px;
    background: #1a365d;
    color: #e2e8f0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
    transition: transform 0.3s;
}

.barra-lateral-logo {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid #2a4a7f;
}

.barra-lateral-logo h2 {
    color: #fff;
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.barra-lateral-logo small {
    color: #a0aec0;
    font-size: 0.7rem;
}

/* === MENÚ NAVEGACIÓN === */
.nav-menu {
    list-style: none;
    padding: 10px 0;
}

.nav-menu li a {
    display: block;
    padding: 12px 20px;
    color: #cbd5e0;
    font-size: 0.9rem;
    transition: background 0.2s, color 0.2s;
    border-left: 3px solid transparent;
}

.nav-menu li a:hover,
.nav-menu li a.activo {
    background: #2a4a7f;
    color: #fff;
    text-decoration: none;
    border-left-color: #63b3ed;
}

.nav-separador {
    border-top: 1px solid #2a4a7f;
    margin: 8px 15px;
}

/* === CONTENIDO PRINCIPAL === */
.contenido-principal {
    margin-left: 240px;
    flex: 1;
    min-height: 100vh;
}

/* === CABECERA SUPERIOR === */
.cabecera-superior {
    background: #fff;
    padding: 15px 30px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
}

.cabecera-titulo h1 {
    font-size: 1.3rem;
    color: #1a365d;
    font-weight: 600;
}

.cabecera-titulo p {
    font-size: 0.8rem;
    color: #718096;
}

/* === ÁREA DE TRABAJO === */
.area-trabajo {
    padding: 25px 30px;
}

/* === TARJETAS RESUMEN (DASHBOARD) === */
.grid-resumen {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.tarjeta-resumen {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #e2e8f0;
    transition: box-shadow 0.2s;
}

.tarjeta-resumen:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.tarjeta-resumen h3 {
    font-size: 0.8rem;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.tarjeta-resumen .valor {
    font-size: 2rem;
    font-weight: 700;
    color: #1a365d;
}

.tarjeta-resumen .detalle {
    font-size: 0.8rem;
    color: #a0aec0;
    margin-top: 4px;
}

/* === TARJETA / PANEL === */
.tarjeta {
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    margin-bottom: 20px;
}

.tarjeta-cabecera {
    padding: 15px 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tarjeta-cabecera h2 {
    font-size: 1rem;
    color: #2d3748;
    font-weight: 600;
}

.tarjeta-cuerpo {
    padding: 20px;
}

/* === TABLAS === */
.tabla-contenedor {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table thead th {
    background: #f7fafc;
    padding: 10px 15px;
    text-align: left;
    font-size: 0.8rem;
    color: #4a5568;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 2px solid #e2e8f0;
    font-weight: 600;
    white-space: nowrap;
}

table tbody td {
    padding: 10px 15px;
    border-bottom: 1px solid #edf2f7;
    font-size: 0.9rem;
    color: #4a5568;
}

table tbody tr:hover {
    background: #f7fafc;
}

/* === ETIQUETA VIP === */
.etiqueta-vip {
    display: inline-block;
    background: #e53e3e;
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    vertical-align: middle;
}

/* === ETIQUETAS DE ESTADO === */
.etiqueta {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.etiqueta-pendiente { background: #fefcbf; color: #975a16; }
.etiqueta-asignado { background: #bee3f8; color: #2a4365; }
.etiqueta-en_ruta { background: #c6f6d5; color: #276749; }
.etiqueta-entregado { background: #c6f6d5; color: #276749; }
.etiqueta-cancelado { background: #fed7d7; color: #9b2c2c; }
.etiqueta-planificada { background: #e9d8fd; color: #553c9a; }
.etiqueta-en_curso { background: #bee3f8; color: #2a4365; }
.etiqueta-completada { background: #c6f6d5; color: #276749; }

/* === FORMULARIOS === */
.formulario-grupo {
    margin-bottom: 16px;
}

.formulario-grupo label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 5px;
}

.formulario-grupo input[type="text"],
.formulario-grupo input[type="number"],
.formulario-grupo input[type="date"],
.formulario-grupo input[type="time"],
.formulario-grupo input[type="email"],
.formulario-grupo input[type="tel"],
.formulario-grupo input[type="file"],
.formulario-grupo select,
.formulario-grupo textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #2d3748;
    background: #fff;
    transition: border-color 0.2s;
}

.formulario-grupo input:focus,
.formulario-grupo select:focus,
.formulario-grupo textarea:focus {
    outline: none;
    border-color: #3182ce;
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.15);
}

.formulario-grupo textarea {
    resize: vertical;
    min-height: 80px;
}

.formulario-fila {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

/* === CHECKBOX PERSONALIZADO === */
.formulario-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.formulario-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #3182ce;
}

.formulario-check label {
    font-size: 0.9rem;
    cursor: pointer;
    margin-bottom: 0;
}

/* === BOTONES === */
.btn {
    display: inline-block;
    padding: 9px 18px;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
    text-align: center;
    line-height: 1.4;
}

.btn:hover {
    opacity: 0.9;
    text-decoration: none;
}

.btn-primario {
    background: #3182ce;
    color: #fff;
}

.btn-secundario {
    background: #edf2f7;
    color: #4a5568;
}

.btn-secundario:hover {
    background: #e2e8f0;
    color: #2d3748;
}

.btn-peligro {
    background: #e53e3e;
    color: #fff;
}

.btn-exito {
    background: #38a169;
    color: #fff;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 0.8rem;
}

.btn-grupo {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* === MENSAJES FLASH === */
.alerta {
    padding: 12px 18px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.alerta-exito { background: #c6f6d5; color: #276749; border: 1px solid #9ae6b4; }
.alerta-error { background: #fed7d7; color: #9b2c2c; border: 1px solid #feb2b2; }
.alerta-aviso { background: #fefcbf; color: #975a16; border: 1px solid #fefcbf; }
.alerta-info  { background: #bee3f8; color: #2a4365; border: 1px solid #90cdf4; }

/* === PANEL FLOTANTE (CAMIONES) === */
.panel-flotante {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: #fff;
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    z-index: 200;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.panel-flotante.abierto {
    right: 0;
}

.panel-flotante-cabecera {
    padding: 15px 20px;
    background: #1a365d;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-flotante-cabecera h3 {
    font-size: 1rem;
    font-weight: 600;
}

.panel-flotante-cerrar {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0 5px;
}

.panel-flotante-cuerpo {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.3);
    z-index: 199;
    display: none;
}

.panel-overlay.activo {
    display: block;
}

/* === MAPA === */
.contenedor-mapa {
    width: 100%;
    height: 500px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

/* === INFO RUTA === */
.info-ruta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.info-ruta-item {
    background: #f7fafc;
    padding: 12px 15px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.info-ruta-item span {
    display: block;
    font-size: 0.75rem;
    color: #718096;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.info-ruta-item strong {
    font-size: 1.1rem;
    color: #1a365d;
}

/* === PARADA DE RUTA === */
.lista-paradas {
    list-style: none;
}

.parada-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    border-bottom: 1px solid #edf2f7;
    align-items: flex-start;
}

.parada-orden {
    width: 32px;
    height: 32px;
    background: #3182ce;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.parada-orden.vip {
    background: #e53e3e;
}

.parada-info h4 {
    font-size: 0.95rem;
    color: #2d3748;
    margin-bottom: 3px;
}

.parada-info p {
    font-size: 0.8rem;
    color: #718096;
}

/* === BARRA DE CAPACIDAD === */
.barra-capacidad {
    height: 8px;
    background: #edf2f7;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 6px;
}

.barra-capacidad-relleno {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s;
}

.barra-capacidad-relleno.bajo { background: #38a169; }
.barra-capacidad-relleno.medio { background: #d69e2e; }
.barra-capacidad-relleno.alto { background: #e53e3e; }

/* === UTILIDADES === */
.texto-centro { text-align: center; }
.texto-derecha { text-align: right; }
.texto-gris { color: #718096; }
.texto-pequeño { font-size: 0.8rem; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.sin-datos { padding: 40px; text-align: center; color: #a0aec0; }

/* === MODAL === */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 300;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-overlay.activo {
    display: flex;
}

.modal {
    background: #fff;
    border-radius: 8px;
    width: 90%;
    max-width: 550px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.modal-cabecera {
    padding: 15px 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-cabecera h3 {
    font-size: 1rem;
    color: #1a365d;
}

.modal-cerrar {
    background: none;
    border: none;
    font-size: 1.3rem;
    color: #a0aec0;
    cursor: pointer;
}

.modal-cuerpo {
    padding: 20px;
}

.modal-pie {
    padding: 12px 20px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .barra-lateral {
        transform: translateX(-100%);
    }

    .barra-lateral.movil-abierto {
        transform: translateX(0);
    }

    .contenido-principal {
        margin-left: 0;
    }

    .cabecera-superior {
        padding: 12px 15px;
    }

    .area-trabajo {
        padding: 15px;
    }

    .formulario-fila {
        grid-template-columns: 1fr;
    }

    .panel-flotante {
        width: 100%;
        right: -100%;
    }
}
