/**
 * Maps Seguros — Estilos "Rutas Seguras"
 * Complementa Tailwind CDN. Tema luminoso, azul-dominante.
 */

/* ─── Tipografía ─── */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Sora', system-ui, sans-serif;
}

[x-cloak] { display: none !important; }

/* ─── Palabra clave en dorado ─── */
.text-gold { color: #F2B705; }

.highlight-gold {
    color: #F2B705;
    font-weight: 700;
}

/* ─── Acento superior dorado en bloques ─── */
.border-accent-top {
    border-top: 3px solid #F2B705;
}

/* ─── Cortes diagonales (clip-path) ─── */
.clip-diagonal-bottom {
    clip-path: polygon(0 0, 100% 0, 100% 85%, 0 100%);
}

.clip-diagonal-top {
    clip-path: polygon(0 15%, 100% 0, 100% 100%, 0 100%);
}

.clip-diagonal-hero {
    clip-path: polygon(12% 0, 100% 0, 100% 100%, 0 100%);
}

@media (max-width: 1023px) {
    .clip-diagonal-hero {
        clip-path: none;
    }
}

/* ─── Línea de ruta punteada ─── */
.route-line {
    position: relative;
}

.route-line::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: repeating-linear-gradient(
        90deg,
        #3B92E0 0,
        #3B92E0 8px,
        transparent 8px,
        transparent 16px
    );
    transform: translateY(-50%);
    z-index: 0;
}

.route-pin {
    position: relative;
    z-index: 1;
}

/* Ruta vertical — pasos de cotización */
.route-step__line {
    background: repeating-linear-gradient(
        180deg,
        #3B92E0 0,
        #3B92E0 6px,
        transparent 6px,
        transparent 12px
    );
}

.scrollbar-thin {
    scrollbar-width: thin;
    scrollbar-color: #3B92E0 transparent;
    -webkit-overflow-scrolling: touch;
}
.scrollbar-thin::-webkit-scrollbar { height: 4px; }
.scrollbar-thin::-webkit-scrollbar-thumb {
    background: #3B92E0;
    border-radius: 2px;
}

/* Ruta vertical — pasos de cotización */
.route-step__line {
    background: repeating-linear-gradient(
        180deg,
        #3B92E0 0,
        #3B92E0 6px,
        transparent 6px,
        transparent 12px
    );
}

/* Scroll horizontal móvil */
.scrollbar-thin {
    scrollbar-width: thin;
    scrollbar-color: #3B92E0 transparent;
    -webkit-overflow-scrolling: touch;
}
.scrollbar-thin::-webkit-scrollbar { height: 4px; }
.scrollbar-thin::-webkit-scrollbar-thumb {
    background: #3B92E0;
    border-radius: 2px;
}

/* ─── Duotono azul sobre imágenes ─── */
.img-duotone {
    filter: saturate(0.85) contrast(1.05);
    position: relative;
}

.img-duotone-wrap::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(12, 99, 183, 0.25) 0%, rgba(8, 47, 92, 0.15) 100%);
    pointer-events: none;
}

/* ─── Widget de chat de cotización ─── */
.chat-widget {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 50;
}

.chat-float {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 9999px;
    background: #0C63B7;
    color: white;
    box-shadow: 0 4px 20px rgba(12, 99, 183, 0.4);
    position: relative;
}

.chat-float:hover {
    background: #082F5C;
    box-shadow: 0 6px 24px rgba(12, 99, 183, 0.45);
}

.chat-float__badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 1.125rem;
    height: 1.125rem;
    padding: 0 0.25rem;
    font-size: 0.625rem;
    font-weight: 700;
    line-height: 1.125rem;
    text-align: center;
    color: #082F5C;
    background: #F2B705;
    border-radius: 9999px;
}

