/* ==========================================================================
   Capa iOS — estilo iPhone / Apple para Mono Cromático
   Se carga después de Tailwind y de los <style> de cada página, así que
   refina sin reescribir el diseño existente.
   ========================================================================== */

:root {
    --ios-font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Poppins", "Helvetica Neue", Arial, sans-serif;
    --ios-ease: cubic-bezier(0.32, 0.72, 0, 1);
    --ios-radius: 14px;
    --ios-radius-lg: 22px;
    --ios-glass: rgba(16, 16, 18, 0.72);
    --ios-glass-light: rgba(255, 255, 255, 0.72);
    --ios-hairline: rgba(255, 255, 255, 0.12);
    --ios-shadow: 0 10px 30px rgba(0, 0, 0, 0.18), 0 1px 3px rgba(0, 0, 0, 0.08);
    --ios-gold: #EAB308;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ---------- Base y rendimiento ---------- */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}
body {
    font-family: var(--ios-font);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
    text-rendering: optimizeLegibility;
}
/* Respeta la barra inferior del iPhone (home indicator) */
body.pb-20 { padding-bottom: calc(5rem + var(--safe-bottom)); }
/* La barra fija de contacto mide más que pb-20 y tapaba el footer;
   marcas-modal.js ajusta el valor exacto según su altura real */
body.pb-20:has(> .fixed.bottom-0) { padding-bottom: calc(8rem + var(--safe-bottom)); }

img { -webkit-user-drag: none; }

/* background-attachment: fixed es lento y falla en iOS Safari */
@supports (-webkit-touch-callout: none) {
    .hero-bg { background-attachment: scroll !important; }
}
@media (max-width: 1024px) {
    .hero-bg { background-attachment: scroll !important; }
}

/* ---------- Barra de navegación translúcida ---------- */
nav.fixed {
    background-color: var(--ios-glass) !important;
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 0.5px solid var(--ios-hairline) !important;
    box-shadow: none !important;
    padding-top: var(--safe-top);
}
nav.fixed .mobile-menu { background: transparent !important; }

/* ---------- Botones y controles ---------- */
a, button, [role="button"] {
    touch-action: manipulation;
    transition-timing-function: var(--ios-ease);
}
a[class*="px-"][class*="py-"]:not(.rounded-none), button[class*="px-"][class*="py-"]:not(.rounded-none) {
    border-radius: 9999px;
}
a[class*="px-"][class*="py-"]:active, button:active, .vehicle-card:active {
    transform: scale(0.97);
    transition-duration: 0.1s;
}
:focus-visible {
    outline: 3px solid rgba(234, 179, 8, 0.6);
    outline-offset: 2px;
    border-radius: 10px;
}
input, textarea, select {
    font-family: inherit;
    font-size: max(16px, 1em); /* evita el zoom automático de iOS al enfocar */
    border-radius: var(--ios-radius) !important;
    -webkit-appearance: none;
    appearance: none;
}

/* ---------- Tarjetas ---------- */
.vehicle-card, .rounded-xl, .rounded-2xl {
    border-radius: var(--ios-radius-lg) !important;
}
.vehicle-card {
    box-shadow: var(--ios-shadow);
    transition: transform 0.35s var(--ios-ease), box-shadow 0.35s var(--ios-ease);
}

/* ---------- Barra de contacto inferior ---------- */
.fixed.bottom-0.left-0.right-0 {
    background-color: var(--ios-glass-light) !important;
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-top: 0.5px solid rgba(0, 0, 0, 0.1) !important;
    padding-bottom: calc(1rem + var(--safe-bottom)) !important;
}

/* ---------- Modales con fondo desenfocado ---------- */
#imageModal, #vehicleModal {
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
}

