/* ── Animación toast global ─────────────────────────── */
@keyframes fadeInDown {
    from { opacity: 0; transform: scale(.92); }
    to   { opacity: 1; transform: scale(1); }
}

/* ── Variables ─────────────────────────────────────── */
:root {
    --hjju-primary:    #1a5276;
    --hjju-secondary:  #2980b9;
    --hjju-accent:     #27ae60;
    --hjju-light:      #e8f4fb;
    --hjju-bg:         #f0f5f9;
    --hjju-text:       #1e2d3d;
    --hjju-muted:      #607080;
    --radius-lg:       1rem;
    --radius-md:       .75rem;
    --shadow-sm:       0 2px 8px rgba(26,82,118,.08);
    --shadow-md:       0 4px 20px rgba(26,82,118,.12);
    --shadow-lg:       0 8px 32px rgba(26,82,118,.15);
    --transition:      .2s ease;
}

/* ── Reset / Base ───────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    background: var(--hjju-bg);
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    font-size: 1rem;
    color: var(--hjju-text);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

/* ── Header ────────────────────────────────────────── */
.site-header {
    background: #fff;
    border-bottom: 3px solid var(--hjju-primary);
    padding: .85rem 0;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}
.site-header .header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.site-logo {
    height: 110px;
    width: auto;
}
.site-header .header-subtitle {
    font-size: .82rem;
    color: var(--hjju-primary);
    font-weight: 600;
    text-align: right;
    line-height: 1.5;
    opacity: .85;
    letter-spacing: .01em;
}

/* ── Hero ───────────────────────────────────────────── */
.hero-section {
    background: linear-gradient(135deg, var(--hjju-primary) 0%, #1f6fa8 60%, #2980b9 100%);
    color: #fff;
    padding: 2.5rem 0 2.2rem;
    position: relative;
    overflow: hidden;
}
.hero-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
}
.hero-inner {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.hero-icon-wrap {
    background: rgba(255,255,255,.15);
    border-radius: 50%;
    width: 72px;
    height: 72px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    box-shadow: 0 4px 16px rgba(0,0,0,.15);
}
.hero-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0 0 .25rem;
    line-height: 1.2;
    letter-spacing: -.01em;
}
.hero-subtitle {
    font-size: 1rem;
    opacity: .88;
    margin: 0;
    line-height: 1.4;
}
.hero-pills {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: .85rem;
}
.hero-pill {
    background: rgba(255,255,255,.18);
    border: 1px solid rgba(255,255,255,.3);
    border-radius: 2rem;
    padding: .3rem .85rem;
    font-size: .8rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: .4rem;
}

/* ── Main container ─────────────────────────────────── */
.main-content-wrap {
    max-width: 860px;
    margin: 0 auto;
    padding: 2rem 1rem 3rem;
}

/* ── Section title ──────────────────────────────────── */
.section-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--hjju-primary);
    margin-bottom: .3rem;
    letter-spacing: -.01em;
}
.section-subtitle {
    font-size: .92rem;
    color: var(--hjju-muted);
    margin-bottom: 1.25rem;
}

/* ── Search card ────────────────────────────────────── */
.search-card {
    background: #fff;
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    margin-bottom: 1.75rem;
}
.search-card-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-bottom: 2px solid var(--hjju-light);
}
.search-tab-btn {
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    font-size: .95rem;
    font-weight: 600;
    color: var(--hjju-muted);
    cursor: pointer;
    transition: color var(--transition), border-color var(--transition),
                background var(--transition);
}
.search-tab-btn:hover {
    color: var(--hjju-primary);
    background: var(--hjju-light);
}
.search-tab-btn.active {
    color: var(--hjju-primary);
    border-bottom-color: var(--hjju-primary);
    background: #fafcff;
}
.search-tab-btn i {
    font-size: 1.15rem;
}
.search-tab-btn .tab-desc {
    font-size: .72rem;
    font-weight: 400;
    color: var(--hjju-muted);
    display: block;
    line-height: 1.2;
}
.search-tab-content {
    padding: 1.5rem;
}
.search-tab-pane { display: none; }
.search-tab-pane.active { display: block; }