.chat-panel {
    position: absolute;
    bottom: calc(100% + 0.75rem);
    right: 0;
    width: min(100vw - 2rem, 22rem);
    max-height: min(32rem, calc(100vh - 6rem));
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 12px 40px rgba(8, 47, 92, 0.2);
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

.chat-panel__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1rem 0.875rem;
    background: #0C63B7;
}

.chat-panel__messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: #F4F7FB;
    min-height: 14rem;
    max-height: 22rem;
}

.chat-msg {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.875rem;
}

.chat-msg--user {
    flex-direction: row-reverse;
}

.chat-msg__avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 9999px;
    object-fit: cover;
    flex-shrink: 0;
}

.chat-msg__bubble {
    max-width: 85%;
    padding: 0.625rem 0.75rem;
    border-radius: 0.625rem;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.chat-msg--user .chat-msg__bubble {
    background: #0C63B7;
    color: #fff;
}

.chat-msg__sender {
    font-size: 0.6875rem;
    font-weight: 600;
    color: #64748B;
    margin-bottom: 0.25rem;
}

.chat-msg__text {
    font-size: 0.8125rem;
    line-height: 1.45;
    color: #1B2733;
    white-space: pre-wrap;
}

.chat-msg--user .chat-msg__text {
    color: #fff;
}

.chat-msg__time {
    font-size: 0.625rem;
    color: #94a3b8;
    margin-top: 0.25rem;
    text-align: right;
}

.chat-msg--user .chat-msg__time {
    color: rgba(255,255,255,0.7);
}

.chat-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 0.5rem;
    padding-left: 2.5rem;
}

.chat-option-btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #0C63B7;
    background: #fff;
    border: 1px solid #3B92E0;
    border-radius: 9999px;
    transition: background 0.15s, color 0.15s;
}

.chat-option-btn:hover {
    background: #0C63B7;
    color: #fff;
}

.chat-panel__input {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem;
    border-top: 1px solid #e5e7eb;
    background: #fff;
}

.chat-panel__textfield {
    flex: 1;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    outline: none;
}

.chat-panel__textfield:focus {
    border-color: #0C63B7;
    box-shadow: 0 0 0 2px rgba(12, 99, 183, 0.15);
}

.chat-panel__send {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.5rem;
    background: #0C63B7;
    color: #fff;
    flex-shrink: 0;
    transition: background 0.15s;
}

.chat-panel__send:hover { background: #082F5C; }

.chat-form {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: #fff;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
}

.chat-form__field {
    margin-bottom: 0.625rem;
}

.chat-form__field label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 600;
    color: #64748B;
    margin-bottom: 0.25rem;
}

.chat-form__field input {
    width: 100%;
    padding: 0.4375rem 0.625rem;
    font-size: 0.8125rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
}

.chat-form__field input:focus {
    outline: none;
    border-color: #0C63B7;
}

.chat-form__input--error {
    border-color: #ef4444 !important;
}

.chat-form__error {
    font-size: 0.625rem;
    color: #ef4444;
    margin-top: 0.125rem;
    display: block;
}

.chat-form__submit {
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.625rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #082F5C;
    background: #F2B705;
    border-radius: 0.375rem;
    transition: background 0.15s;
}

