:root {
    --gold: #D4AF37;
    --dark-green: #0f3d2e;
    --teal: #2A9D8F;
    --off-white: #f4f6f8;
    --text-main: #2C3E50;
    --danger: #e74c3c;
    --transport-bg: #e3f2fd; /* Azul muy clarito para transporte */
    --transport-border: #90caf9;
}

body { 
    font-family: 'Lato', sans-serif; 
    background-color: var(--off-white); 
    color: var(--text-main); 
    margin: 0; 
    padding-bottom: 100px; 
}

h1, h2, h3, h4 { font-family: 'Playfair Display', serif; }

/* HEADER */
header {
    background: linear-gradient(rgba(15, 61, 46, 0.9), rgba(15, 61, 46, 0.95)), url('https://images.unsplash.com/photo-1552465011-b4e21bf6e79a?auto=format&fit=crop&q=80');
    background-size: cover; 
    background-position: center; 
    color: white; 
    padding: 40px 20px 30px; 
    text-align: center;
    border-bottom-left-radius: 30px; 
    border-bottom-right-radius: 30px;
}

/* NAVEGACIÓN MEJORADA (TABS) */
.tabs-container {
    position: sticky; 
    top: 10px; 
    z-index: 100;
    display: flex; 
    justify-content: center;
    padding: 0 10px;
}

.tabs {
    display: flex; 
    gap: 10px; 
    overflow-x: auto; /* Permite deslizar */
    white-space: nowrap; /* Evita saltos de línea */
    background: rgba(255, 255, 255, 0.9); 
    backdrop-filter: blur(10px);
    padding: 10px 15px; 
    border-radius: 50px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    -webkit-overflow-scrolling: touch; /* Suavidad en iPhone */
    scrollbar-width: none; /* Ocultar scroll en Firefox */
    max-width: 100%;
}
.tabs::-webkit-scrollbar { display: none; } /* Ocultar scroll en Chrome */

.tab-btn {
    flex-shrink: 0; /* IMPORTANTE: Evita que el botón se aplaste */
    background: transparent; 
    border: none; 
    color: #666;
    font-family: 'Lato', sans-serif; 
    font-weight: 700; 
    font-size: 0.85rem;
    padding: 8px 16px; 
    border-radius: 20px; 
    cursor: pointer; 
    transition: all 0.3s ease;
}

.tab-btn:hover { background: #eee; color: var(--dark-green); }
.tab-btn.active { background: var(--dark-green); color: var(--gold); box-shadow: 0 2px 10px rgba(15, 61, 46, 0.3); }

/* SECCIONES Y TARJETAS */
.container { max-width: 850px; margin: 0 auto; padding: 20px; }
.section-wrapper { scroll-margin-top: 100px; margin-bottom: 40px; }

.section-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 15px; }
.section-title { font-size: 1.8rem; color: var(--dark-green); margin: 0; }
.edit-sec-btn { background: none; border: none; color: #ccc; cursor: pointer; font-size: 1rem; }
.edit-sec-btn:hover { color: var(--teal); }

.trip-card {
    background: white; border-radius: 20px; overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05); border: 1px solid rgba(0,0,0,0.02);
}

.card-header-img {
    height: 160px; background-size: cover; background-position: center; position: relative;
}
.card-header-overlay {
    position: absolute; bottom: 0; left: 0; width: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    padding: 15px 20px; color: white;
}

/* ESTILOS DE ACTIVIDAD */
.activity-list { padding: 20px; }

.activity-row {
    display: flex; justify-content: space-between; align-items: center;
    background: white; border: 1px solid #eee; border-radius: 12px;
    padding: 15px; margin-bottom: 15px; position: relative;
    cursor: pointer; transition: transform 0.2s, box-shadow 0.2s;
}
.activity-row:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(0,0,0,0.05); }

/* Timeline vertical line connector */
.activity-row::after {
    content: ''; position: absolute; left: 24px; top: -20px; height: 25px; 
    border-left: 2px dashed #ddd; z-index: 0;
}
.activity-row:first-child::after { display: none; }

/* ESTILO ESPECIAL: TRANSPORTE / LOGÍSTICA */
.activity-row.type-Logística {
    background-color: var(--transport-bg);
    border: 1px dashed var(--transport-border);
    border-left: 5px solid #2196F3;
}
.activity-row.type-Logística .act-icon { background: #2196F3; color: white; }
.activity-row.type-Logística h4 { color: #1565C0; }

/* ICONO DE FECHA/TIPO */
.act-date-box {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: #f8f9fa; width: 50px; height: 50px; border-radius: 12px;
    margin-right: 15px; color: var(--dark-green); font-weight: bold; font-size: 0.75rem;
    z-index: 1; border: 1px solid #eee;
}
.act-date-day { font-size: 1.1rem; }

/* MODAL (CORREGIDO Y CENTRADO) */
.modal {
    display: none; /* Oculto por defecto */
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden; /* Evitar doble scroll */
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    
    /* Preparado para centrar cuando JS active display: flex */
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #fff;
    margin: auto;
    width: 90%;
    max-width: 500px;
    border-radius: 20px;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    max-height: 90vh; /* Altura máxima */
    display: flex;
    flex-direction: column;
}

.modal-header { 
    background: var(--dark-green); 
    color: white; 
    padding: 20px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    flex-shrink: 0; /* La cabecera no se encoge */
}

.modal-body {
    padding: 25px;
    overflow-y: auto; /* Scroll solo dentro del cuerpo */
}

@keyframes slideUp {
    from {transform: translateY(50px); opacity:0;}
    to {transform: translateY(0); opacity:1;}
}

/* FORMULARIOS */
input, select, textarea { width: 100%; padding: 12px; margin-bottom: 15px; border: 1px solid #ddd; border-radius: 8px; font-family: 'Lato'; box-sizing: border-box;}
.btn { width: 100%; padding: 12px; background: var(--gold); color: var(--dark-green); border: none; border-radius: 10px; font-weight: bold; cursor: pointer; }
.btn-delete { background: var(--danger); color: white; margin-top: 10px; }

/* BOTTOM NAV */
.bottom-nav { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: white; padding: 10px 25px; border-radius: 50px; display: flex; gap: 25px; box-shadow: 0 10px 30px rgba(0,0,0,0.15); z-index: 1000; }
.nav-icon { color: #ccc; font-size: 1.4rem; cursor: pointer; }
.nav-icon:hover { color: var(--teal); }