/* =============================================================
   Table Booking – Frontend Styles
   Mobile First · Modern Wizard Design
   ============================================================= */

/* --- Custom Properties (erbt Theme-Farben als Fallback) --- */
:root {
  --tb-primary:       #081834;
  --tb-accent:        #081834;
  --tb-bg:            var(--wp--preset--color--background,     #ffffff);
  --tb-surface:       #f8f9fa;
  --tb-border:        #e2e8f0;
  --tb-text:          var(--wp--preset--color--foreground,     #1e293b);
  --tb-text-muted:    #64748b;
  --tb-success:       #22c55e;
  --tb-error:         #ef4444;
  --tb-warning:       #f59e0b;
  --tb-radius:        12px;
  --tb-radius-sm:     6px;
  --tb-shadow:        0 4px 24px rgba(8,24,52,.10);
  --tb-shadow-card:   0 2px 12px rgba(8,24,52,.06);
  --tb-transition:    .2s ease;
  --tb-font:          var(--wp--preset--font-family--body, inherit);
}

/* --- Wrapper --- */
.tb-wizard {
  font-family: var(--tb-font);
  font-weight: 300;
  color: var(--tb-text);
  max-width: 900px;
  margin: 0 auto;
  padding: 0 16px 48px;
}

/* =============================================================
   Fortschrittsanzeige
   ============================================================= */
.tb-progress {
  margin-bottom: 40px;
}

.tb-progress__steps {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
  counter-reset: step;
}

.tb-progress__steps::before {
  content: '';
  position: absolute;
  top: 20px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--tb-border);
  z-index: 0;
}

.tb-progress__step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 1;
}

.tb-progress__icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--tb-border);
  color: var(--tb-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 400;
  font-size: 14px;
  transition: background var(--tb-transition), color var(--tb-transition);
  border: 3px solid var(--tb-bg);
  box-shadow: 0 0 0 2px var(--tb-border);
}

.tb-progress__label {
  font-size: 11px;
  color: var(--tb-text-muted);
  margin-top: 6px;
  text-align: center;
  font-weight: 300;
  white-space: nowrap;
}

/* Active step */
.tb-progress__step--active .tb-progress__icon {
  background: var(--tb-accent);
  color: #fff;
  box-shadow: 0 0 0 2px var(--tb-accent);
}
.tb-progress__step--active .tb-progress__label {
  color: var(--tb-accent);
  font-weight: 500;
}

/* Done step */
.tb-progress__step--done .tb-progress__icon {
  background: var(--tb-success);
  color: #fff;
  box-shadow: 0 0 0 2px var(--tb-success);
}
.tb-progress__step--done .tb-progress__icon::before {
  content: '✓';
}
.tb-progress__step--done .tb-progress__icon span {
  display: none;
}

/* =============================================================
   Steps
   ============================================================= */
.tb-step {
  animation: tb-fade-in .3s ease;
}

@keyframes tb-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.tb-step__title {
  font-size: 24px;
  font-weight: 300;
  margin: 0 0 4px;
  color: var(--tb-primary);
  letter-spacing: -.01em;
}

.tb-step__subtitle {
  color: var(--tb-text-muted);
  margin: 0 0 24px;
  font-size: 15px;
  font-weight: 300;
}

.tb-step__actions {
  display: flex;
  gap: 12px;
  margin-top: 32px;
  flex-wrap: wrap;
}

/* =============================================================
   Buttons
   ============================================================= */
.tb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 24px;
  border-radius: var(--tb-radius-sm);
  font-size: 15px;
  font-weight: 400;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--tb-transition);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: .01em;
}

.tb-btn--primary {
  background: var(--tb-accent);
  color: #fff;
  border-color: var(--tb-accent);
}
.tb-btn--primary:hover:not(:disabled) {
  background: transparent;
  color: var(--tb-accent);
}

.tb-btn--secondary {
  background: transparent;
  color: var(--tb-primary);
  border-color: var(--tb-border);
}
.tb-btn--secondary:hover:not(:disabled) {
  border-color: var(--tb-primary);
}