/* ---------- Scroll ---------- */
.overflow-y-auto, .overflow-x-auto {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(128, 128, 128, 0.4); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ==========================================================================
   Modal "Marcas y modelos que tapizamos" (hoja inferior estilo iOS)
   ========================================================================== */
.marcas-sheet-backdrop {
    position: fixed; inset: 0; z-index: 70;
    background: rgba(0, 0, 0, 0.45);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    opacity: 0; visibility: hidden;
    transition: opacity 0.35s var(--ios-ease), visibility 0s linear 0.35s;
    display: flex; align-items: flex-end; justify-content: center;
}
.marcas-sheet-backdrop.open {
    opacity: 1; visibility: visible;
    transition: opacity 0.35s var(--ios-ease);
}
.marcas-sheet {
    width: 100%; max-width: 640px; max-height: 88vh;
    display: flex; flex-direction: column;
    background: rgba(28, 28, 30, 0.92);
    -webkit-backdrop-filter: saturate(180%) blur(30px);
    backdrop-filter: saturate(180%) blur(30px);
    color: #fff;
    border-radius: 28px 28px 0 0;
    border: 0.5px solid var(--ios-hairline);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.4);
    padding-bottom: var(--safe-bottom);
    transform: translateY(100%);
    transition: transform 0.45s var(--ios-ease);
    font-family: var(--ios-font);
}
.marcas-sheet-backdrop.open .marcas-sheet { transform: translateY(0); }
@media (min-width: 768px) {
    .marcas-sheet-backdrop { align-items: center; }
    .marcas-sheet { border-radius: 28px; transform: translateY(24px) scale(0.96); opacity: 0;
        transition: transform 0.4s var(--ios-ease), opacity 0.3s var(--ios-ease); }
    .marcas-sheet-backdrop.open .marcas-sheet { transform: none; opacity: 1; }
}
.marcas-grabber {
    width: 36px; height: 5px; border-radius: 3px;
    background: rgba(255, 255, 255, 0.3);
    margin: 8px auto 0; flex-shrink: 0;
}
.marcas-header {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 14px 20px 10px;
}
.marcas-header h2 { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.marcas-header p { font-size: 0.85rem; color: rgba(235, 235, 245, 0.6); margin: 2px 0 0; }
.marcas-close {
    width: 32px; height: 32px; flex-shrink: 0;
    border-radius: 50%; border: 0; cursor: pointer;
    background: rgba(118, 118, 128, 0.32); color: rgba(235, 235, 245, 0.8);
    font-size: 15px; display: inline-flex; align-items: center; justify-content: center;
}
.marcas-body {
    overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
    padding: 4px 16px 16px;
}
@media (min-width: 768px) {
    .marcas-sheet-wide { max-width: 920px; }
}

/* Carrusel infinito de logos de marcas */
.veh-marquee {
    overflow: hidden; margin: 4px -16px 0; padding: 14px 0;
    background: #121212;
    -webkit-mask-image: linear-gradient(to right, transparent, #000 12%, #000 88%, transparent);
    mask-image: linear-gradient(to right, transparent, #000 12%, #000 88%, transparent);
}
.veh-marquee-track {
    display: flex; gap: 22px; width: max-content;
    animation: veh-marquee 32s linear infinite;
}
.veh-marquee:hover .veh-marquee-track { animation-play-state: paused; }
@keyframes veh-marquee {
    from { transform: translateX(0); }
    to { transform: translateX(calc(-50% - 11px)); }
}
.veh-logo {
    width: 64px; height: 64px; flex-shrink: 0; border-radius: 50%;
    background: #fff; display: flex; align-items: center; justify-content: center;
    overflow: hidden; filter: grayscale(100%); opacity: 0.7;
    transition: filter 0.3s var(--ios-ease), opacity 0.3s var(--ios-ease), transform 0.3s var(--ios-ease);
}
.veh-logo:hover { filter: none; opacity: 1; transform: scale(1.08); }
.veh-logo img { width: 100%; height: 100%; object-fit: contain; }
.veh-logo span {
    color: #111; font-weight: 800; font-size: 0.6rem; line-height: 1.1;
    text-align: center; text-transform: uppercase; letter-spacing: -0.01em; padding: 4px;
}
.veh-subtitle {
    color: var(--ios-gold); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em;
    text-transform: uppercase; text-align: center; margin: 12px 0 16px;
}

/* Tarjetas de vehículos */
.veh-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 768px) {
    .veh-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
}
.veh-card {
    display: flex; flex-direction: column; text-decoration: none;
    background: #fff; color: #111; border-radius: 16px; overflow: hidden;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    transition: transform 0.3s var(--ios-ease), box-shadow 0.3s var(--ios-ease);
}
.veh-card:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(234, 179, 8, 0.3); }
.veh-card:active { transform: scale(0.97); }
.veh-media {
    height: 110px; display: flex; align-items: center; justify-content: center;
    padding: 10px; background: #fff;
}
.veh-media img { max-width: 100%; max-height: 100%; object-fit: contain; }
.veh-media img.veh-foto { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; }
.veh-media img.veh-logo-img { width: 74px; height: 74px; }
.veh-marca-texto {
    width: 74px; height: 74px; border-radius: 50%; border: 3px solid #111;
    display: flex; align-items: center; justify-content: center; text-align: center;
    font-weight: 800; font-size: 0.68rem; text-transform: uppercase; line-height: 1.1; padding: 4px;
}
.veh-info { padding: 4px 10px 14px; text-align: center; }
.veh-brand { color: #B45309; font-weight: 800; font-size: 0.9rem; }
.veh-model { color: #374151; font-size: 0.92rem; margin-top: 2px; }
.veh-type { color: #6B7280; font-size: 0.78rem; margin-top: 4px; }

.veh-actions { display: flex; justify-content: center; margin-top: 4px; }
.veh-btn {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 12px 20px; border-radius: 14px; font-weight: 700; font-size: 0.95rem;
    text-decoration: none;
}
.veh-btn-dark { background: #2C2C2E; color: #fff !important; border: 2px solid var(--ios-gold); }
.veh-btn-dark:hover { background: var(--ios-gold); color: #000 !important; }
.marcas-note { font-size: 0.78rem; color: rgba(235, 235, 245, 0.55); text-align: center; margin: 14px 8px 4px; }
.marcas-cta {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    margin: 12px 16px 16px; padding: 14px 20px;
    border-radius: 14px; background: #30D158; color: #000 !important;
    font-weight: 700; font-size: 1rem; text-decoration: none;
}
.marcas-cta:active { transform: scale(0.98); }

/* Botón que abre el modal */
.btn-marcas {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 12px 22px; border-radius: 9999px; border: 0; cursor: pointer;
    background: rgba(234, 179, 8, 0.15); color: var(--ios-gold);
    border: 1px solid rgba(234, 179, 8, 0.45);
    font-weight: 700; font-size: 0.95rem;
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    transition: background 0.25s var(--ios-ease), transform 0.25s var(--ios-ease);
}
.btn-marcas:hover { background: var(--ios-gold); color: #000; }

body.marcas-lock { overflow: hidden; }

/* ---------- Accesibilidad: menos movimiento ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Menú de escritorio: con 8 enlaces se aprieta entre 1024 y 1280px */
@media (min-width: 1024px) and (max-width: 1279px) {
    nav.fixed .lg\:flex.gap-6 { gap: 0.9rem; }
    nav.fixed .lg\:flex.gap-6 > a.text-sm { font-size: 0.75rem; }
    nav.fixed .lg\:flex.gap-6 > a.nav-btn { padding-left: 1rem; padding-right: 1rem; }
}

/* ---------- Modal de Instagram ---------- */
.ig-perfil { display: flex; align-items: center; gap: 14px; padding: 8px 4px 16px; }
.ig-avatar {
    width: 64px; height: 64px; border-radius: 50%; padding: 3px; flex-shrink: 0;
    background: linear-gradient(45deg, #F58529, #DD2A7B, #8134AF, #515BD4);
}
.ig-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 2px solid #1C1C1E; }
.ig-usuario { font-weight: 700; font-size: 1rem; }
.ig-nombre { font-size: 0.82rem; color: rgba(235, 235, 245, 0.6); margin-top: 2px; }
.ig-lista { list-style: none; margin: 0; padding: 0; background: rgba(44, 44, 46, 0.85); border-radius: 16px; }
.ig-lista li { display: flex; align-items: center; gap: 12px; padding: 14px 16px; font-size: 0.92rem; }
.ig-lista li + li { border-top: 0.5px solid rgba(84, 84, 88, 0.65); }
.ig-lista i { color: #DD2A7B; width: 18px; text-align: center; }
.ig-cta { background: linear-gradient(45deg, #F58529, #DD2A7B, #8134AF) !important; color: #fff !important; }
.btn-instagram {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    padding: 14px 28px; border-radius: 9999px; border: 0; cursor: pointer;
    background: linear-gradient(45deg, #F58529, #DD2A7B, #8134AF); color: #fff !important;
    font-weight: 800; font-size: 1rem; text-decoration: none;
    box-shadow: 0 8px 24px rgba(221, 42, 123, 0.35);
    transition: transform 0.25s var(--ios-ease);
}
.btn-instagram:hover { transform: scale(1.04); }
.ig-botones { display: flex; flex-direction: column; gap: 0; }
.ig-botones .marcas-cta + .marcas-cta { margin-top: 0; }
.google-cta { background: #fff !important; color: #1f1f1f !important; }
.google-cta .fa-google { color: #4285F4; }
.google-cta .fa-star { color: #FBBC05; }

/* Botones redondos flotantes: Instagram (abre el modal) y perfil de Google */
.social-flotantes {
    position: fixed; right: 14px; bottom: calc(24px + var(--safe-bottom)); z-index: 55;
    display: flex; flex-direction: column; gap: 12px;
}
/* En páginas con la barra fija de contacto, se ubican por encima de ella */
body:has(> .fixed.bottom-0) .social-flotantes { bottom: calc(120px + var(--safe-bottom)); }
.social-circulo {
    width: 54px; height: 54px; border-radius: 50%; border: 0; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 26px; text-decoration: none;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
    transition: transform 0.25s var(--ios-ease);
}
.social-circulo:hover { transform: scale(1.1); }
.social-ig { background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fd5949 45%, #d6249f 60%, #285AEB 90%); color: #fff; }
.social-google { background: #fff; color: #4285F4; border: 2px solid #e5e7eb; }
/* Fuera del modal el carrusel ocupa el ancho de su sección, sin margen negativo */
section > .veh-marquee { margin: 0; }

/* Barra de contacto: en teléfonos angostos los botones no caben con su relleno original */
@media (max-width: 480px) {
    body > .fixed.bottom-0 a, body > .fixed.bottom-0 > div > div {
        padding-left: 0.75rem !important; padding-right: 0.75rem !important; font-size: 0.95rem !important;
    }
}
.ig-usuario { word-break: break-all; }

/* ---------- Reseñas de Google ---------- */
.resenas-grid {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px;
}
@media (max-width: 1023px) {
    /* En móvil y tablet se deslizan de lado, como un carrusel */
    .resenas-grid {
        display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 14px;
        margin: 0 -16px; padding: 4px 16px 12px; -webkit-overflow-scrolling: touch;
    }
    .resena-card { flex: 0 0 82%; scroll-snap-align: center; }
}
.resena-card {
    margin: 0; background: #fff; border: 1px solid #e5e7eb; border-radius: 18px;
    padding: 18px; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}
.resena-autor { display: flex; align-items: center; gap: 12px; }
.resena-avatar {
    width: 42px; height: 42px; border-radius: 50%; color: #fff; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.resena-nombre { font-weight: 700; color: #111; text-transform: capitalize; }
.resena-meta { font-size: 0.78rem; color: #6b7280; }
.resena-g { margin-left: auto; color: #4285F4; font-size: 1.1rem; }
.resena-estrellas { color: #FBBC05; letter-spacing: 2px; margin: 12px 0 6px; font-size: 1.05rem; }
.resena-texto { margin: 0; color: #374151; line-height: 1.6; font-size: 0.95rem; }

/* Mapas Leaflet: teselas de OpenStreetMap (sin API key) oscurecidas para el diseño negro/dorado */
.leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(0.85) contrast(0.9) saturate(0.6); }

/* ---------- GPS y seguridad vehicular (rojo, gris y blanco) ---------- */
.gps-seccion { background: #1F2937; color: #fff; }
.gps-marco {
    border: 3px solid #DC2626; border-radius: 26px; padding: 36px 20px;
    background: linear-gradient(180deg, #111827 0%, #1F2937 100%);
    box-shadow: 0 0 0 6px rgba(220, 38, 38, 0.12), 0 20px 50px rgba(0, 0, 0, 0.4);
}
@media (min-width: 768px) { .gps-marco { padding: 48px 40px; } }
.gps-alerta { width: 64px; height: 56px; display: inline-block; filter: drop-shadow(0 4px 12px rgba(220, 38, 38, 0.5)); }
.gps-seccion > .container .gps-alerta { width: 76px; height: 66px; display: block; margin: 0 auto 12px; }
.gps-alerta-mini { width: 22px; height: 19px; display: inline-block; }
.gps-etiqueta {
    display: inline-block; background: #DC2626; color: #fff; border-radius: 9999px;
    padding: 4px 14px; font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em;
}
.gps-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (min-width: 1024px) { .gps-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; } }
.gps-card {
    background: #374151; border: 1px solid #4B5563; border-top: 4px solid #DC2626;
    border-radius: 16px; padding: 18px 14px; text-align: center;
}
.gps-card i { font-size: 1.8rem; color: #EF4444; margin-bottom: 10px; }
.gps-card h3 { font-weight: 800; text-transform: uppercase; font-size: 0.9rem; margin-bottom: 6px; color: #fff; }
.gps-card p { font-size: 0.82rem; color: #D1D5DB; line-height: 1.5; }
.gps-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    padding: 14px 28px; border-radius: 9999px; font-weight: 800; text-transform: uppercase;
    cursor: pointer; text-decoration: none; transition: transform 0.25s var(--ios-ease), background 0.25s var(--ios-ease);
}
.gps-btn:hover { transform: scale(1.04); }
.gps-btn-rojo { background: #DC2626; color: #fff !important; border: 2px solid #DC2626; }
.gps-btn-rojo:hover { background: #B91C1C; }
.gps-btn-blanco { background: #fff; color: #111827 !important; border: 2px solid #fff; }
.gps-btn-blanco i { color: #16A34A; }

/* Modal */
.gps-sheet { border: 2px solid #DC2626; border-bottom: 0; }
@media (min-width: 768px) { .gps-sheet { border-bottom: 2px solid #DC2626; } }
.gps-header { display: flex; align-items: center; gap: 14px; }
.gps-header .gps-alerta { width: 46px; height: 40px; flex-shrink: 0; }
.gps-lista { list-style: none; margin: 0; padding: 0; background: rgba(55, 65, 81, 0.85); border-radius: 16px; overflow: hidden; }
.gps-lista li { display: flex; gap: 14px; padding: 14px 16px; align-items: flex-start; }
.gps-lista li + li { border-top: 0.5px solid rgba(156, 163, 175, 0.35); }
.gps-lista i { color: #EF4444; font-size: 1.2rem; width: 24px; text-align: center; margin-top: 2px; }
.gps-lista strong { display: block; color: #fff; }
.gps-lista span { display: block; font-size: 0.85rem; color: #D1D5DB; margin-top: 2px; }
.gps-modalidad { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.gps-modalidad div {
    background: #fff; color: #111827; border-radius: 14px; padding: 12px; text-align: center;
    border-bottom: 3px solid #DC2626;
}
.gps-modalidad i { color: #DC2626; font-size: 1.2rem; display: block; margin-bottom: 4px; }
.gps-modalidad strong { display: block; font-size: 0.9rem; }
.gps-modalidad span { display: block; font-size: 0.75rem; color: #4B5563; margin-top: 2px; }
.gps-cta { background: #DC2626 !important; color: #fff !important; }