.form-label {
    font-size: .9rem;
    font-weight: 600;
    color: var(--hjju-text);
    margin-bottom: .4rem;
}
.form-select, .form-control {
    font-size: 1rem;
    padding: .65rem .9rem;
    border: 1.5px solid #c8d8e8;
    border-radius: .6rem;
    color: var(--hjju-text);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-select:focus, .form-control:focus {
    border-color: var(--hjju-secondary);
    box-shadow: 0 0 0 3px rgba(41,128,185,.15);
    outline: none;
}
.form-select:disabled {
    background: #f5f8fb;
    color: #aaa;
    cursor: not-allowed;
}

/* ── Slots section ──────────────────────────────────── */
.slots-section-header {
    display: flex;
    align-items: center;
    gap: .65rem;
    margin-bottom: 1.1rem;
    padding-bottom: .75rem;
    border-bottom: 2px solid var(--hjju-light);
}
.slots-section-header i {
    color: var(--hjju-primary);
    font-size: 1.2rem;
}
.slots-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--hjju-primary);
    text-transform: uppercase;
    letter-spacing: .07em;
    margin: 0;
}

/* ── Slot date groups ───────────────────────────────── */
.slots-fecha-grupo {
    background: #fff;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1.5px solid rgba(26,82,118,.08);
    overflow: hidden;
    margin-bottom: 1rem;
}
.slots-fecha-header {
    background: linear-gradient(90deg, #ddeef9 0%, #f2f8fd 100%);
    border-left: 4px solid var(--hjju-primary);
    padding: .65rem 1.1rem;
    display: flex;
    align-items: center;
    gap: .6rem;
}
.slots-fecha-header i {
    color: var(--hjju-primary);
    font-size: 1rem;
    flex-shrink: 0;
}
.slots-fecha-titulo {
    font-size: .95rem;
    font-weight: 700;
    color: var(--hjju-primary);
    text-transform: capitalize;
    flex: 1;
}
.slots-count-badge {
    background: var(--hjju-primary);
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
    border-radius: 2rem;
    padding: .2rem .7rem;
    white-space: nowrap;
}
.slots-horas-row {
    padding: 1rem 1.1rem;
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
}

/* ── Slot chip ──────────────────────────────────────── */
.slot-hora-chip {
    background: var(--hjju-light);
    border: 2px solid #b0d4ed;
    color: var(--hjju-primary);
    border-radius: .6rem;
    padding: .6rem 1rem;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition),
                color var(--transition), transform .12s ease, box-shadow .12s ease;
    text-align: center;
    min-width: 78px;
    line-height: 1;
    user-select: none;
}
.slot-hora-chip:hover {
    background: var(--hjju-primary);
    border-color: var(--hjju-primary);
    color: #fff;
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(26,82,118,.3);
}
.slot-hora-chip:active { transform: translateY(-1px); }
.slot-hora-chip .hora {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: .02em;
}
.slot-hora-chip .consult {
    display: block;
    font-size: .68rem;
    margin-top: .25rem;
    opacity: .65;
}

/* ── Empty / spinner ────────────────────────────────── */
#slots-spinner { min-height: 140px; }
.slots-empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--hjju-muted);
}
.slots-empty-state i {
    font-size: 2.8rem;
    color: #c0d4e4;
    display: block;
    margin-bottom: .75rem;
}
.slots-empty-state p { margin: 0; font-size: .95rem; }

