/* Reservas y "My bookings" (v2). Contenedor centrado; la barra superior es sticky,
   asi que no hace falta compensar su altura. */

.booking-container {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: 1.75rem var(--gutter) 4rem;
    min-height: calc(100dvh - var(--nav-h) - 70px);
}

.booking-intro { text-align: center; margin-bottom: 2rem; }
.booking-intro h1 { font-size: clamp(2rem, 3.6vw, 2.75rem); margin-bottom: 0.4rem; }
.booking-intro p { color: var(--text-muted); }

/* Acceso requerido */
#auth-guard {
    display: none;
    max-width: 520px;
    margin: 1rem auto 0;
    padding: 2.75rem 2rem;
    text-align: center;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
}

#auth-guard .guard-icon {
    width: 64px; height: 64px;
    margin: 0 auto 1.1rem;
    display: grid; place-items: center;
    border-radius: 50%;
    background: var(--bg-alt);
    color: var(--primary-color);
    font-size: 1.4rem;
}

#auth-guard h2 { font-size: 1.8rem; margin-bottom: 0.4rem; }
#auth-guard p { color: var(--text-muted); margin-bottom: 1.5rem; }

#booking-form-wrapper { display: none; }

/* Tarjeta que contiene los pasos */
.booking-card {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: var(--shadow-soft);
    padding: clamp(1.25rem, 3vw, 2.25rem);
}

/* Barra de progreso */
.booking-steps-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    margin: 0 auto 1.75rem;
    max-width: 720px;
}

.step-indicator {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.step-indicator:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 18px;
    left: calc(50% + 24px);
    right: calc(-50% + 24px);
    height: 2px;
    background: var(--line);
    border-radius: 2px;
}

.step-indicator.completed:not(:last-child)::after { background: var(--primary-dark); }

.step-circle {
    width: 36px; height: 36px;
    display: grid; place-items: center;
    border: 2px solid var(--line-strong);
    border-radius: 50%;
    background: var(--white);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: var(--transition);
}

.step-indicator.active .step-circle { background: var(--primary-dark); border-color: var(--primary-dark); color: var(--white); box-shadow: 0 0 0 5px rgba(74, 20, 140, 0.12); }
.step-indicator.completed .step-circle { background: var(--bg-alt); border-color: var(--primary-dark); color: var(--primary-dark); }

.step-label {
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    text-align: center;
}

.step-indicator.active .step-label,
.step-indicator.completed .step-label { color: var(--primary-dark); }

/* Pasos */
.booking-step { display: none; }
.booking-step.active { display: block; animation: stepIn 0.45s var(--ease); }

@keyframes stepIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.step-title { font-size: clamp(1.6rem, 2.6vw, 2rem); margin-bottom: 0.3rem; }
.step-subtitle { color: var(--text-muted); margin-bottom: 1.5rem; }
.step-subtitle strong { color: var(--primary-dark); font-weight: 600; }

/* Paso 1: estilistas */
.professional-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 240px));
    justify-content: center;
    gap: 1rem;
}

.professional-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 1.75rem 1.25rem;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.professional-card:hover { border-color: var(--primary-color); transform: translateY(-3px); box-shadow: var(--shadow-soft); }
.professional-card.selected { border-color: var(--primary-dark); box-shadow: inset 0 0 0 1px var(--primary-dark), var(--shadow-soft); background: #fbf7fd; }

.professional-avatar {
    width: 76px; height: 76px;
    margin-bottom: 0.75rem;
    display: grid; place-items: center;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--accent-color), var(--bg-alt));
    color: var(--primary-dark);
    font-family: var(--font-heading);
    font-size: 2rem;
    transition: var(--transition);
}

.professional-card.selected .professional-avatar { background: var(--primary-dark); color: var(--white); }
.professional-card h3 { font-size: 1.35rem; }
.professional-card p { font-size: 0.86rem; color: var(--text-muted); }

/* Paso 2: categorias y servicios */
.service-selection { display: flex; flex-direction: column; align-items: stretch; width: 100%; }
.service-selection > .step-subtitle { margin-bottom: 1rem; }

.category-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.85rem;
    width: 100%;
}

.category-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
    padding: 1.25rem 1.1rem;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.category-card:hover { border-color: var(--primary-dark); transform: translateY(-3px); box-shadow: var(--shadow-soft); }

.category-icon {
    width: 42px; height: 42px;
    margin-bottom: 0.4rem;
    display: grid; place-items: center;
    border-radius: 50%;
    background: var(--bg-alt);
    color: var(--primary-color);
    transition: var(--transition);
}

.category-card:hover .category-icon { background: var(--primary-dark); color: var(--white); }
.category-card h3 { font-size: 1.05rem; }
.category-card span { font-size: 0.8rem; color: var(--text-muted); }

.btn-back-small {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 40px;
    padding: 0.4rem 0;
    background: none;
    border: 0;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--primary-dark);
    cursor: pointer;
}

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

.booking-category-header { font-size: 1.5rem; margin: 0.4rem 0 1rem; }

.service-type-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem;
    width: 100%;
}

