/* ==========================================================================
   VARIABLES GLOBALES
   ========================================================================== */
:root { 
    --primary-color: #2563eb; 
    --primary-hover: #1d4ed8; 
    --bg-color: #f8fafc; 
    --text-main: #1e293b; 
    --text-muted: #64748b; 
    --border-color: #e2e8f0; 
    --waze-color: #33ccff; 
    --gmaps-color: #34a853; 
    --fav-color: #facc15; 
}

* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; 
}

body { 
    display: flex; 
    flex-direction: column; 
    min-height: 100vh; 
    background-color: var(--bg-color); 
    color: var(--text-main); 
}

/* ==========================================================================
   CABECERA Y NAVEGACIÓN
   ========================================================================== */
header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 1px 32px; 
    background-color: #ffffff; 
    border-bottom: 1px solid var(--border-color); 
    z-index: 1000; 
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1); 
}

.logo { 
    display: flex; 
    align-items: center; 
    text-decoration: none; 
}

.logo img { 
    height: 100px; 
    width: auto; 
    display: block; 
}

.nav-links { 
    display: flex; 
    gap: 24px; 
    align-items: center; 
}

.nav-links > a { 
    text-decoration: none; 
    color: var(--text-main); 
    font-weight: 600; 
    font-size: 15px; 
    transition: color 0.2s ease; 
}

.nav-links > a:hover { 
    color: var(--primary-color); 
}

/* MENÚ DESPLEGABLE DE PERFIL */
#nav-profile { 
    display: none; 
    vertical-align: middle; 
}

.profile-dropdown { 
    position: relative; 
    display: inline-block; 
}

.profile-btn { 
    background: transparent; 
    border: none; 
    color: var(--text-main); 
    font-weight: 600; 
    font-size: 15px; 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    gap: 5px; 
    transition: color 0.2s ease; 
    padding: 10px 0; 
}

.profile-btn:hover { 
    color: var(--primary-color); 
}

.dropdown-content { 
    display: none; 
    position: absolute; 
    right: 0; 
    top: 100%; 
    background-color: white; 
    min-width: 180px; 
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1); 
    border-radius: 8px; 
    border: 1px solid var(--border-color); 
    overflow: hidden; 
    z-index: 1001; 
}

.profile-dropdown:hover .dropdown-content { 
    display: block; 
}

.dropdown-content a { 
    color: var(--text-main); 
    padding: 12px 16px; 
    text-decoration: none; 
    display: block; 
    font-size: 14px; 
    font-weight: 500; 
    transition: background-color 0.2s, color 0.2s; 
}

.dropdown-content a:hover { 
    background-color: #f1f5f9; 
    color: var(--primary-color); 
}

.dropdown-content .logout-option { 
    border-top: 1px solid var(--border-color); 
    color: #ef4444; 
}

.dropdown-content .logout-option:hover { 
    background-color: #fef2f2; 
    color: #dc2626; 
}

/* ==========================================================================
   FORMULARIOS GLOBALES (Auth, Contacto, Datos)
   ========================================================================== */
.form-group { 
    margin-bottom: 20px; 
}

.form-group label { 
    display: block; 
    font-size: 14px; 
    font-weight: 600; 
    margin-bottom: 8px; 
    color: var(--text-main); 
}

.form-group input, 
.form-group textarea, 
.form-group select { 
    width: 100%; 
    padding: 12px 16px; 
    border: 1px solid var(--border-color); 
    border-radius: 8px; 
    font-size: 15px; 
    font-family: inherit;
    outline: none; 
    background-color: var(--bg-color); 
    box-sizing: border-box;
    transition: all 0.2s; 
}

.form-group input:focus, 
.form-group textarea:focus, 
.form-group select:focus { 
    background-color: #ffffff; 
    border-color: var(--primary-color); 
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); 
}

.form-group textarea { 
    resize: vertical; 
    min-height: 120px; 
}

.btn-primary { 
    width: 100%; 
    padding: 12px 20px; 
    background-color: var(--primary-color); 
    color: white; 
    border: none; 
    border-radius: 8px; 
    cursor: pointer; 
    font-weight: 600; 
    font-size: 15px; 
    transition: background-color 0.2s; 
}

.btn-primary:hover { 
    background-color: var(--primary-hover); 
}

.btn-secondary { 
    width: 100%; 
    padding: 12px 20px; 
    background-color: #d1d5db; 
    color: #1f2937; 
    border: 1px solid #9ca3af; 
    border-radius: 8px; 
    cursor: pointer; 
    font-weight: 600; 
    font-size: 15px; 
    transition: all 0.2s; 
    margin-top: 10px; 
}