.tb-btn--disabled,
.tb-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

/* =============================================================
   Kalender
   ============================================================= */
.tb-calendar {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
}

.tb-calendar__month {
  flex: 1 1 280px;
  min-width: 280px;
}

.tb-calendar__month-title {
  font-size: 16px;
  font-weight: 400;
  margin: 0 0 12px;
  color: var(--tb-primary);
}

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

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

.tb-calendar__cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--tb-radius-sm);
  font-size: 14px;
  font-weight: 300;
  cursor: pointer;
  border: 2px solid transparent;
  background: none;
  transition: all var(--tb-transition);
  color: var(--tb-text);
  padding: 0;
}

.tb-calendar__cell--empty {
  background: none;
  cursor: default;
}

.tb-calendar__cell--disabled {
  color: var(--tb-border);
  cursor: not-allowed;
  text-decoration: line-through;
}

.tb-calendar__cell--booked {
  color: var(--tb-error);
  cursor: not-allowed;
  background: #fef2f2;
}

.tb-calendar__cell--available:hover {
  background: var(--tb-surface);
  border-color: var(--tb-accent);
  color: var(--tb-accent);
}

.tb-calendar__cell--selected {
  background: var(--tb-accent) !important;
  color: #fff !important;
  border-color: var(--tb-accent) !important;
  font-weight: 500;
}

/* =============================================================
   Tisch-Karten (Grid)
   ============================================================= */
.tb-tables-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.tb-table-card {
  background: var(--tb-bg);
  border: 2px solid var(--tb-border);
  border-radius: var(--tb-radius);
  overflow: hidden;
  box-shadow: var(--tb-shadow-card);
  transition: transform var(--tb-transition), box-shadow var(--tb-transition), border-color var(--tb-transition);
  display: flex;
  flex-direction: column;
}

.tb-table-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--tb-shadow);
  border-color: var(--tb-accent);
}

.tb-table-card--unavailable {
  opacity: .6;
}
.tb-table-card--unavailable:hover {
  transform: none;
  box-shadow: var(--tb-shadow-card);
  border-color: var(--tb-border);
}

.tb-table-card__image {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
}

.tb-table-card__image--placeholder {
  height: 180px;
  background: linear-gradient(135deg, #081834 0%, #0d2248 100%);
}

.tb-table-card__body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.tb-table-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.tb-table-card__name {
  font-size: 17px;
  font-weight: 400;
  margin: 0;
  color: var(--tb-primary);
}

.tb-table-card__desc {
  font-size: 14px;
  font-weight: 300;
  color: var(--tb-text-muted);
  margin: 0 0 8px;
  flex: 1;
  line-height: 1.6;
  white-space: pre-line;
}

.tb-table-card__voucher {
  display: inline-block;
  font-size: 12px;
  font-weight: 400;
  color: var(--tb-primary);
  background: rgba(8,24,52,.06);
  border: 1px solid rgba(8,24,52,.12);
  border-radius: 4px;
  padding: 3px 9px;
  margin-bottom: 12px;
}

.tb-table-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
}

/* =============================================================
   Badges & Preise
   ============================================================= */
.tb-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: .5px;
  white-space: nowrap;
}

.tb-badge--available {
  background: #dcfce7;
  color: #166534;
}

.tb-badge--soldout {
  background: #fee2e2;
  color: #991b1b;
}

.tb-price {
  font-size: 20px;
  font-weight: 600;
  color: var(--tb-primary);
}

.tb-price--free {
  color: var(--tb-success);
}

/* =============================================================
   Service-Karten
   ============================================================= */
.tb-services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.tb-service-card {
  display: flex;
  flex-direction: column;
  background: var(--tb-bg);
  border: 2px solid var(--tb-border);
  border-radius: var(--tb-radius);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--tb-transition);
  position: relative;
}

.tb-service-card:hover {
  border-color: var(--tb-accent);
  box-shadow: var(--tb-shadow-card);
}