.service-option-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.1rem;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.service-option-item:hover { border-color: var(--primary-color); }
.service-option-item.selected { border-color: var(--primary-dark); background: #fbf7fd; box-shadow: inset 0 0 0 1px var(--primary-dark); }

.service-info .service-name { font-weight: 500; font-size: 1rem; }

.service-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 1rem;
    margin-top: 0.25rem;
    font-size: 0.86rem;
    color: var(--text-muted);
}

.service-meta .price { font-family: var(--font-heading); font-size: 1.05rem; color: var(--primary-dark); }

.select-indicator {
    flex-shrink: 0;
    width: 26px; height: 26px;
    display: grid; place-items: center;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    color: transparent;
    font-size: 0.7rem;
    transition: var(--transition);
}

.service-option-item.selected .select-indicator { background: var(--primary-dark); border-color: var(--primary-dark); color: var(--white); }

/* Paso 3: calendario + horarios */
.datetime-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
}

.calendar {
    padding: 1.25rem;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 10px;
}

.cal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.cal-title { font-size: 1.3rem; }

.cal-nav {
    width: 40px; height: 40px;
    display: grid; place-items: center;
    background: var(--white);
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    color: var(--primary-dark);
    cursor: pointer;
    transition: var(--transition);
}

.cal-nav:hover:not(:disabled) { background: var(--primary-dark); border-color: var(--primary-dark); color: var(--white); }
.cal-nav:disabled { opacity: 0.35; cursor: not-allowed; }

.cal-weekdays,
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.35rem;
}

.cal-weekdays { margin-bottom: 0.4rem; }