.btn-secondary:hover { 
    background-color: var(--primary-color); 
    color: white; 
    border-color: var(--primary-color); 
}

.hidden { display: none !important; }

/* ==========================================================================
   MAPA PRINCIPAL Y BUSCADOR (index.html)
   ========================================================================== */
.map-main { 
    position: relative; 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
}

#map { 
    flex: 1; 
    width: 100%; 
    z-index: 1; 
}

.search-wrapper { 
    position: absolute; 
    top: 20px; 
    left: 20px; 
    z-index: 999; 
    display: flex; 
    flex-direction: column; 
    width: 380px; 
}

.search-container-box { 
    background: white; 
    padding: 8px; 
    border-radius: 12px; 
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); 
    border: 1px solid var(--border-color); 
}

.search-controls { display: flex; gap: 8px; align-items: stretch; height: 46px; }
.search-controls input { flex: 1; min-width: 0; padding: 0 16px; border: none; border-radius: 8px; font-size: 15px; outline: none; background-color: var(--bg-color); }
.search-controls .btn-search { padding: 0 16px; background-color: var(--primary-color); color: white; border: none; border-radius: 8px; cursor: pointer; font-weight: 600; white-space: nowrap; }
.search-controls .btn-icon { width: 46px; min-width: 46px; padding: 0; background-color: white; border: 1px solid var(--border-color); border-radius: 8px; display: flex; justify-content: center; align-items: center; color: var(--text-main); cursor: pointer; transition: all 0.2s; }
.search-controls .btn-icon:hover { background-color: #f1f5f9; color: var(--primary-color); }

.btn-icon { 
    padding: 10px 12px; 
    background-color: white !important; 
    color: var(--text-main) !important; 
    border: 1px solid var(--border-color) !important; 
    border-radius: 8px; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    transition: all 0.2s; 
}

.btn-icon:hover { 
    background-color: #f1f5f9 !important; 
    color: var(--primary-color) !important; 
}

.search-results {
    list-style: none; 
    padding: 0; 
    margin: 0;
    max-height: 250px; 
    overflow-y: auto;
    display: none; 
    border-top: 1px solid var(--border-color);
    margin-top: 8px; 
    padding-top: 8px;
}

.search-results li {
    padding: 10px; 
    border-radius: 6px; 
    cursor: pointer;
    font-size: 13px; 
    color: var(--text-main); 
    transition: background 0.2s;
    line-height: 1.4; 
    border-bottom: 1px solid #f1f5f9;
}

.search-results li:last-child { border-bottom: none; }
.search-results li:hover { background-color: #f1f5f9; color: var(--primary-color); }

/* CONTROLES FLOTANTES DEL MAPA */
.map-controls-group {
    position: absolute;
    bottom: 30px;
    left: 20px;
    z-index: 999;
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-geo, .btn-layers { 
    background: white; 
    border: 1px solid var(--border-color); 
    border-radius: 8px; 
    width: 44px; 
    height: 44px; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    cursor: pointer; 
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); 
    color: var(--text-main); 
    transition: all 0.2s ease;
}

.btn-geo:hover, .btn-layers:hover {
    background-color: #f8fafc;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.layers-dropdown-container { position: relative; }

.layers-dropdown {
    position: absolute;
    bottom: 52px;
    left: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    flex-direction: column;
    min-width: 160px;
    z-index: 1000;
    overflow: hidden;
}

.layers-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid var(--border-color);
}

.layers-option:last-child { border-bottom: none; }
.layers-option:hover { background-color: var(--bg-color); }

.layers-option input[type="radio"] { cursor: pointer; accent-color: var(--primary-color); margin: 0; }
.layers-option label { cursor: pointer; font-weight: 500; font-size: 14px; color: var(--text-main); margin: 0; }

/* ==========================================================================
   PANEL DE RUTAS Y FILTROS (index.html)
   ========================================================================== */
.route-panel {
    background: white;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    margin-top: 12px;
    padding: 16px;
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
    display: flex;
    flex-direction: column;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.25s ease, opacity 0.25s ease;
}

.route-panel:not(.hidden) { max-height: 800px; opacity: 1; }

.route-panel-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.route-panel-header-info { flex-grow: 1; padding-right: 10px; }
.route-panel-header h4 { margin: 0 0 4px 0; font-size: 13px; color: #64748b; text-transform: uppercase; }
.route-destination-label { margin: 0; font-size: 16px; font-weight: bold; color: #0f172a; line-height: 1.2; }
.route-panel-header-actions { display: flex; gap: 8px; align-items: center; }

.btn-minimizar-ruta { background: #e2e8f0; border: none; width: 32px; height: 32px; border-radius: 6px; font-weight: bold; color: #475569; cursor: pointer; font-size: 16px; line-height: 1; justify-content: center; align-items: center; transition: all 0.2s; }
.btn-minimizar-ruta:hover { background: #cbd5e1; }

.route-clear-btn { width: 32px; height: 32px; padding: 0; display: flex; justify-content: center; align-items: center; border-radius: 6px; background: #fef2f2; color: #ef4444; border: 1px solid #fecaca; font-weight: bold; cursor: pointer; font-size: 16px; transition: all 0.2s; }
.route-clear-btn:hover { background: #ef4444; color: white; border-color: #ef4444; }

.btn-programar-ruta { width: 100%; background: #2563eb; color: white; padding: 12px; border: none; border-radius: 8px; font-weight: bold; cursor: pointer; margin-top: 5px; font-size: 15px; transition: background 0.2s; }
.btn-programar-ruta:hover { background: #1d4ed8; }

.route-details-fields { margin-top: 15px; }

.route-field-group label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 700; color: #334155; }
.route-origin-row { display: flex; gap: 8px; align-items: center; }
.route-origin-row input { flex: 1; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--border-color); background: var(--bg-color); font-size: 14px; }
.route-origin-row input:focus { outline: none; border-color: var(--primary-color); background: #f8fafc; }

.btn-route-square { width: 42px; min-width: 42px; height: 42px; padding: 0; border-radius: 12px; display: inline-flex; justify-content: center; align-items: center; font-size: 15px; background: var(--primary-color); color: white; border: none; cursor: pointer; font-weight: bold; }
.btn-route-square:hover { background: var(--primary-hover); }

.route-select { width: 100%; padding: 8px; border: 1px solid #cbd5e1; border-radius: 4px; background-color: white; font-family: inherit; font-size: 14px; outline: none; }

.route-message { display: none; font-size: 13px; line-height: 1.4; margin-top: 15px; }

/* PANEL DE PARADAS */
.route-stops-container { margin-top: 15px; border-top: 1px solid #cbd5e1; padding-top: 15px; }
.route-stops-container h5 { margin: 0 0 10px 0; font-size: 13px; color: #334155; }
.route-stops-list { list-style: none; padding: 0; margin: 0 0 10px 0; font-size: 12px; color: #475569; }

.stop-item { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; border-bottom: 1px dashed #e2e8f0; }
.stop-item-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 85%; font-weight: 500; }
.btn-remove-stop { background: none; border: none; color: #ef4444; cursor: pointer; font-weight: bold; font-size: 14px; padding: 4px; }

.btn-ruta-gmaps { width: 100%; background: #16a34a; color: white; padding: 12px; border: none; border-radius: 8px; font-weight: bold; cursor: pointer; margin-top: 15px; font-size: 15px; transition: background 0.2s; }
.btn-ruta-gmaps:hover { background: #15803d; }

/* FILTROS */
.filter-panel { 
    background: white; border-radius: 12px; border: 1px solid var(--border-color); 
    padding: 15px; margin-top: 10px; box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1); 
    display: flex; flex-direction: column; gap: 15px; 
}
.filter-panel h4 { margin: 0; font-size: 16px; color: var(--text-main); border-bottom: 1px solid var(--border-color); padding-bottom: 8px; }
.filter-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: var(--text-main); }
.filter-group input[type="range"] { width: 100%; accent-color: var(--primary-color); cursor: pointer; }
.filter-val { color: var(--primary-color); float: right; }
.brand-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.brand-grid label { font-weight: normal; font-size: 13px; display: flex; align-items: center; gap: 5px; margin: 0; cursor: pointer; }

/* ==========================================================================
   POPUP Y PINES DEL MAPA
   ========================================================================== */
.leaflet-popup-content-wrapper { border-radius: 12px; }
.popup-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; border-bottom: 1px solid var(--border-color); padding-bottom: 8px; }
.popup-header h3 { font-size: 16px; font-weight: 700; margin: 0; max-width: 80%; }
.popup-address { font-size: 14px; color: var(--text-muted); margin-bottom: 16px; }

.star-btn { font-size: 24px; cursor: pointer; color: #cbd5e1; transition: transform 0.2s, color 0.2s; user-select: none; }
.star-btn:hover { transform: scale(1.2); }
.star-btn.active { color: var(--fav-color); }

/* CALCULADOR EN POPUP */
.calc-container { margin-bottom: 10px; }
.btn-calc-deposit { width: 100%; background: #2563eb; color: white; border: none; padding: 6px; border-radius: 4px; cursor: pointer; font-weight: 600; transition: background 0.2s; }
.btn-calc-deposit:hover { background: #1d4ed8; }
.res-calc { margin-top: 5px; font-size: 12px; text-align: center; font-weight: bold; color: #1e293b; }

/* BOTÓN DE PARADA EN POPUP */
.btn-toggle-parada { width: 100%; margin-bottom: 10px; padding: 8px; border-radius: 6px; font-weight: bold; cursor: pointer; transition: all 0.2s; }
.btn-toggle-parada.add { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.btn-toggle-parada.add:hover { background: #dcfce7; }
.btn-toggle-parada.remove { background: #fef2f2; color: #ef4444; border: 1px solid #fecaca; }
.btn-toggle-parada.remove:hover { background: #fee2e2; }

.nav-buttons { display: flex; gap: 8px; }
.btn-nav { flex: 1; padding: 10px 0; text-align: center; text-decoration: none; color: white; border-radius: 8px; font-weight: 600; font-size: 14px; display: block; }
.btn-waze { background-color: var(--waze-color); color: #000; }
.btn-gmaps { background-color: var(--gmaps-color); }

/* PINES INDIVIDUALES */
.custom-div-icon { background: transparent; border: none; }
.custom-price-pin { background: white; border: 2px solid; border-radius: 8px; font-weight: 800; font-size: 13px; box-shadow: 0 2px 6px rgba(0,0,0,0.3); white-space: nowrap; width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; padding: 2px 6px; box-sizing: border-box; cursor: pointer; transition: transform 0.2s ease, box-shadow 0.2s ease; position: relative; }
.custom-price-pin.selected-stop { box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.55), 0 4px 14px rgba(15, 23, 42, 0.25); transform: scale(1.05); }
.custom-price-pin .stop-badge { position: absolute; top: -8px; left: -8px; width: 20px; height: 20px; border-radius: 999px; background: #2563eb; color: white; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; border: 2px solid white; box-shadow: 0 2px 6px rgba(0,0,0,0.18); }
.custom-div-icon:hover .custom-price-pin { transform: scale(1.15); box-shadow: 0 6px 12px rgba(0,0,0,0.5); }
.pin-mini-logo { width: 18px; height: 18px; object-fit: contain; margin-right: 5px; flex-shrink: 0; }

.custom-price-pin.pin-verde { border-color: #22c55e; color: #166534; }
.custom-price-pin.pin-amarillo { border-color: #eab308; color: #854d0e; }
.custom-price-pin.pin-rojo { border-color: #ef4444; color: #991b1b; }

.pin-fav-indicator { position: absolute; top: -10px; right: -8px; color: var(--fav-color); font-size: 16px; text-shadow: 1px 1px 2px rgba(0,0,0,0.8); z-index: 10; }

/* PINES CLUSTER PROVINCIA (Rediseño con medias) */
.custom-price-pin.cluster-mode { flex-direction: column; height: auto; padding: 6px 12px; border-radius: 8px; }
.cluster-price-large { font-size: 15px; font-weight: bold; }
.cluster-prov-name { font-size: 11px; font-weight: normal; opacity: 0.9; }

/* BOTONES DE MOVIMIENTO EN LISTA DE PARADAS */
#stopsList button { transition: color 0.2s, background 0.2s; }
#stopsList button:hover { color: #2563eb; background: #f1f5f9; border-radius: 4px; }

.cluster-popup-simple { text-align: center; padding: 12px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
.cluster-popup-simple h4 { margin: 0 0 8px 0; color: var(--text-main); font-size: 16px; font-weight: 600; }
.cluster-popup-simple p { margin: 0; color: var(--text-muted); font-size: 14px; }


/* ==========================================================================
   PÁGINA DE LOGIN Y REGISTRO (auth.html)
   ========================================================================== */
.form-main { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 40px 20px; }
.auth-main { justify-content: center; padding: 60px 20px; } 

.page-title { font-size: 28px; font-weight: 800; margin-bottom: 40px; color: var(--text-main); letter-spacing: 0.5px; }
.section-title { font-size: 24px; font-weight: normal; margin-bottom: 30px; text-align: center; color: var(--text-main); }

.card { background: white; padding: 40px; border-radius: 16px; box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); border: 1px solid var(--border-color); width: 100%; max-width: 1000px; display: flex; }

.form-column { flex: 1; padding: 0 40px; display: flex; flex-direction: column; }
.divider { width: 1px; background-color: var(--border-color); margin: 0 10px; }

.auth-divider-text { text-align: center; margin: 15px 0; color: #64748b; font-size: 14px; }

.btn-google { width: 100%; padding: 10px; background-color: #ffffff; color: #334155; border: 1px solid #cbd5e1; border-radius: 6px; cursor: pointer; font-weight: bold; display: flex; align-items: center; justify-content: center; gap: 10px; transition: background-color 0.2s; }
.btn-google img { width: 18px; height: 18px; }
.btn-google:hover { background-color: #f8fafc; }


/* ==========================================================================
   PÁGINA DE CONTACTO (contacto.html)
   ========================================================================== */
.contacto-main { padding: 40px 20px; max-width: 1000px; margin: 0 auto; width: 100%; box-sizing: border-box; }
.contacto-header { text-align: center; margin-bottom: 40px; }
.contacto-header h1 { color: #1e293b; margin-bottom: 10px; font-size: 28px; }
.contacto-header p { color: #64748b; font-size: 16px; }

.contacto-grid { display: grid; grid-template-columns: 1fr 1.5fr; gap: 40px; margin-bottom: 40px; align-items: start; }

.info-card { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; padding: 30px 20px; text-align: left; }
.info-item { margin-bottom: 20px; }
.info-item:last-child { margin-bottom: 0; }
.info-item h3 { font-size: 14px; color: #475569; margin: 0 0 5px 0; text-transform: uppercase; letter-spacing: 0.5px; }
.info-item p { margin: 0; color: #0f172a; font-weight: 600; font-size: 15px; }

.info-item-alert { background: #eff6ff; padding: 15px; border-radius: 8px; border: 1px solid #bfdbfe; margin-bottom: 25px; }
.info-item-alert h3 { color: #1d4ed8; margin-bottom: 8px; }
.info-item-alert p { color: #1e40af; font-size: 13px; font-weight: 500; line-height: 1.5; }

.mapa-section { margin-top: 40px; text-align: left; }
.mapa-section h2 { font-size: 20px; color: #0f172a; margin-bottom: 15px; }
#mapa-contacto { width: 100%; height: 400px; border-radius: 12px; border: 1px solid #cbd5e1; z-index: 1; }


/* ==========================================================================
   PÁGINA DE PERFIL Y DATOS (datos.html)
   ========================================================================== */
.profile-container { max-width: 800px; margin: 40px auto; padding: 0 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.data-card { background: white; border-radius: 12px; padding: 25px; border: 1px solid var(--border-color); box-shadow: 0 4px 6px rgba(0,0,0,0.05); }
.data-card h2 { margin-top: 0; font-size: 1.2rem; color: var(--primary-color); border-bottom: 2px solid #f1f5f9; padding-bottom: 10px; margin-bottom: 20px; }

.info-row { display: flex; justify-content: space-between; margin-bottom: 10px; font-size: 15px; }
.info-row span:first-child { font-weight: 600; color: #64748b; }
.status-active { color: #16a34a; font-weight: bold; }

.efficiency-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.wrapper-manual { display: none; margin-top: 10px; }

.stats-box { background: #f8fafc; padding: 15px; border-radius: 10px; border: 1px solid #e2e8f0; margin-top: 15px; }
.stat-item { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.stat-icon { font-size: 20px; }
.stat-label { display: block; color: #64748b; }
.stat-value-success { color: #16a34a; font-size: 1.2rem; }

.full-width { grid-column: 1 / -1; }
.price-badge { font-size: 11px; background: #e2e8f0; padding: 2px 6px; border-radius: 4px; margin-top: 4px; display: inline-block; color: #475569; }


/* ==========================================================================
   PÁGINA DE FAVORITAS (favoritas.html)
   ========================================================================== */
.fav-main { padding: 40px 32px; max-width: 1200px; margin: 0 auto; width: 100%; }
.fav-header { margin-bottom: 30px; border-bottom: 2px solid var(--border-color); padding-bottom: 15px; }
.fav-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 20px; }

.fav-card { background: white; border: 1px solid var(--border-color); border-radius: 12px; padding: 20px; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); display: flex; flex-direction: column; }
.fav-card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.fav-logo { width: 40px; height: 40px; object-fit: contain; }
.fav-title { font-size: 17px; font-weight: 700; color: var(--text-main); margin: 0; line-height: 1.2; }
.fav-price-tag { font-size: 20px; font-weight: 800; color: var(--primary-color); margin: 5px 0 10px 0; display: block; }
.fav-address { font-size: 13px; color: var(--text-muted); margin-bottom: 15px; }

.btn-calc-fill { width: 100%; background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; padding: 8px; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 13px; transition: background 0.2s; }
.btn-calc-fill:hover { background: #e0f2fe; }
.res-calc-box { display: none; margin-top: 5px; font-size: 14px; text-align: center; font-weight: bold; color: #0f172a; padding: 6px; background: #f1f5f9; border-radius: 4px; }

.chart-wrapper { margin-top: 15px; padding: 10px; background: #f8fafc; border-radius: 10px; border: 1px solid #e2e8f0; display: none; width: 100%; box-sizing: border-box; }
.chart-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.chart-header strong { font-size: 12px; }
.chart-header select { font-size: 11px; padding: 3px; border-radius: 4px; outline: none; border: 1px solid #cbd5e1; }
.chart-scroll-container { width: 100%; overflow-x: auto; margin-top: 10px; padding-bottom: 5px; }
.chart-scroll-container::-webkit-scrollbar { height: 6px; }
.chart-scroll-container::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.chart-svg { display: block; overflow: visible; }
.chart-msg-error { text-align: center; font-size: 11px; color: #ef4444; margin-top: 5px; display: none; }

.fav-actions { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; margin-top: auto; padding-top: 15px; }
.btn-action { padding: 8px; border-radius: 8px; cursor: pointer; font-size: 12px; font-weight: 600; text-align: center; text-decoration: none; border: 1px solid #cbd5e1; display: flex; align-items: center; justify-content: center; gap: 5px; transition: all 0.2s; }
.btn-map { background: #2563eb; color: white; border: none; }
.btn-map:hover { background: #1d4ed8; }
.btn-chart-toggle { background: #f1f5f9; color: #1e293b; }
.btn-chart-toggle:hover { background: #e2e8f0; }
.btn-remove { background: #fef2f2; color: #ef4444; border-color: #fecaca; }
.btn-remove:hover { background: #ef4444; color: white; border-color: #ef4444; }

.empty-state { text-align: center; padding: 60px 20px; background: white; border-radius: 12px; border: 1px dashed #cbd5e1; color: #64748b; }
.empty-state-full { grid-column: 1 / -1; }


/* ==========================================================================
   MEDIA QUERIES GLOBALES Y RESPONSIVE
   ========================================================================== */

/* Tablet (850px) */
@media (max-width: 850px) {
    .card { flex-direction: column; padding: 30px 20px; }
    .form-column, .contact-form-col { padding: 0; padding-bottom: 30px; }
    .divider { width: 100%; height: 1px; margin: 20px 0; }
}

/* Móvil (768px) */
@media (max-width: 768px) {
    /* Ajustes mapa principal */
    .search-wrapper { left: 15px !important; right: 15px !important; width: auto !important; max-width: none !important; }
    .search-container-box, .route-panel, .filter-panel { width: 100% !important; box-sizing: border-box !important; }
    .map-controls-group { bottom: 20px; left: 10px; gap: 6px; }
    .btn-geo, .btn-layers { width: 40px; height: 40px; }
    .btn-geo svg, .btn-layers svg { width: 20px; height: 20px; }
    .layers-dropdown { min-width: 150px; bottom: 48px; }
    .layers-option { padding: 10px 14px; font-size: 13px; }
    
    /* Ajustes perfil y datos */
    .profile-container { grid-template-columns: 1fr; padding: 15px; margin: 20px auto; }
    .efficiency-grid { grid-template-columns: 1fr; }
    
    /* Ajustes de contacto */
    .contacto-main { padding: 30px 15px; }
    .contacto-grid { grid-template-columns: 1fr; gap: 30px; }
    .encuesta-formulario, .info-card { padding: 20px; }
    #mapa-contacto { height: 300px; }

    /* Ajustes favoritas */
    .fav-main { padding: 20px 15px; }
    .fav-grid { grid-template-columns: 1fr; }
    .fav-actions { grid-template-columns: 1fr; }
    .btn-action { padding: 12px; font-size: 14px; }

}
