/* =========================================
   SIMPLE START DIGITAL - Selector de Contacto (T1)
   Escritorio: modal centrado · Móvil (<768px): bottom sheet
   El DOM lo genera js/contact-modal.js
   ========================================= */

/* Ocultar el botón flotante de WhatsApp mientras el modal está abierto */
body.ssd-modal-open .whatsapp-float {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* --- Overlay --- */
.ssd-overlay {
    position: fixed;
    inset: 0;
    z-index: 10005; /* por encima del header (10002) y del nav móvil */
    background: rgba(11, 37, 69, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.ssd-overlay.is-open { opacity: 1; }
.ssd-overlay:not(.is-open) { pointer-events: none; }
.ssd-overlay[hidden] { display: none; }

/* --- Diálogo --- */
.ssd-dialog {
    position: relative;
    background: var(--bg-color);
    color: var(--navy-blue);
    width: 100%;
    max-width: 430px;
    max-height: calc(100vh - 2.5rem);
    overflow-y: auto;
    border-radius: var(--radius-lg);
    padding: 1.75rem 1.6rem 1.5rem;
    box-shadow: 0 18px 50px rgba(6, 23, 40, 0.35);
    transform: translateY(14px);
    transition: transform 0.28s ease;
    font-family: var(--font-body);
}
.ssd-overlay.is-open .ssd-dialog { transform: translateY(0); }

.ssd-sheet-handle { display: none; }

.ssd-dialog button,
.ssd-dialog input,
.ssd-dialog select,
.ssd-dialog textarea {
    font-family: inherit;
}

/* --- Botón cerrar (✕) --- */
.ssd-close {
    position: absolute;
    top: 0.9rem;
    right: 0.9rem;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 0;
    cursor: pointer;
    background: var(--bg-color);
    color: var(--navy-blue);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1;
    box-shadow: -4px -4px 8px rgba(255, 255, 255, 0.8), 4px 4px 8px rgba(11, 37, 69, 0.12);
}
.ssd-close:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }

/* --- Título y subtítulo --- */
.ssd-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--navy-blue);
    margin: 0 0 0.35rem;
    padding-right: 2rem;
    line-height: 1.25;
    text-wrap: balance;
}
.ssd-title:focus { outline: none; }
.ssd-sub {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0 0 1.2rem;
}

