/* =========================================================================
   Bistro Booking – Public CSS
   Alle Styles unter .bistro-booking-wrap gescoped.
   Farbwerte ausschliesslich via CSS Custom Properties.
   ========================================================================= */

/* --- Reset innerhalb des Wrappers ---------------------------------------- */
.bistro-booking-wrap *,
.bistro-booking-wrap *::before,
.bistro-booking-wrap *::after {
    box-sizing: border-box;
}

.bistro-booking-wrap {
    font-family: inherit;
    color: var(--bb-text);
    max-width: 680px;
    margin: 0 auto;
    padding: 24px;
    background: var(--bb-background);
    border-radius: var(--bb-radius);
}

/* --- Fortschrittsanzeige ------------------------------------------------- */
.bb-progress {
    display: flex;
    gap: 0;
    margin: 0 0 32px;
    padding: 0;
    list-style: none;
    counter-reset: none;
}

.bb-progress-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 4px;
    position: relative;
    opacity: .45;
    transition: opacity .2s;
}

.bb-progress-step::before {
    content: '';
    position: absolute;
    top: 22px;
    left: calc(50% + 16px);
    right: calc(-50% + 16px);
    height: 2px;
    background: currentColor;
    opacity: .2;
}

.bb-progress-step:last-child::before { display: none; }

.bb-progress-step--active,
.bb-progress-step--done {
    opacity: 1;
}

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

.bb-progress-step--active .bb-step-num {
    background: var(--bb-secondary);
    color: var(--bb-primary);
}

.bb-progress-step--done .bb-step-num {
    background: var(--bb-primary);
}

.bb-step-label {
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    color: var(--bb-text);
}

/* --- Panes --------------------------------------------------------------- */
.bb-pane { animation: bb-fadein .25s ease; }
.bb-pane--hidden { display: none !important; }

@keyframes bb-fadein {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.bb-pane-title {
    font-family: inherit;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--bb-text);
    margin: 0 0 20px;
}

/* --- Kalender ------------------------------------------------------------ */
.bb-cal-wrap { user-select: none; }

.bb-cal-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.bb-cal-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--bb-text);
}

.bb-cal-btn {
    background: none;
    border: 1px solid var(--bb-primary);
    color: var(--bb-primary);
    border-radius: var(--bb-radius);
    padding: 4px 12px;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: background .15s, color .15s;
}

.bb-cal-btn:hover {
    background: var(--bb-primary);
    color: #fff;
}

.bb-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
}

.bb-cal-hd {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 2px;
    color: var(--bb-text);
    opacity: .6;
}

.bb-cal-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--bb-radius);
    font-size: 14px;
    font-weight: 500;
    transition: background .15s, color .15s, transform .1s;
}

.bb-cal-cell--empty {
    background: transparent;
}

.bb-cal-cell--unavailable {
    color: var(--bb-text);
    opacity: .25;
    cursor: not-allowed;
}

/* Tage mit Grund (Ruhetag, Sperrzeit) – opacity:1 damit Tooltip sichtbar */
.bb-cal-cell--unavailable[data-tooltip] {
    opacity: 1;
    cursor: default;
    position: relative;
    filter: grayscale(.5) opacity(.45);
}

.bb-cal-cell--unavailable[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 3px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,.92);
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    padding: 4px 9px;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 100;
    opacity: 0;
    transition: opacity .15s;
}

.bb-cal-cell--unavailable[data-tooltip]::before {
    content: '';
    position: absolute;
    bottom: calc(100% - 1px);
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: rgba(0,0,0,.92);
    pointer-events: none;
    z-index: 100;
    opacity: 0;
    transition: opacity .15s;
}

.bb-cal-cell--unavailable[data-tooltip]:hover::after,
.bb-cal-cell--unavailable[data-tooltip]:hover::before {
    opacity: 1;
}

.bb-cal-cell--available {
    background: transparent;
    color: var(--bb-primary);
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: 600;
}

.bb-cal-cell--available:hover,
.bb-cal-cell--available:focus {
    background: var(--bb-primary);
    color: #fff;
    outline: none;
    transform: scale(1.08);
}

.bb-cal-cell--today {
    border-color: var(--bb-secondary) !important;
}