.tb-service-card--selected {
  border-color: var(--tb-accent);
  background: rgba(8,24,52,.04);
}

.tb-service-card--selected::after {
  content: '✓';
  position: absolute;
  top: 10px;
  right: 10px;
  width: 26px;
  height: 26px;
  background: var(--tb-accent);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 400;
}

.tb-service-card__checkbox {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.tb-service-card__image {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}

.tb-service-card__body {
  padding: 14px;
}

.tb-service-card__name {
  font-size: 15px;
  font-weight: 400;
  margin: 0 0 4px;
  color: var(--tb-primary);
}

.tb-service-card__desc {
  font-size: 13px;
  font-weight: 300;
  color: var(--tb-text-muted);
  margin: 0 0 10px;
  line-height: 1.4;
}

/* =============================================================
   Formular (Schritt 4)
   ============================================================= */
.tb-form {
  max-width: 640px;
}

.tb-form__row {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}

.tb-form__row--2col { grid-template-columns: 1fr 1fr; }
.tb-form__row--3col { grid-template-columns: 1fr 80px; }

.tb-form__group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tb-form__group label {
  font-size: 13px;
  font-weight: 400;
  color: var(--tb-text);
}

.tb-form__group input[type="text"],
.tb-form__group input[type="email"],
.tb-form__group input[type="tel"] {
  padding: 10px 14px;
  border: 2px solid var(--tb-border);
  border-radius: var(--tb-radius-sm);
  font-size: 15px;
  font-weight: 300;
  color: var(--tb-text);
  background: var(--tb-bg);
  transition: border-color var(--tb-transition);
  width: 100%;
  box-sizing: border-box;
}

.tb-form__group input:focus {
  outline: none;
  border-color: var(--tb-accent);
}

.tb-form__group input.tb-input--error {
  border-color: var(--tb-error);
}

.tb-form__group--checkbox {
  margin-bottom: 12px;
}

.tb-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}

.tb-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--tb-accent);
  cursor: pointer;
}

.tb-checkbox__label {
  font-size: 14px;
  font-weight: 300;
  color: var(--tb-text);
  line-height: 1.5;
}

.tb-checkbox__label a {
  color: var(--tb-accent);
}

.tb-form__required-note {
  font-size: 12px;
  font-weight: 300;
  color: var(--tb-text-muted);
  margin-top: 8px;
}

/* =============================================================
   Zusammenfassung (Schritt 5)
   ============================================================= */
.tb-summary {
  background: var(--tb-surface);
  border-radius: var(--tb-radius);
  padding: 28px;
  max-width: 640px;
}

.tb-summary__section {
  margin-bottom: 24px;
}

.tb-summary__section:last-of-type {
  margin-bottom: 0;
}

.tb-summary__section-title {
  font-size: 12px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--tb-text-muted);
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--tb-border);
}

.tb-summary__dl {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 6px 16px;
  margin: 0;
}

.tb-summary__dl dt {
  font-size: 13px;
  color: var(--tb-text-muted);
  font-weight: 300;
}

.tb-summary__dl dd {
  font-size: 14px;
  font-weight: 400;
  margin: 0;
}

.tb-summary__table {
  width: 100%;
  border-collapse: collapse;
}

.tb-summary__table td {
  padding: 7px 0;
  font-size: 14px;
  font-weight: 300;
  border-bottom: 1px solid var(--tb-border);
}

.tb-summary__price {
  text-align: right;
  font-weight: 400;
}

.tb-summary__total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--tb-primary);
  color: #fff;
  border-radius: var(--tb-radius-sm);
  padding: 16px 20px;
  margin-top: 24px;
  font-size: 18px;
  font-weight: 400;
  letter-spacing: .01em;
}

/* =============================================================
   Erfolgsmeldung
   ============================================================= */
.tb-success {
  text-align: center;
  padding: 60px 20px;
  animation: tb-fade-in .4s ease;
}

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