/* --- Tarjetas de opción (selector) --- */
.ssd-options {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}
.ssd-opt-card {
    display: flex;
    align-items: center;
    gap: 0.95rem;
    text-align: left;
    width: 100%;
    appearance: none;
    border: 1px solid rgba(255, 255, 255, 0.4);
    cursor: pointer;
    font-size: 1rem;
    color: var(--navy-blue);
    background: linear-gradient(145deg, #ffffff, #eef1f5);
    border-radius: var(--radius-md);
    padding: 1rem 1.1rem;
    box-shadow: var(--shadow-light), var(--shadow-dark);
    transition: transform 0.15s ease;
    text-decoration: none;
}
.ssd-opt-card:hover { transform: translateY(-2px); opacity: 1; }
.ssd-opt-card:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
.ssd-opt-ico {
    flex: none;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ssd-opt-ico--wa { background: #25D366; }
.ssd-opt-ico--wa svg { width: 26px; height: 26px; fill: #fff; }
.ssd-opt-ico--form { background: var(--navy-blue); }
.ssd-opt-ico--form svg { width: 22px; height: 22px; fill: #fff; }
.ssd-opt-card b { display: block; font-size: 0.98rem; }
.ssd-opt-card small { color: var(--text-secondary); font-size: 0.82rem; }
.ssd-badge {
    display: inline-block;
    background: rgba(15, 163, 163, 0.12);
    color: #0B7676;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.15rem 0.55rem;
    border-radius: var(--radius-round);
    margin-left: 0.4rem;
    vertical-align: 1px;
}
.ssd-opt-arrow { margin-left: auto; color: var(--text-secondary); flex: none; display: flex; }

/* --- T10: bifurcación WhatsApp + agendamiento --- */
/* Badge coral (20% de la paleta). Texto #B33D26: 4.71:1 sobre el fondo compuesto
   del diálogo (#F6E3E3) y 5.03:1 sobre la tarjeta blanca — AA; #C2452D quedaba en 4.34:1. */
.ssd-badge--coral {
    background: rgba(255, 107, 85, 0.14);
    color: #B33D26;
}
.ssd-opt-ico--cal { background: var(--teal); }
.ssd-opt-ico--cal svg { width: 24px; height: 24px; fill: #fff; }
.ssd-back-wrap { margin: 0.9rem 0 0; }

.ssd-ag-loading {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-align: center;
    margin: 1.4rem 0;
}

.ssd-tz-note {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin: 0 0 0.8rem;
}
.ssd-tz-note svg { width: 14px; height: 14px; fill: var(--text-secondary); flex: none; }

.ssd-day-row {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.35rem;
    margin-bottom: 0.9rem;
}
.ssd-day-chip {
    flex: none;
    appearance: none;
    border: 1px solid rgba(11, 37, 69, 0.15);
    background: var(--white);
    color: var(--navy-blue);
    font-size: 1rem;
    cursor: pointer;
    border-radius: 12px;
    padding: 0.45rem 0.8rem;
    text-align: center;
    min-width: 74px;
}
.ssd-day-chip small {
    display: block;
    font-size: 0.68rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.ssd-day-chip b { font-size: 0.95rem; }
.ssd-day-chip.is-active {
    background: var(--navy-blue);
    color: #fff;
    border-color: var(--navy-blue);
}
.ssd-day-chip.is-active small { color: rgba(255, 255, 255, 0.7); }
.ssd-day-chip:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }

.ssd-slot-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.55rem;
}
.ssd-slot {
    appearance: none;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--navy-blue);
    background: var(--white);
    border: 1px solid rgba(11, 37, 69, 0.15);
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.25rem;
    text-align: center;
}
.ssd-slot:hover:not(:disabled) { border-color: var(--teal); }
.ssd-slot:focus-visible { outline: 3px solid var(--teal); outline-offset: 1px; }
.ssd-slot:disabled {
    background: transparent;
    color: rgba(11, 37, 69, 0.3);
    border-style: dashed;
    cursor: not-allowed;
    text-decoration: line-through;
}

.ssd-legend {
    display: flex;
    gap: 1rem;
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-top: 0.7rem;
}
.ssd-legend i {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 3px;
    margin-right: 0.3rem;
    vertical-align: -1px;
}
.ssd-legend-free i { background: var(--white); border: 1px solid rgba(11, 37, 69, 0.3); }
.ssd-legend-busy i { background: transparent; border: 1px dashed rgba(11, 37, 69, 0.3); }

/* Resumen teal del horario elegido */
.ssd-slot-summary {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(15, 163, 163, 0.1);
    border: 1px solid rgba(15, 163, 163, 0.25);
    border-radius: 12px;
    padding: 0.6rem 0.8rem;
    font-size: 0.88rem;
    margin-bottom: 1rem;
}
.ssd-slot-summary svg { width: 18px; height: 18px; fill: #0B7676; flex: none; }
.ssd-slot-summary b { color: #0B7676; }

.ssd-fld-hint {
    font-size: 0.74rem;
    color: var(--text-secondary);
    margin: 0.25rem 0 0;
}

/* Botón coral (rol de énfasis 20%). Fondo = coral de marca #FF6B55 con texto
   navy #0B2545: 5.49:1 (AA). Coral + blanco daba 2.81:1 y el coral oscurecido
   AA (#C94834, 4.71:1) se aleja demasiado de la marca. */
.ssd-btn-coral {
    appearance: none;
    border: 0;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    background: var(--coral);
    color: var(--navy-blue);
    padding: 0.75rem 1.4rem;
    border-radius: var(--radius-round);
    box-shadow: 4px 4px 10px rgba(255, 107, 85, 0.35);
    transition: transform 0.2s ease;
}
.ssd-btn-coral:hover { transform: translateY(-2px); }
.ssd-btn-coral:disabled { opacity: 0.7; cursor: wait; transform: none; }
.ssd-btn-coral:focus-visible { outline: 3px solid var(--navy-blue); outline-offset: 2px; }

/* Tarjeta de cita confirmada (acento coral) */
.ssd-appt-card {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--white);
    border: 1px solid rgba(11, 37, 69, 0.12);
    border-left: 3px solid var(--coral);
    border-radius: 12px;
    padding: 0.7rem 1rem;
    font-size: 0.92rem;
    margin: 0 0 1.1rem;
    box-shadow: -4px -4px 10px rgba(255, 255, 255, 0.8), 4px 4px 10px rgba(11, 37, 69, 0.08);
}
.ssd-appt-card svg { width: 20px; height: 20px; fill: var(--coral); flex: none; }
.ssd-appt-cta { margin: 0; }
.ssd-confirm-note {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin: 0.9rem 0 0;
}

/* --- Línea de confianza --- */
.ssd-trust {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    color: var(--text-secondary);
    font-size: 0.82rem;
    margin: 1.2rem 0 0;
}
.ssd-trust svg { width: 15px; height: 15px; fill: var(--teal); flex: none; }

/* --- Formulario --- */
.ssd-fld { margin-bottom: 0.85rem; }
.ssd-fld label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--navy-blue);
    margin-bottom: 0.3rem;
}
.ssd-fld input,
.ssd-fld select,
.ssd-fld textarea {
    width: 100%;
    font-size: 0.95rem;
    color: var(--navy-blue);
    background: var(--white);
    border: 1px solid rgba(11, 37, 69, 0.18);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.75rem;
}
.ssd-fld textarea { resize: vertical; min-height: 64px; }
.ssd-fld input:focus,
.ssd-fld select:focus,
.ssd-fld textarea:focus {
    outline: 3px solid rgba(15, 163, 163, 0.45);
    outline-offset: 0;
    border-color: var(--teal);
}
.ssd-fld input[aria-invalid="true"],
.ssd-fld select[aria-invalid="true"] {
    border-color: var(--coral);
}
.ssd-opt-note { font-weight: 400; color: var(--text-secondary); }

.ssd-form-error {
    color: var(--coral);
    font-size: 0.85rem;
    font-weight: 600;
    margin: 0.4rem 0 0;
}
.ssd-form-error[hidden] { display: none; }

.ssd-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.9rem;
    margin-top: 1.1rem;
}
.ssd-actions .btn { font-size: 0.95rem; }
.ssd-actions .btn:disabled { opacity: 0.7; cursor: wait; transform: none; }
.ssd-actions .btn:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }

.ssd-back {
    appearance: none;
    background: none;
    border: 0;
    cursor: pointer;
    font-size: 0.88rem;
    color: var(--text-secondary);
    font-weight: 600;
    padding: 0.4rem 0.2rem;
}
.ssd-back:hover { color: var(--navy-blue); }
.ssd-back:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* --- Estados: éxito / error --- */
.ssd-state { text-align: center; padding: 0.5rem 0 0.25rem; }
.ssd-state .ssd-title { padding-right: 0; margin-bottom: 0.4rem; }
.ssd-state .ssd-sub { margin-bottom: 1.2rem; }
.ssd-state-ico {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ssd-state-ico--ok { background: rgba(15, 163, 163, 0.14); }
.ssd-state-ico--ok svg { width: 32px; height: 32px; fill: var(--teal); }
.ssd-state-ico--err { background: rgba(255, 107, 85, 0.14); }
.ssd-state-ico--err svg { width: 32px; height: 32px; fill: var(--coral); }
.ssd-state .btn:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }

.ssd-btn-wa {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    appearance: none;
    border: 0;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    background: #25D366;
    color: #fff;
    padding: 0.8rem 1.4rem;
    border-radius: var(--radius-round);
    box-shadow: 4px 4px 10px rgba(11, 37, 69, 0.2);
    text-decoration: none;
    transition: transform 0.2s ease;
}
.ssd-btn-wa:hover { transform: translateY(-2px); opacity: 1; }
.ssd-btn-wa svg { width: 20px; height: 20px; fill: #fff; }
.ssd-btn-wa:focus-visible { outline: 3px solid var(--navy-blue); outline-offset: 2px; }

.ssd-retry-wrap { margin: 1rem 0 0; }

/* --- Solo lectores de pantalla --- */
.ssd-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;
}

/* --- Móvil: bottom sheet --- */
@media (max-width: 767px) {
    .ssd-overlay {
        align-items: flex-end;
        padding: 0;
    }
    .ssd-dialog {
        max-width: none;
        max-height: 86%;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        padding: 1.1rem 1.25rem 1.4rem;
        transform: translateY(100%);
    }
    .ssd-overlay.is-open .ssd-dialog { transform: translateY(0); }
    .ssd-sheet-handle {
        display: block;
        width: 44px;
        height: 4px;
        border-radius: 4px;
        background: rgba(11, 37, 69, 0.18);
        margin: 0 auto 0.9rem;
    }
}

/* --- Movimiento reducido --- */
@media (prefers-reduced-motion: reduce) {
    .ssd-overlay,
    .ssd-dialog,
    .ssd-opt-card,
    .ssd-btn-wa,
    .ssd-btn-coral {
        transition: none;
    }
}