/* ── Footer ─────────────────────────────────────────── */
.site-footer {
    background: var(--hjju-primary);
    color: rgba(255,255,255,.75);
    font-size: .82rem;
    padding: 1.5rem 0;
    margin-top: 3rem;
}
.site-footer a {
    color: rgba(255,255,255,.85);
    text-decoration: none;
}
.site-footer a:hover { color: #fff; text-decoration: underline; }

/* ── Modal ──────────────────────────────────────────── */
.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}
.modal-header {
    background: var(--hjju-primary);
    color: #fff;
    padding: 1.1rem 1.4rem;
    border: none;
}
.modal-header .modal-title {
    font-size: 1.05rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.modal-body { padding: 1.5rem; }
.modal-footer {
    padding: 1rem 1.4rem;
    border-top: 1px solid #e8f0f7;
    gap: .5rem;
}

/* ── Modal resumen ──────────────────────────────────── */
.modal-resumen-card {
    background: var(--hjju-light);
    border: 1.5px solid #b0d4ed;
    border-radius: var(--radius-md);
    padding: 1rem 1.15rem;
    margin-bottom: 1.25rem;
}
.modal-resumen-card .resumen-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .9rem;
    color: var(--hjju-text);
    margin-bottom: .3rem;
}
.modal-resumen-card .resumen-row:last-child { margin-bottom: 0; }
.modal-resumen-card i { color: var(--hjju-primary); font-size: .95rem; width: 1.1rem; }
.modal-resumen-card strong { color: var(--hjju-primary); }