.tb-success__title {
  font-size: 26px;
  font-weight: 300;
  color: var(--tb-primary);
  margin: 0 0 12px;
  letter-spacing: -.01em;
}

.tb-success__message {
  font-size: 16px;
  font-weight: 300;
  color: var(--tb-text-muted);
  max-width: 480px;
  margin: 0 auto;
  line-height: 1.6;
}

/* =============================================================
   Alerts & Loading
   ============================================================= */
.tb-alert {
  padding: 14px 18px;
  border-radius: var(--tb-radius-sm);
  font-size: 14px;
  font-weight: 300;
  margin-top: 16px;
}

.tb-alert--error {
  background: #fef2f2;
  color: var(--tb-error);
  border: 1px solid #fecaca;
}

.tb-loading {
  text-align: center;
  color: var(--tb-text-muted);
  padding: 40px;
  font-size: 15px;
  font-weight: 300;
}

.tb-loading::before {
  content: '';
  display: block;
  width: 32px;
  height: 32px;
  border: 3px solid var(--tb-border);
  border-top-color: var(--tb-accent);
  border-radius: 50%;
  animation: tb-spin .7s linear infinite;
  margin: 0 auto 12px;
}

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

.tb-empty {
  color: var(--tb-text-muted);
  font-size: 15px;
  font-weight: 300;
  padding: 24px 0;
}

/* =============================================================
   Responsive
   ============================================================= */
@media (max-width: 600px) {
  .tb-progress__label { display: none; }
  .tb-progress__icon  { width: 32px; height: 32px; font-size: 12px; }
  .tb-progress__steps::before { top: 16px; }

  .tb-step__title { font-size: 20px; }

  .tb-form__row--2col,
  .tb-form__row--3col { grid-template-columns: 1fr; }

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

  .tb-summary { padding: 20px 16px; }
  .tb-summary__dl { grid-template-columns: 1fr; }
  .tb-summary__dl dt { margin-top: 8px; }
  .tb-summary__dl dt:first-child { margin-top: 0; }

  .tb-step__actions { flex-direction: column; }
  .tb-btn { width: 100%; }
}

/* =============================================================
   Kategoriefilter (v1.1)
   ============================================================= */
.tb-category-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: var(--tb-surface);
  border: 1px solid var(--tb-border);
  border-radius: var(--tb-radius-sm);
}

.tb-cat-btn {
  padding: 6px 16px;
  border-radius: 999px;
  border: 2px solid var(--tb-border);
  background: var(--tb-bg);
  color: var(--tb-text);
  font-size: 13px;
  font-weight: 300;
  cursor: pointer;
  transition: background var(--tb-transition), border-color var(--tb-transition), color var(--tb-transition);
  white-space: nowrap;
  line-height: 1.4;
}

.tb-cat-btn:hover,
.tb-cat-btn:focus {
  border-color: var(--tb-accent);
  color: var(--tb-accent);
  outline: none;
}

.tb-cat-btn--active {
  background: var(--tb-accent);
  border-color: var(--tb-accent);
  color: #fff;
  font-weight: 400;
}

/* Kategorie-Label auf der Tischkarte */
.tb-table-card__category {
  display: inline-block;
  font-size: 10px;
  font-weight: 400;
  color: var(--tb-accent);
  background: rgba(8,24,52,.06);
  border-radius: 4px;
  padding: 2px 7px;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* Verbleibende Einheiten */
.tb-remaining {
  display: block;
  font-size: 11px;
  color: var(--tb-warning);
  font-weight: 400;
  margin-top: 3px;
  text-align: right;
}

/* Leere Serviceliste */
.tb-empty-services {
  color: var(--tb-text-muted);
  font-size: 14px;
  font-weight: 300;
  font-style: italic;
  padding: 16px 0;
}

/* Responsive */
@media (max-width: 600px) {
  .tb-category-filter { padding: 10px 12px; }
  .tb-cat-btn { font-size: 12px; padding: 5px 12px; }
}
