/* ================================================
   Holispace Booking — Style formularza rezerwacji
   ================================================ */

:root {
    --hb-primary: #2563eb;
    --hb-primary-hover: #1d4ed8;
    --hb-success: #16a34a;
    --hb-error: #dc2626;
    --hb-warning: #d97706;
    --hb-bg: #ffffff;
    --hb-bg-alt: #f8fafc;
    --hb-border: #e2e8f0;
    --hb-text: #1e293b;
    --hb-text-muted: #64748b;
    --hb-radius: 10px;
    --hb-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}

.hb-booking {
    max-width: 800px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--hb-text);
    line-height: 1.6;
}

.hb-section {
    background: var(--hb-bg);
    border: 1px solid var(--hb-border);
    border-radius: var(--hb-radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--hb-shadow);
    transition: opacity .25s ease;
}

.hb-section--hidden {
    display: none;
}

.hb-section--disabled {
    opacity: .45;
    pointer-events: none;
}

.hb-section__title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 20px;
    font-size: 18px;
    font-weight: 600;
    color: var(--hb-text);
}

.hb-step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--hb-primary);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
}

/* ------------------------------------------------
   Specjaliści
   ------------------------------------------------ */
.hb-specialists {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.hb-specialist-card {
    border: 2px solid var(--hb-border);
    border-radius: var(--hb-radius);
    padding: 16px;
    cursor: pointer;
    transition: border-color .2s, box-shadow .2s, transform .1s;
    text-align: center;
    background: var(--hb-bg);
}

.hb-specialist-card:hover {
    border-color: var(--hb-primary);
    box-shadow: 0 4px 12px rgba(37, 99, 235, .15);
    transform: translateY(-2px);
}

.hb-specialist-card.hb-selected {
    border-color: var(--hb-primary);
    background: #eff6ff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, .2);
}

.hb-specialist-card__avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    margin: 0 auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
}

.hb-specialist-card__name {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
}

.hb-specialist-card__specialty {
    font-size: 13px;
    color: var(--hb-text-muted);
}

/* ------------------------------------------------
   Kalendarz
   ------------------------------------------------ */
.hb-calendar {
    user-select: none;
    max-width: 320px;
}

.hb-calendar__nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.hb-calendar__nav button {
    background: none;
    border: 1px solid var(--hb-border);
    border-radius: 6px;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
    color: var(--hb-text);
    line-height: 1;
    padding: 0;
    font-weight: 700;
}

.hb-calendar__nav button:hover {
    background: var(--hb-bg-alt);
}

.hb-calendar__nav button:disabled {
    opacity: .35;
    cursor: not-allowed;
}

.hb-calendar__month {
    font-weight: 600;
    font-size: 14px;
    text-transform: capitalize;
}

.hb-calendar__grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.hb-calendar__day-name {
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--hb-text-muted);
    padding: 4px 0;
    text-transform: uppercase;
}

.hb-calendar__day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: background .15s, border-color .15s, color .15s;
}

.hb-calendar__day:hover:not(.hb-calendar__day--disabled):not(.hb-calendar__day--empty) {
    background: #eff6ff;
    border-color: var(--hb-primary);
    color: var(--hb-primary);
}

.hb-calendar__day--selected {
    background: var(--hb-primary) !important;
    color: #fff !important;
    border-color: var(--hb-primary) !important;
    font-weight: 700;
}

.hb-calendar__day--today {
    font-weight: 700;
    color: var(--hb-primary);
}

.hb-calendar__day--disabled {
    color: #cbd5e1;
    cursor: not-allowed;
    background: none;
}

.hb-calendar__day--empty {
    cursor: default;
}

.hb-calendar__day--no-schedule {
    color: #cbd5e1;
    cursor: not-allowed;
    background: #fafafa;
    text-decoration: line-through;
}

.hb-calendar__day--no-schedule:hover {
    background: #fafafa;
    color: #cbd5e1;
    border-color: transparent;
}

/* ------------------------------------------------
   Sloty
   ------------------------------------------------ */
.hb-selected-date {
    color: var(--hb-text-muted);
    font-size: 14px;
    margin-bottom: 16px;
}

.hb-slots {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
}

.hb-slot {
    border: 2px solid var(--hb-border);
    border-radius: 8px;
    padding: 10px 6px;
    text-align: center;
    cursor: pointer;
    transition: all .2s;
    background: var(--hb-bg);
}

