/* --- 1. CONFIGURACIÓN E IMPORTACIONES --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&family=Poppins:wght@500;700&display=swap');

:root {
    --primary: #4f46e5;       /* Indigo Vibrante */
    --primary-dark: #3730a3;  /* Indigo Oscuro */
    --secondary: #0ea5e9;     /* Azul Cielo */
    --accent: #f59e0b;        /* Naranja alerta */
    --danger: #ef4444;        /* Rojo error */
    --success: #10b981;       /* Verde éxito */
    --bg-body: #f3f4f6;       /* Gris muy suave */
    --bg-card: #ffffff;
    --text-main: #1f2937;
    --text-light: #6b7280;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

h1, h2, h3, .logo { font-family: 'Poppins', sans-serif; }

/* --- 2. BARRA DE NAVEGACIÓN (Glassmorphism) --- */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.nav-links { list-style: none; display: flex; gap: 30px; margin: 0; padding: 0; align-items: center; }
.nav-links a { text-decoration: none; color: var(--text-main); font-weight: 500; transition: color 0.3s; }
.nav-links a:hover { color: var(--primary); }

.btn-nav {
    background: var(--primary);
    color: white !important;
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    font-size: 0.9rem;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
    transition: transform 0.2s;
}
.btn-nav:hover { transform: translateY(-2px); box-shadow: 0 6px 15px rgba(79, 70, 229, 0.4); }

/* --- 3. CONTENEDORES Y TARJETAS --- */
.contenido-principal { flex: 1; padding: 2rem 5%; width: 100%; max-width: 1200px; margin: 0 auto; }

.card {
    background: var(--bg-card);
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
    border: 1px solid rgba(255,255,255,0.5);
}

.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }

/* --- 4. HERO SECTION (INICIO) --- */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    text-align: center;
    padding: 6rem 1rem;
    margin-bottom: 2rem;
    border-radius: 0 0 50px 50px; /* Curva moderna abajo */
    box-shadow: 0 10px 30px rgba(79, 70, 229, 0.2);
}
.hero h1 { font-size: 3rem; margin-bottom: 1rem; }
.hero p { font-size: 1.2rem; opacity: 0.9; max-width: 600px; margin: 0 auto 2rem auto; }
.btn-hero {
    background: white;
    color: var(--primary);
    padding: 1rem 2.5rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 700;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    transition: all 0.3s;
}
.btn-hero:hover { transform: scale(1.05); box-shadow: 0 8px 25px rgba(0,0,0,0.3); }

/* --- 5. INPUTS Y FORMULARIOS --- */
input, select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
    font-family: 'Inter', sans-serif;
}
input:focus { outline: none; border-color: var(--primary); background: #fff; }

button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s, transform 0.1s;
}
button:hover { background: var(--primary-dark); }
button:active { transform: scale(0.98); }

/* --- 6. TABLAS (ADMIN) --- */
table { width: 100%; border-collapse: separate; border-spacing: 0 10px; }
th { text-transform: uppercase; font-size: 0.8rem; letter-spacing: 1px; color: var(--text-light); padding: 10px; }
tbody tr { background: white; box-shadow: 0 2px 5px rgba(0,0,0,0.05); transition: transform 0.2s; }
tbody tr:hover { transform: scale(1.01); }
td { padding: 15px; vertical-align: middle; border-top: 1px solid #f3f4f6; border-bottom: 1px solid #f3f4f6; }
td:first-child { border-left: 1px solid #f3f4f6; border-top-left-radius: 8px; border-bottom-left-radius: 8px; }
td:last-child { border-right: 1px solid #f3f4f6; border-top-right-radius: 8px; border-bottom-right-radius: 8px; }

/* --- 7. TIMELINE DE RASTREO --- */
.timeline-container {
    position: relative;
    padding-left: 30px;
    margin-top: 2rem;
}
.timeline-container::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 5px;
    bottom: 0;
    width: 2px;
    background: #e5e7eb;
}
.event { position: relative; margin-bottom: 2rem; padding-left: 15px; }
.event-dot {
    position: absolute;
    left: -30px;
    top: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--bg-body);
    border: 2px solid #d1d5db;
    z-index: 2;
    transition: all 0.5s;
}
.completed .event-dot {
    width: 16px; height: 16px; left: -32px;
    /* El color se inyecta por JS, pero base es verde */
}
.status { display: block; font-weight: 700; font-size: 1.1rem; color: var(--text-main); margin-bottom: 4px; }
.date { font-size: 0.9rem; color: var(--text-light); }

/* --- 8. ANIMACIONES Y UTILIDADES --- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate { animation: fadeInUp 0.6s ease forwards; opacity: 0; }
.hidden { display: none; }

/* Footer */
.footer {
    background: white;
    text-align: center;
    padding: 2rem;
    margin-top: auto;
    border-top: 1px solid #eee;
    color: var(--text-light);
}

/* Estilo para el mapa */
#mapa-ruta {
    height: 300px; /* Altura del mapa */
    width: 100%;
    border-radius: 12px;
    margin-bottom: 30px;
    z-index: 1; /* Para que no tape el menú */
    border: 2px solid #e5e7eb;
}

/* --- ESTILOS DEL MODAL (POPUP) --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6); /* Fondo oscuro transparente */
    backdrop-filter: blur(5px); /* Efecto borroso de fondo */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    padding: 2.5rem;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    position: relative;
    transform: translateY(20px);
    transition: all 0.3s ease;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.modal-overlay.open .modal-content {
    transform: translateY(0);
}

.close-modal-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #9ca3af;
    transition: color 0.2s;
}
.close-modal-btn:hover { color: #4b5563; }

/* Estilos de las tarjetas interactivas */
.card-interactive {
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid transparent;
}
.card-interactive:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border-color: var(--primary);
}

@media (max-width: 768px) {
    .timeline-container {
        padding-left: 10px; /* Menos espacio en celular */
    }
    .event-dot {
        left: -19px; /* Ajuste del punto en celular */
    }
}