/* ── Modal pasos ────────────────────────────────────── */
.pasos-bar {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: 1.25rem;
}
.paso-item {
    display: flex;
    align-items: center;
    gap: .4rem;
    opacity: .3;
    transition: opacity .2s;
}
.paso-item.activo   { opacity: 1; }
.paso-item.completo { opacity: .6; }
.paso-item.completo .paso-num { background: var(--hjju-accent); }
.paso-num {
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 50%;
    background: var(--hjju-secondary);
    color: #fff;
    font-size: .75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.paso-texto {
    font-size: .82rem;
    font-weight: 600;
    color: var(--hjju-primary);
    white-space: nowrap;
}
.paso-sep-line {
    flex: 1;
    height: 2px;
    background: #d0dde8;
    min-width: 1.5rem;
}

/* ── Modal aviso contacto ───────────────────────────── */
.aviso-contacto {
    background: #fff8e1;
    border-left: 4px solid #f39c12;
    border-radius: .5rem;
    padding: .85rem 1rem;
    display: flex;
    gap: .7rem;
    align-items: flex-start;
    margin-bottom: 1rem;
}
.aviso-contacto .aviso-icon {
    color: #e67e22;
    font-size: 1.3rem;
    flex-shrink: 0;
    margin-top: 1px;
}
.aviso-contacto .aviso-titulo {
    font-size: .9rem;
    font-weight: 700;
    color: #7d4e00;
    line-height: 1.2;
}
.aviso-contacto .aviso-texto {
    font-size: .83rem;
    color: #5a3b00;
    margin-top: .2rem;
    line-height: 1.45;
}

/* ── Formulario del modal ───────────────────────────── */
.modal-body .form-control,
.modal-body .form-select {
    font-size: 1rem;
    padding: .7rem .95rem;
}
.modal-body .form-label {
    font-size: .9rem;
    font-weight: 600;
    margin-bottom: .35rem;
}
.modal-body .btn {
    font-size: .95rem;
    padding: .6rem 1.2rem;
    font-weight: 600;
    border-radius: .55rem;
}

/* ── Info encontrado ────────────────────────────────── */
.paciente-encontrado {
    background: #eaf7f0;
    border: 1.5px solid #a3d9b8;
    border-radius: var(--radius-md);
    padding: 1rem 1.1rem;
    margin-bottom: 1rem;
}
.paciente-encontrado .enc-icon {
    background: var(--hjju-accent);
    color: #fff;
    border-radius: 50%;
    width: 2.2rem;
    height: 2.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}
.paciente-encontrado .enc-nombre {
    font-weight: 700;
    font-size: 1rem;
    color: #1a4a2e;
}
.paciente-encontrado .enc-dni {
    font-size: .85rem;
    color: #3a7a52;
    margin-top: .1rem;
}

/* ── Condiciones del turno ──────────────────────────── */
.condiciones-bloque {
    background: #f8fafc;
    border: 1.5px solid #c8d8e8;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-top: 1.1rem;
}
.condiciones-titulo {
    background: var(--hjju-primary);
    color: #fff;
    font-size: .82rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: .55rem 1rem;
    display: flex;
    align-items: center;
    gap: .45rem;
}
.condiciones-lista {
    padding: .85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: .7rem;
}
.condicion-item {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    cursor: pointer;
    font-size: .88rem;
    color: var(--hjju-text);
    line-height: 1.45;
}
.condicion-item:hover { color: var(--hjju-primary); }
.condicion-check {
    flex-shrink: 0;
    width: 1.15rem;
    height: 1.15rem;
    margin-top: .15rem;
    accent-color: var(--hjju-primary);
    cursor: pointer;
}
.condicion-item span strong { color: var(--hjju-primary); }
.condiciones-error {
    margin: 0 1rem .75rem;
    font-size: .82rem;
    font-weight: 600;
    color: #c0392b;
}

/* ── Lista de espera ────────────────────────────────── */
.btn-lista-espera {
    background: var(--hjju-primary);
    color: #fff;
    border: none;
    border-radius: .6rem;
    padding: .75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: .75rem;
    transition: background var(--transition), transform .12s;
    display: inline-flex;
    align-items: center;
}
.btn-lista-espera:hover { background: #154360; transform: translateY(-2px); }
.espera-hint { font-size: .82rem; color: var(--hjju-muted); margin-top: .5rem; }

/* ── Responsive ─────────────────────────────────────── */

/* Tablet y menor (< 768px) */
@media (max-width: 767px) {
    /* Header */
    .site-logo { height: 72px; }
    .site-header .header-subtitle { font-size: .75rem; }

    /* Hero: apilar ícono y texto verticalmente */
    .hero-section { padding: 1.75rem 0 1.5rem; }
    .hero-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .hero-icon-wrap {
        width: 56px; height: 56px; font-size: 1.5rem;
    }
    .hero-title { font-size: 1.35rem; }
    .hero-subtitle { font-size: .92rem; }
    .hero-pills { gap: .4rem; margin-top: .65rem; }
    .hero-pill { font-size: .75rem; padding: .25rem .7rem; }

    /* Main */
    .main-content-wrap { padding: 1.5rem .75rem 2.5rem; }

    /* Search card tabs */
    .search-tab-btn { padding: .85rem .75rem; font-size: .85rem; gap: .4rem; }
    .search-tab-btn .tab-desc { display: none; }
    .search-tab-content { padding: 1.1rem; }

    /* Slots */
    .slots-horas-row { padding: .75rem; gap: .45rem; }
    .slot-hora-chip { min-width: 64px; padding: .55rem .7rem; }
    .slot-hora-chip .hora { font-size: 1rem; }

    /* Modal footer: apila botones */
    .modal-footer {
        flex-direction: column-reverse;
        padding: .85rem 1rem;
    }
    .modal-footer .btn {
        width: 100%;
        justify-content: center;
    }
}

/* Móvil chico (< 576px) */
@media (max-width: 575px) {
    /* Header */
    .site-logo { height: 56px; }
    .site-header { padding: .6rem 0; }
    .site-header .header-subtitle { display: none; }

    /* Hero */
    .hero-section { padding: 1.25rem 0 1.1rem; }
    .hero-icon-wrap { width: 48px; height: 48px; font-size: 1.3rem; }
    .hero-title { font-size: 1.2rem; }
    .hero-subtitle { font-size: .85rem; }
    .hero-pills { display: none; }

    /* Main */
    .main-content-wrap { padding: 1.1rem .6rem 2rem; }

    /* Search card */
    .search-tab-btn { padding: .75rem .5rem; font-size: .8rem; gap: .3rem; }
    .search-tab-btn i { font-size: 1rem; }
    .search-tab-content { padding: .9rem; }
    .search-card { border-radius: .75rem; }

    /* Slots */
    .slots-horas-row { padding: .65rem; gap: .4rem; }
    .slot-hora-chip { min-width: 60px; padding: .5rem .6rem; }
    .slot-hora-chip .hora { font-size: .95rem; }

    /* Grilla Apellido / Nombre: full width en xs */
    .row .col-6 { flex: 0 0 100%; max-width: 100%; }

    /* Aviso contacto */
    .aviso-contacto { padding: .7rem .8rem; font-size: .82rem; }

    /* Footer site */
    .site-footer { font-size: .78rem; padding: 1.1rem 0; }
}