.cal-weekdays span {
    text-align: center;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.cal-day {
    position: relative;
    aspect-ratio: 1 / 1;
    min-height: 40px;
    display: grid; place-items: center;
    background: var(--bg-color);
    border: 1px solid transparent;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.98rem;
    font-weight: 500;
    color: var(--ink);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.cal-day:hover:not(:disabled) { border-color: var(--primary-color); background: var(--white); transform: translateY(-1px); }

.cal-day.is-today::after {
    content: '';
    position: absolute;
    bottom: 6px;
    width: 5px; height: 5px;
    border-radius: 50%;
    background: var(--primary-color);
}

.cal-day.is-selected { background: var(--primary-dark); color: var(--white); border-color: var(--primary-dark); box-shadow: 0 8px 18px -10px rgba(74, 20, 140, 0.7); }
.cal-day.is-selected::after { background: var(--white); }

.cal-day:disabled { background: transparent; color: #c2b6c9; cursor: not-allowed; }
.cal-day.is-closed:disabled { text-decoration: line-through; }

.cal-legend {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem 0.6rem;
    margin-top: 0.9rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.legend-today,
.legend-closed { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.legend-today { background: var(--primary-color); }
.legend-closed { background: #c2b6c9; margin-left: 0.6rem; }

.date-warning { display: none; margin-top: 0.75rem; font-size: 0.9rem; color: var(--danger); }

.time-panel {
    min-height: 100%;
    padding: 1.25rem;
    background: var(--bg-color);
    border: 1px solid var(--line);
    border-radius: 10px;
}

.time-panel-title { font-size: 1.3rem; margin-bottom: 1rem; }

.time-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    min-height: 220px;
    text-align: center;
    color: var(--text-muted);
}

.time-placeholder i { font-size: 2rem; color: var(--accent-color); }

.time-slots-container { display: none; }

.slot-group + .slot-group { margin-top: 1.1rem; }

.slot-group-label {
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.slot-group-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 0.5rem;
}

.time-slot {
    min-height: 44px;
    padding: 0.5rem;
    background: var(--white);
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--ink);
    cursor: pointer;
    transition: var(--transition);
}

.time-slot:hover { border-color: var(--primary-dark); color: var(--primary-dark); transform: translateY(-1px); }
.time-slot.selected { background: var(--primary-dark); border-color: var(--primary-dark); color: var(--white); }

/* Carga y mensajes */
.slots-skeleton {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.slots-skeleton span {
    height: 44px;
    border-radius: 8px;
    background: linear-gradient(90deg, #f1eaf5 0%, #faf6fc 50%, #f1eaf5 100%);
    background-size: 200% 100%;
    animation: shimmer 1.2s ease-in-out infinite;
}

@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.slots-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-muted);
}

.slots-message i { font-size: 1.8rem; color: var(--accent-color); }
.slots-message.is-error p { color: var(--danger); }

/* Paso 4: resumen */
.booking-summary {
    max-width: 620px;
    margin: 0 auto;
    padding: 0.4rem 1.5rem 1.5rem;
    background: var(--bg-color);
    border: 1px solid var(--line);
    border-radius: 10px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 0;
    border-bottom: 1px solid var(--line);
}

.summary-label { display: flex; align-items: center; gap: 0.7rem; color: var(--text-muted); font-size: 0.95rem; }
.summary-label i { width: 18px; color: var(--primary-color); }
.summary-value { font-weight: 500; text-align: right; }
.summary-price { font-family: var(--font-heading); font-size: 1.3rem; color: var(--primary-dark); }

.summary-note {
    margin-top: 1.1rem;
    padding: 0.9rem 1rem;
    background: var(--bg-alt);
    border-left: 3px solid var(--primary-color);
    border-radius: 0;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.summary-note strong { color: var(--primary-dark); }

#booking-error:not(:empty),
#booking-success:not(:empty) { max-width: 620px; margin: 1.1rem auto 0; }

#booking-error:not(:empty) { padding: 0.8rem 1rem; background: #fdecea; border-left: 3px solid var(--danger); }

/* Navegacion entre pasos */
.step-navigation {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--line);
}

.step-navigation.end { justify-content: flex-end; }

.btn-back,
.btn-next {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    min-height: 48px;
    padding: 0.75rem 1.6rem;
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-back { background: transparent; border: 1px solid var(--line-strong); color: var(--text-main); }
.btn-back:hover { border-color: var(--primary-dark); color: var(--primary-dark); }

.btn-next { background: var(--primary-dark); border: 1px solid var(--primary-dark); color: var(--white); }
.btn-next:hover:not(:disabled) { background: var(--primary-color); border-color: var(--primary-color); }
.btn-next:disabled { background: var(--line-strong); border-color: var(--line-strong); cursor: not-allowed; }

/* Exito */
.booking-done {
    padding: 2rem 1.5rem;
    text-align: center;
    background: var(--bg-alt);
    border-radius: 10px;
    color: var(--text-main);
}

.booking-done h3 { font-size: 1.9rem; margin-bottom: 0.5rem; }
.booking-done p { color: var(--text-muted); margin-bottom: 1.25rem; }

/* ---------- My bookings ---------- */
.mb-list { display: grid; gap: 0.9rem; }

.mb-card {
    display: grid;
    grid-template-columns: 70px minmax(0, 1fr) auto;
    gap: 1.25rem;
    align-items: center;
    padding: 1.25rem 1.4rem;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: var(--shadow-soft);
}

.mb-card.is-cancelled { background: var(--bg-color); box-shadow: none; }
.mb-card.is-cancelled .mb-body h3,
.mb-card.is-cancelled .mb-day { color: var(--text-muted); }

.mb-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.55rem 0;
    background: var(--bg-alt);
    border-radius: 8px;
}

.mb-day { font-family: var(--font-heading); font-size: 1.85rem; line-height: 1; color: var(--primary-dark); }
.mb-month { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-muted); margin-top: 0.3rem; }

.mb-body h3 { font-size: 1.3rem; margin-bottom: 0.2rem; }
.mb-meta { font-size: 0.94rem; }
.mb-ref { color: var(--text-muted); font-size: 0.8rem; margin-top: 0.2rem; }

.mb-side { display: flex; flex-direction: column; align-items: flex-end; gap: 0.65rem; text-align: right; }

.mb-badge {
    display: inline-block;
    padding: 0.28rem 0.7rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.mb-badge.confirmed { background: #e8f5e9; color: #1b5e20; }
.mb-badge.cancelled { background: #fdecea; color: #8c1d18; }
.mb-badge.past { background: var(--bg-alt); color: var(--text-muted); }

.mb-cancel {
    min-height: 40px;
    padding: 0.45rem 1rem;
    background: transparent;
    border: 1px solid #d9a6a2;
    border-radius: var(--radius);
    color: var(--danger);
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.mb-cancel:hover { background: var(--danger); border-color: var(--danger); color: var(--white); }
.mb-cancel:disabled { opacity: 0.6; cursor: wait; }

.mb-note { max-width: 200px; font-size: 0.8rem; color: var(--text-muted); }

.mb-empty {
    padding: 2.75rem 1.5rem;
    text-align: center;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 10px;
}

.mb-empty h3 { font-size: 1.6rem; margin-bottom: 0.35rem; }
.mb-empty p { color: var(--text-muted); margin-bottom: 1.25rem; }

#mb-error:not(:empty) { margin-bottom: 1rem; padding: 0.8rem 1rem; background: #fdecea; border-left: 3px solid var(--danger); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
    .datetime-layout { grid-template-columns: 1fr; }
    .category-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .service-type-list { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .booking-container { padding-top: 1.25rem; }
    .booking-card { padding: 1.1rem; border-radius: 8px; }
    .step-label { font-size: 0.6rem; letter-spacing: 0.04em; }
    .step-indicator:not(:last-child)::after { left: calc(50% + 21px); right: calc(-50% + 21px); }
    .category-grid { grid-template-columns: 1fr 1fr; }
    .category-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
    .calendar, .time-panel { padding: 1rem; }
    .cal-grid { gap: 0.25rem; }
    .cal-day { font-size: 0.92rem; border-radius: 6px; }
    .booking-summary { padding: 0.25rem 1rem 1.1rem; }
    .summary-row { flex-direction: column; gap: 0.15rem; }
    .summary-value { text-align: left; }
    .step-navigation { flex-direction: column-reverse; }
    .btn-back, .btn-next { width: 100%; }
    .mb-card { grid-template-columns: 58px minmax(0, 1fr); gap: 0.9rem; padding: 1.1rem; }
    .mb-side { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: center; text-align: left; }
    .mb-note { max-width: none; }
}