.hb-slot:hover {
    border-color: var(--hb-primary);
    background: #eff6ff;
    color: var(--hb-primary);
}

.hb-slot.hb-selected {
    background: var(--hb-primary);
    border-color: var(--hb-primary);
    color: #fff;
    font-weight: 700;
}

.hb-slot__time {
    font-size: 16px;
    font-weight: 600;
    display: block;
}

.hb-slot__room {
    font-size: 11px;
    color: inherit;
    opacity: .75;
    display: block;
    margin-top: 2px;
}

/* Zajęty slot */
.hb-slot--booked {
    border-color: #e2e8f0;
    background: #f8fafc;
    cursor: not-allowed;
    opacity: .6;
    position: relative;
}

.hb-slot--booked .hb-slot__time {
    text-decoration: line-through;
    color: #94a3b8;
}

.hb-slot--booked:hover {
    border-color: #e2e8f0;
    background: #f8fafc;
    color: inherit;
}

.hb-slot__booked-label {
    font-size: 10px;
    color: #94a3b8;
    display: block;
    margin-top: 2px;
}

/* Tooltip dla zajętego slotu */
.hb-slot--booked::after {
    content: 'Termin już zarezerwowany';
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: #fff;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity .15s;
    z-index: 10;
}

.hb-slot--booked::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: #1e293b;
    pointer-events: none;
    opacity: 0;
    transition: opacity .15s;
    z-index: 10;
}

.hb-slot--booked:hover::after,
.hb-slot--booked:hover::before {
    opacity: 1;
}

/* ------------------------------------------------
   Formularz pacjenta
   ------------------------------------------------ */
.hb-form__row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.hb-form__field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hb-form__field--full {
    grid-column: 1 / -1;
}

.hb-form__field label {
    font-size: 14px;
    font-weight: 500;
    color: var(--hb-text);
}

.hb-required {
    color: var(--hb-error);
}

.hb-form__field input,
.hb-form__field textarea {
    border: 1px solid var(--hb-border);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 15px;
    font-family: inherit;
    color: var(--hb-text);
    background: var(--hb-bg);
    transition: border-color .2s, box-shadow .2s;
    width: 100%;
    box-sizing: border-box;
}

.hb-form__field input:focus,
.hb-form__field textarea:focus {
    outline: none;
    border-color: var(--hb-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.hb-form__field input.hb-invalid {
    border-color: var(--hb-error);
}

/* ------------------------------------------------
   Podsumowanie — .hb-summary__row (stare) i .hb-summary__item (nowe)
   ------------------------------------------------ */
.hb-summary {
    background: var(--hb-bg-alt);
    border: 1px solid var(--hb-border);
    border-radius: var(--hb-radius);
    padding: 20px;
    margin-bottom: 20px;
}

/* Stara klasa (kompatybilność wsteczna) */
.hb-summary__row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 8px 0;
    border-bottom: 1px solid var(--hb-border);
    font-size: 15px;
    gap: 12px;
}

.hb-summary__row:last-child {
    border-bottom: none;
}

/* Nowa klasa używana przez booking.js */
.hb-summary__item {
    display: flex;
    align-items: baseline;
    padding: 8px 0;
    border-bottom: 1px solid var(--hb-border);
    font-size: 15px;
    gap: 12px;
}

.hb-summary__item:last-child {
    border-bottom: none;
}

.hb-summary__label {
    color: var(--hb-text-muted);
    font-size: 13px;
    min-width: 110px;
    flex-shrink: 0;
}

.hb-summary__value {
    font-weight: 600;
    color: var(--hb-text);
    flex: 1;
}

.hb-summary__value--price {
    color: var(--hb-success);
}

/* ------------------------------------------------
   Przyciski
   ------------------------------------------------ */
.hb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background .2s, transform .1s, box-shadow .2s;
    font-family: inherit;
}

.hb-btn--primary {
    background: var(--hb-primary);
    color: #fff;
}

.hb-btn--primary:hover {
    background: var(--hb-primary-hover);
    box-shadow: 0 4px 12px rgba(37, 99, 235, .3);
}

.hb-btn--primary:active {
    transform: scale(.98);
}

.hb-btn--primary:disabled {
    opacity: .6;
    cursor: not-allowed;
    transform: none;
}