.bb-cal-cell--selected {
    background: var(--bb-secondary) !important;
    color: var(--bb-primary) !important;
    font-weight: 700;
}

/* --- Datum-Zurück-Link (Schritt 2) --------------------------------------- */
.bb-date-backlink {
    display: flex;
    align-items: baseline;
    gap: 0;
    margin-bottom: 16px;
    font-size: .95rem;
    flex-wrap: wrap;
}

.bb-date-sep {
    color: var(--bb-text);
    opacity: .5;
}

.bb-back-link {
    background: none;
    border: none;
    color: var(--bb-primary);
    cursor: pointer;
    font-size: inherit;
    font-family: inherit;
    font-weight: 500;
    text-decoration: underline;
    padding: 0;
    opacity: .8;
    transition: opacity .15s;
}

.bb-back-link:hover { opacity: 1; color: var(--bb-secondary); }

/* --- Personenauswahl ----------------------------------------------------- */
.bb-guests-wrap {
    margin-bottom: 20px;
}

.bb-guests-select {
    display: block;
    margin-top: 6px;
    min-width: 180px;
    padding: .45em 2.4em .45em .75em;
    font-size: 1rem;
    font-family: inherit;
    font-weight: 600;
    color: var(--bb-text);
    background-color: var(--bb-background);
    border: 1px solid var(--bb-primary);
    border-radius: var(--bb-radius);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23555' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .8em center;
    transition: border-color .15s, box-shadow .15s;
}

.bb-guests-select:hover  { border-color: var(--bb-secondary); }
.bb-guests-select:focus  {
    outline: none;
    border-color: var(--bb-secondary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--bb-secondary) 35%, transparent);
}

/* --- Slot-Grid ----------------------------------------------------------- */
.bb-slots-title {
    font-weight: 600;
    font-size: .9rem;
    margin-bottom: 12px;
    color: var(--bb-text);
    opacity: .8;
}

.bb-slots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
    margin-bottom: 8px;
}

.bb-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 6px;
    border: 2px solid var(--bb-primary);
    border-radius: var(--bb-radius);
    background: var(--bb-background);
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: var(--bb-primary);
    transition: background .15s, color .15s, transform .1s;
    line-height: 1.2;
}

.bb-slot--bookable:hover,
.bb-slot--bookable:focus {
    background: var(--bb-primary);
    color: #fff;
    transform: translateY(-2px);
    outline: none;
}

.bb-slot--selected {
    background: var(--bb-secondary);
    border-color: var(--bb-secondary);
    color: var(--bb-primary);
    transform: translateY(-2px);
}

.bb-slot--full {
    opacity: .35;
    cursor: not-allowed;
    border-style: dashed;
}

.bb-no-slots {
    color: var(--bb-text);
    opacity: .6;
    font-style: italic;
    padding: 20px 0;
    text-align: center;
}

/* --- Warn-Box ------------------------------------------------------------ */
.bb-warning {
    background: #fff8e1;
    border: 1px solid var(--bb-secondary);
    border-radius: var(--bb-radius);
    padding: 16px 20px;
    margin-bottom: 20px;
    text-align: center;
}

.bb-warning--hidden { display: none !important; }
.bb-warning--block  { border-color: var(--bb-error); background: #fff0f0; }

.bb-warning-text { margin: 0 0 8px; }

.bb-phone-link {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--bb-primary);
    text-decoration: none;
}

.bb-phone-link:hover { color: var(--bb-secondary); }

/* --- Kontaktformular ----------------------------------------------------- */
.bb-field {
    margin-bottom: 16px;
}

.bb-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 0;
}

.bb-label {
    display: block;
    font-weight: 500;
    font-size: .9rem;
    margin-bottom: 5px;
    color: var(--bb-text);
}

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

.bb-input,
.bb-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid rgba(0,0,0,.25);
    border-radius: var(--bb-radius);
    font-family: inherit;
    font-size: 15px;
    color: var(--bb-text);
    background: var(--bb-background);
    transition: border-color .15s, box-shadow .15s;
    appearance: none;
}

.bb-input:focus,
.bb-textarea:focus {
    border-color: var(--bb-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--bb-primary) 15%, transparent);
    outline: none;
}

.bb-input.bb-input--error,
.bb-textarea.bb-textarea--error {
    border-color: var(--bb-error);
}