.chat-form__submit:hover:not(:disabled) { background: #e5a804; }
.chat-form__submit:disabled { opacity: 0.6; cursor: not-allowed; }

@media (max-width: 480px) {
    .chat-panel {
        position: fixed;
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-height: 85vh;
        border-radius: 0.75rem 0.75rem 0 0;
    }
    .chat-widget { bottom: 1rem; right: 1rem; }
}

/* ─── Sello de agente autorizado — fijo, esquina inferior izquierda ─── */
.hero-seal {
    position: fixed;
    left: 0.75rem;
    bottom: 0.75rem;
    z-index: 45;
    display: flex;
    margin: 0;
    padding: 0;
    pointer-events: none;
}

.hero-seal__img {
    display: block;
    width: 9.375rem;
    height: auto;
    filter: drop-shadow(0 8px 16px rgba(8, 47, 92, 0.42));
    animation: hero-seal-in 0.7s ease 0.25s both;
}

@media (min-width: 640px) {
    .hero-seal {
        left: 1rem;
        bottom: 1rem;
    }

    .hero-seal__img {
        width: 12.5rem;
    }
}

@media (min-width: 1024px) {
    .hero-seal {
        left: 1.25rem;
        bottom: 1.25rem;
    }

    .hero-seal__img {
        width: 15.625rem;
    }
}

@keyframes hero-seal-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .hero-seal__img {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}

/* ─── Accesibilidad ─── */
:focus-visible {
    outline: 2px solid #0C63B7;
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

::selection {
    background: rgba(12, 99, 183, 0.2);
}

/* ─── Secciones ─── */
.section-pad {
    padding-top: 4.5rem;
    padding-bottom: 4.5rem;
}

@media (min-width: 1024px) {
    .section-pad {
        padding-top: 5.5rem;
        padding-bottom: 5.5rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
    .motion-lift:hover,
    .motion-photo:hover .motion-img,
    .motion-img:hover {
        transform: none !important;
    }
}

/* ─── Logo en cuadro blanco (footer) ─── */
.logo-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border-radius: 0.5rem;
    padding: 0.5rem 0.625rem;
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.15);
}

.logo-box--footer {
    padding: 0.625rem 0.875rem;
}

/* ─── Formularios de página ─── */
.page-form__label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #64748B;
    margin-bottom: 0.375rem;
}

.page-form__input {
    width: 100%;
    padding: 0.625rem 0.75rem;
    font-size: 0.875rem;
    color: #1B2733;
    background: #F4F7FB;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.page-form__input:focus {
    outline: none;
    border-color: #0C63B7;
    box-shadow: 0 0 0 3px rgba(12, 99, 183, 0.12);
    background: #fff;
}

.page-form__textarea {
    resize: vertical;
    min-height: 6rem;
}

.page-form__input--error {
    border-color: #ef4444 !important;
}

.page-form__error {
    display: block;
    font-size: 0.75rem;
    color: #ef4444;
    margin-top: 0.25rem;
}

/* ─── Movimiento ligero — botones, enlaces e imágenes ─── */
.motion-lift {
    transition: transform 0.25s ease, box-shadow 0.25s ease, background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.motion-img {
    transition: transform 0.45s ease;
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
    .motion-lift:hover {
        transform: translateY(-2px);
    }

    .motion-lift:active {
        transform: translateY(0);
    }

    .motion-photo:hover .motion-img,
    a.motion-lift:hover .motion-img {
        transform: scale(1.02);
    }

    /* Botones y CTAs del sitio */
    main a[class*="py-"],
    header a[class*="py-"],
    footer a[class*="py-"],
    main button[class*="py-"],
    header button[class*="py-"],
    .chat-float,
    .chat-option-btn,
    .chat-form__submit,
    .chat-panel__send,
    .route-pin {
        transition: transform 0.25s ease, box-shadow 0.25s ease, background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    }

    main a[class*="py-"]:hover,
    header a[class*="py-"]:hover,
    footer a[class*="py-"]:hover,
    main button[class*="py-"]:hover,
    header button[class*="py-"]:hover,
    .chat-float:hover,
    .chat-option-btn:hover,
    .chat-form__submit:hover:not(:disabled),
    .chat-panel__send:hover,
    .route-pin:hover {
        transform: translateY(-2px);
    }

    main a[class*="py-"]:active,
    header a[class*="py-"]:active,
    .chat-float:active,
    .route-pin:active {
        transform: translateY(0);
    }

    /* Iconos de la ruta — elevación del pin */
    .route-pin:hover > span:first-child {
        transform: translateY(-3px);
        box-shadow: 0 6px 16px rgba(12, 99, 183, 0.2);
    }

    .route-pin > span:first-child {
        transition: transform 0.25s ease, box-shadow 0.25s ease, background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    }
}