.hb-btn--secondary {
    background: var(--hb-bg-alt);
    color: var(--hb-text);
    border: 1px solid var(--hb-border);
}

.hb-btn--secondary:hover {
    background: var(--hb-border);
}

.hb-btn--large {
    padding: 14px 32px;
    font-size: 16px;
    width: 100%;
}

/* ------------------------------------------------
   Błędy i ładowanie
   ------------------------------------------------ */
.hb-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--hb-error);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
    margin-bottom: 16px;
}

.hb-loading {
    color: var(--hb-text-muted);
    font-size: 14px;
    padding: 20px 0;
    text-align: center;
}

/* ------------------------------------------------
   Potwierdzenie
   ------------------------------------------------ */
.hb-confirm {
    text-align: center;
    padding: 40px 20px;
}

.hb-confirm__icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--hb-success);
    color: #fff;
    font-size: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.hb-confirm h3 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--hb-success);
}

.hb-confirm p {
    color: var(--hb-text-muted);
    margin-bottom: 24px;
}

/* ------------------------------------------------
   Wybór trybu (mode=both)
   ------------------------------------------------ */
.hb-mode-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.hb-mode-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px 16px;
    border: 2px solid var(--hb-border);
    border-radius: var(--hb-radius);
    background: var(--hb-bg);
    cursor: pointer;
    transition: all .2s;
    text-align: center;
    font-family: inherit;
}

.hb-mode-btn:hover {
    border-color: var(--hb-primary);
    background: #eff6ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, .15);
}

.hb-mode-btn__icon {
    font-size: 32px;
}

.hb-mode-btn__label {
    font-size: 16px;
    font-weight: 600;
    color: var(--hb-text);
}

.hb-mode-btn__desc {
    font-size: 13px;
    color: var(--hb-text-muted);
}

/* ------------------------------------------------
   Karty usług
   ------------------------------------------------ */
.hb-services {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.hb-service-card {
    border: 2px solid var(--hb-border);
    border-radius: var(--hb-radius);
    padding: 16px;
    cursor: pointer;
    transition: all .2s;
    background: var(--hb-bg);
    position: relative;
}

.hb-service-card:hover {
    border-color: var(--hb-primary);
    box-shadow: 0 4px 12px rgba(37, 99, 235, .15);
    transform: translateY(-2px);
}

.hb-service-card.hb-selected {
    border-color: var(--hb-primary);
    background: #eff6ff;
}

.hb-service-card__color {
    width: 100%;
    height: 4px;
    border-radius: 2px;
    margin-bottom: 12px;
}

.hb-service-card__name {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 6px;
    color: var(--hb-text);
}

.hb-service-card__meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--hb-text-muted);
}

.hb-service-card__price {
    font-weight: 600;
    color: var(--hb-primary);
}

.hb-service-card__desc {
    font-size: 13px;
    color: var(--hb-text-muted);
    margin-top: 8px;
    line-height: 1.5;
}

/* ------------------------------------------------
   Kategorie
   ------------------------------------------------ */
.hb-categories {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.hb-category-card {
    padding: 20px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    transition: all .15s;
    text-align: center;
}

.hb-category-card:hover {
    border-color: #2563eb;
    background: #eff6ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, .1);
}

.hb-category-card.hb-selected {
    border-color: #2563eb;
    background: #2563eb;
    color: #fff;
}

.hb-category-card__name {
    font-weight: 600;
    font-size: 15px;
    color: inherit;
}

.hb-category-card__desc {
    font-size: 12px;
    color: #64748b;
    margin-top: 6px;
    line-height: 1.4;
}

.hb-category-card.hb-selected .hb-category-card__desc {
    color: rgba(255, 255, 255, .8);
}

.hb-services-group {
    margin-bottom: 16px;
}

.hb-services-group__title {
    font-size: 13px;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: 6px 0;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 10px;
}

/* ------------------------------------------------
   Responsive
   ------------------------------------------------ */
@media (max-width: 600px) {
    .hb-section {
        padding: 16px;
    }

    .hb-form__row {
        grid-template-columns: 1fr;
    }

    .hb-specialists {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    .hb-slots {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }

    .hb-mode-buttons {
        grid-template-columns: 1fr;
    }

    .hb-services {
        grid-template-columns: 1fr;
    }

    .hb-calendar {
        max-width: 100%;
    }

    .hb-summary__label {
        min-width: 90px;
    }
}