.bb-textarea { resize: vertical; min-height: 90px; }

.bb-field-error {
    display: block;
    font-size: 12px;
    color: var(--bb-error);
    margin-top: 4px;
    min-height: 1em;
}

.bb-required-note {
    font-size: 12px;
    opacity: .6;
    margin-top: 8px;
}

/* --- Zusammenfassung ----------------------------------------------------- */
.bb-summary-dl {
    border: 1px solid rgba(0,0,0,.1);
    border-radius: var(--bb-radius);
    overflow: hidden;
    margin-bottom: 24px;
}

.bb-summary-row {
    display: flex;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(0,0,0,.07);
}

.bb-summary-row:last-child { border-bottom: none; }
.bb-summary-row:nth-child(even) { background: rgba(0,0,0,.025); }

.bb-summary-row dt {
    width: 160px;
    flex-shrink: 0;
    font-weight: 500;
    color: var(--bb-text);
    opacity: .7;
}

.bb-summary-row dd {
    margin: 0;
    font-weight: 600;
    color: var(--bb-text);
    word-break: break-all;
}

/* --- Buttons ------------------------------------------------------------- */
.bb-step-nav {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 24px;
    flex-wrap: wrap;
}

.bb-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border: none;
    border-radius: var(--bb-radius);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, color .15s, transform .1s, opacity .15s;
    text-decoration: none;
    line-height: 1;
}

.bb-btn:active { transform: scale(.98); }
.bb-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

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

.bb-btn--primary:hover:not(:disabled) {
    background: color-mix(in srgb, var(--bb-primary) 85%, #fff);
}

.bb-btn--secondary {
    background: transparent;
    color: var(--bb-primary);
    border: 1px solid var(--bb-primary);
}

.bb-btn--secondary:hover:not(:disabled) {
    background: var(--bb-primary);
    color: #fff;
}

.bb-link {
    background: none;
    border: none;
    color: var(--bb-primary);
    cursor: pointer;
    font-size: 13px;
    text-decoration: underline;
    padding: 0;
    font-family: inherit;
}

.bb-link:hover { color: var(--bb-secondary); }

/* --- Info-Badges & Hints ------------------------------------------------- */
.bb-selected-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.bb-info-badge {
    background: var(--bb-secondary);
    color: var(--bb-primary);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.bb-hint {
    font-size: 13px;
    color: var(--bb-text);
    opacity: .55;
    margin-top: 12px;
    text-align: center;
}

/* --- Fehler-------------------------------------------------------------- */
.bb-error {
    color: var(--bb-error);
    font-size: 14px;
    font-weight: 500;
    padding: 10px 14px;
    background: color-mix(in srgb, var(--bb-error) 8%, transparent);
    border-radius: var(--bb-radius);
    margin-top: 12px;
}

.bb-error--hidden { display: none !important; }

/* --- Erfolgsmeldung ------------------------------------------------------ */
.bb-success {
    text-align: center;
    padding: 40px 24px;
}

.bb-success-icon {
    font-size: 56px;
    color: var(--bb-primary);
    margin-bottom: 16px;
    line-height: 1;
}

.bb-success h2 {
    font-family: inherit;
    color: var(--bb-text);
    font-size: 1.5rem;
    margin: 0 0 12px;
}

.bb-success p {
    color: var(--bb-text);
    opacity: .8;
    max-width: 440px;
    margin: 0 auto;
    line-height: 1.6;
}

/* --- Loading-Spinner ----------------------------------------------------- */
.bb-loading {
    text-align: center;
    padding: 24px;
    color: var(--bb-text);
    opacity: .6;
}

.bb-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--bb-primary);
    border-top-color: transparent;
    border-radius: 50%;
    animation: bb-spin .7s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}

@keyframes bb-spin {
    to { transform: rotate(360deg); }
}

/* --- Responsive ---------------------------------------------------------- */
@media (max-width: 480px) {
    .bistro-booking-wrap { padding: 16px; }

    .bb-progress-step { padding: 8px 2px; }
    .bb-step-label    { font-size: 10px; }
    .bb-step-num      { width: 26px; height: 26px; font-size: 12px; }

    .bb-field-row { grid-template-columns: 1fr; }

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

    .bb-summary-row dt { width: 110px; }
}
