/* ==============================================================================
   Стили схемы бронирования столов и табуреток
   ============================================================================== */

.booking-page {
  max-width: 1152px;
  margin: auto;
  padding: var(--space-8) var(--space-10) 0;
}

.instruction {
  text-align: center;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-5);
}

.date-picker-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.date-navigation {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}

.date-quick-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.date-pill-sm {
  padding: 3px 12px;
  font-size: 11.5px;
  font-weight: 500;
  border: 1px solid #cbd2c9;
  background: #ffffff;
  color: var(--color-text-muted);
  cursor: pointer;
  line-height: 1.35;
  transition: all .15s ease;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.date-pill-sm:hover:not(.is-active) {
  background: #edf2eb;
  border-color: #abb5ae;
  color: var(--color-text);
}

.date-pill-sm.is-active {
  background: var(--color-primary);
  color: #ffffff;
  border-color: var(--color-primary);
}

.date-arrow {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  color: #526359;
}

.date-arrow:hover {
  background: #e7ece5;
}

.date-arrow:disabled {
  opacity: .45;
}

.date-field {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  border: 1px solid #cbd2c9;
  border-radius: var(--radius-sm);
  background: #fff;
  padding: var(--space-2) var(--space-4);
  min-height: 48px;
}

.date-field svg {
  color: var(--color-text-muted);
}

.formatted-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: var(--text-base);
  font-weight: 500;
  white-space: nowrap;
}

.date-weekday {
  font-size: var(--text-xs);
  font-weight: 400;
  line-height: 1.4;
  color: var(--color-text-muted);
}

.date-field input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.date-field:focus-within {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}

.booking-page h1 {
  text-align: center;
  font-size: var(--text-xl);
  font-weight: 500;
  letter-spacing: 0;
}

.date-meta {
  min-height: 40px;
  margin-top: var(--space-2);
  margin-bottom: var(--space-6);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.text-link {
  font-size: var(--text-xs);
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  min-height: 44px;
  margin-left: var(--space-2);
}

/* День уборки */
.cleaning-control {
  max-width: 520px;
  margin: calc(-1 * var(--space-2)) auto var(--space-5);
}

.cleaning-add {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  margin: auto;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  border-radius: var(--radius-sm);
}

.cleaning-add:hover {
  background: #edf2ef;
}

.cleaning-add:disabled, .cleaning-remove:disabled {
  opacity: .6;
}

.cleaning-banner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid #c6d9e7;
  border-radius: var(--radius-md);
  background: #eaf3fa;
  color: #36576d;
}

.cleaning-banner > svg {
  flex-shrink: 0;
}

.cleaning-copy {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  text-align: left;
  font-size: var(--text-xs);
  line-height: 1.45;
}

.cleaning-title {
  font-size: var(--text-sm);
  font-weight: 500;
}

.cleaning-remove {
  flex-shrink: 0;
  min-height: 44px;
  padding: var(--space-2) 0;
  font-size: var(--text-xs);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cleaning-error {
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  text-align: center;
  color: var(--color-error);
}

/* Офисы и столы */
.office-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
}

.office {
  border: 1.5px solid var(--color-border);
  background: white;
  min-width: 0;
}

.office-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid #dfe4dd;
  background: #f0f2ec;
  gap: var(--space-2);
}

.office-heading-main {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.office-heading-main h2 {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-size: var(--text-lg);
  font-weight: 500;
  letter-spacing: 0;
  margin: 0;
}

.office-seats-pill {
  font-weight: 500;
  color: #4a5c52;
  letter-spacing: 0;
}

.office-seats-pill.is-full {
  color: #9b1c1c;
}

.office-sub {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.office-heading-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-office-cleaning {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 500;
  border: 1px dashed #abb5ae;
  background: rgba(255, 255, 255, 0.75);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all .15s ease;
}

.btn-office-cleaning svg {
  width: 13px;
  height: 13px;
}

.btn-office-cleaning:hover:not(:disabled) {
  border-style: solid;
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: #ffffff;
}

.btn-office-cleaning.is-active,
.badge-office-cleaning {
  border-style: solid;
  border-color: #73a985;
  background: #eaf4ed;
  color: #235436;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(35, 84, 54, 0.08);
}

.badge-office-cleaning {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 11.5px;
  border-radius: 999px;
}

.room-cleaning-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #f0f7f2;
  border: 1px dashed #9bc4a8;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  color: #2e6040;
  font-weight: 500;
  margin: -16px auto 16px;
  max-width: 320px;
}

.room-cleaning-strip svg {
  width: 12px;
  height: 12px;
}

.room {
  position: relative;
  padding: var(--space-10) 54px 56px;
}

.window {
  position: absolute;
  top: 0;
  left: 54px;
  right: 54px;
  height: 5px;
  border-left: 1px solid #d0d9db;
  border-right: 1px solid #d0d9db;
  background: #e2ebeb;
}

.top-desks {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.desk {
  position: relative;
  min-width: 0;
  border: 1px solid #b4beb5;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: space-between;
  transition: background-color .2s;
}

.top-desks .desk {
  height: 228px;
}

.top-desks .desk + .desk {
  border-left: 0;
}

.bottom-desk .desk {
  height: 126px;
  border-top: 0;
}

.desk-label {
  padding: var(--space-3) var(--space-3) 0;
  font-size: var(--text-xs);
  font-weight: 500;
  color: #556059;
  letter-spacing: .07em;
}

.desk-content {
  padding: var(--space-2) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  justify-content: center;
  flex: 1;
}

.selection {
  position: relative;
  min-height: 64px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #bac3bb;
  padding: var(--space-2) var(--space-4) var(--space-2) 0;
}

.selection::after {
  content: "";
  position: absolute;
  right: 0;
  top: calc(50% - 3px);
  width: 6px;
  height: 6px;
  border-right: 1px solid #465349;
  border-bottom: 1px solid #465349;
  transform: rotate(45deg);
}

.selected-label {
  font-size: var(--text-sm);
  font-weight: 500;
  overflow-wrap: anywhere;
  line-height: 1.5;
}

.selection select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 44px;
  z-index: 1;
  opacity: 0;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  border: 0;
  border-radius: 0;
  color: transparent;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
  font-size: 16px;
  cursor: pointer;
}

.selection select:disabled {
  opacity: 0;
  cursor: default;
}

.selection select option {
  color: #29312f;
  -webkit-text-fill-color: #29312f;
  background: white;
}

.selection:focus-within {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}

.occupied .selection {
  border-bottom-color: #29312f55;
}

.bottom-desk .selection {
  min-height: 44px;
}

.desk-status {
  font-size: var(--text-xs);
  color: #526158;
}

.bottom-desk .desk-content {
  padding: 0 var(--space-3) var(--space-2);
}

.occupied .desk-content {
  padding-top: 0;
  padding-bottom: 0;
}

.release {
  font-size: var(--text-xs);
  display: flex;
  align-items: center;
  gap: var(--space-1);
  align-self: flex-start;
  padding: var(--space-2) var(--space-3);
  min-height: 44px;
  color: #35443b;
}

.release:hover {
  background: #ffffff60;
}

.occupied .desk-status {
  display: none;
}

.desk-error {
  color: var(--color-error);
  font-size: var(--text-xs);
  padding: var(--space-2);
}

/* Стулья вокруг столов */
.chair {
  position: absolute;
  width: 27px;
  height: 27px;
  background: #d4ded6;
  border: 1px solid #a2b2a6;
  border-radius: 50%;
}

.chair-left {
  left: 13px;
  top: 140px;
}

.chair-right {
  right: 13px;
  top: 140px;
}

.chair-bottom {
  left: calc(50% - 13.5px);
  bottom: 15px;
}

/* Табуретки (места 7 и 8) */
.stool {
  position: absolute;
  bottom: calc(56px + 63px - 22px);
  width: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  z-index: 1;
}

.stool-left {
  left: 5px;
}

.stool-right {
  right: 5px;
}

.stool-seat {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1.5px dashed #a2b2a6;
  color: #6f7d74;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .02em;
  box-shadow: inset 0 0 0 4px #ffffff00;
  transition: transform .15s ease, background-color .2s ease;
}

.stool.occupied .stool-seat {
  border: 1.5px solid #29312f55;
  color: #29312f;
  box-shadow: inset 0 0 0 4px #ffffff55;
}

.stool-caption {
  font-size: 9px;
  line-height: 1;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #7c8a80;
  white-space: nowrap;
}

.stool select {
  position: absolute;
  inset: 0 0 auto 0;
  width: 44px;
  height: 44px;
  opacity: 0;
  cursor: pointer;
  font-size: 16px;
  appearance: none;
  -webkit-appearance: none;
}

.stool select:disabled {
  cursor: default;
}

.stool:hover .stool-seat {
  transform: scale(1.06);
}

.stool:has(select:focus-visible) .stool-seat {
  outline: 2px solid #29312f;
  outline-offset: 2px;
}

.stool-error {
  position: absolute;
  top: 66px;
  width: 150px;
  font-size: 11px;
  line-height: 1.3;
  color: #a03a2c;
  background: #fff;
  padding: 4px 6px;
  border: 1px solid #e4c6bf;
}

.stool-left .stool-error {
  left: 0;
}

.stool-right .stool-error {
  right: 0;
}

.scheme-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-6);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  padding-bottom: var(--space-8);
  margin-top: var(--space-4);
}

.scheme-footer p:first-child {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding-top: var(--space-1);
}

.scheme-footer p:last-child {
  text-align: right;
}

.free-key {
  display: inline-block;
  width: 12px;
  height: 12px;
  flex: none;
  background: white;
  border: 1px solid #a5afa6;
}

@media (min-width: 1200px) {
  .room {
    padding-left: 64px;
    padding-right: 64px;
  }
  .window {
    left: 64px;
    right: 64px;
  }
  .chair-left {
    left: 18px;
  }
  .chair-right {
    right: 18px;
  }
  .stool-left {
    left: 10px;
  }
  .stool-right {
    right: 10px;
  }
}

@media (max-width: 760px) {
  .booking-page {
    padding: var(--space-6) var(--space-4) 0;
  }
  .office-grid {
    grid-template-columns: 1fr;
    max-width: 520px;
    margin: auto;
    gap: var(--space-6);
  }
  .room {
    padding-left: 42px;
    padding-right: 42px;
  }
  .window {
    left: 42px;
    right: 42px;
  }
  .chair {
    width: 24px;
    height: 24px;
  }
  .chair-left {
    left: 8px;
  }
  .chair-right {
    right: 8px;
  }
  .chair-bottom {
    left: calc(50% - 12px);
  }
  .stool {
    width: 36px;
    bottom: calc(56px + 63px - 18px);
  }
  .stool-seat {
    width: 36px;
    height: 36px;
    font-size: 11px;
  }
  .stool select {
    width: 36px;
    height: 36px;
  }
  .stool-left {
    left: 3px;
  }
  .stool-right {
    right: 3px;
  }
  .stool-caption {
    font-size: 7px;
    letter-spacing: .02em;
  }
  .desk-content {
    padding-left: var(--space-2);
    padding-right: var(--space-2);
  }
  .selection {
    padding-right: var(--space-3);
  }
  .selected-label {
    font-size: var(--text-xs);
  }
  .scheme-footer {
    flex-direction: column;
    gap: var(--space-3);
    max-width: 520px;
    margin: auto;
  }
  .scheme-footer p:last-child {
    text-align: left;
  }
}

/* ==============================================================================
   UX-улучшения: Быстрое бронирование, Telegram, сводка, фильтры
   ============================================================================== */

/* 1. Блок идентификации пользователя */
.identity-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.identity-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 3px 12px;
  background: #edf2eb;
  border: 1px solid #c9d5c6;
  border-radius: var(--radius-full);
  color: var(--color-primary);
  font-weight: 500;
}

.identity-chip button {
  background: none;
  border: none;
  color: #79877b;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
}

.identity-chip button:hover {
  color: #c94a4a;
}

.identity-select {
  font-size: var(--text-xs);
  padding: 4px 10px;
  border: 1px solid #c9d5c6;
  border-radius: var(--radius-full);
  background: #fff;
  color: var(--color-text);
  cursor: pointer;
}

/* 2. Быстрые переключатели Сегодня / Завтра */
.date-quick-pills {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  margin-top: calc(var(--space-2) * -1);
  margin-bottom: var(--space-4);
}

.date-pill {
  padding: 4px 14px;
  border: 1px solid #cbd2c9;
  border-radius: var(--radius-full);
  background: #fff;
  font-size: var(--text-xs);
  color: #556259;
  cursor: pointer;
  transition: all 0.15s ease;
}

.date-pill:hover {
  background: #eef2ec;
  border-color: #a8b6a5;
}

.date-pill.is-active {
  background: #375b48;
  border-color: #375b48;
  color: #fff;
  font-weight: 500;
}

/* 3. Сводка свободных мест */
.seats-summary-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 4px 14px;
  background: #f4f7f2;
  border: 1px solid #d8e2d4;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  color: #435447;
  margin: 0 auto var(--space-5);
}

.seats-summary-badge .summary-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: #2ea043;
}

.seats-summary-badge.is-full .summary-dot {
  background: #cf3a3a;
}

.seats-summary-badge .summary-breakdown {
  color: var(--color-text-muted);
}

/* 4. Акцент "Ваше место" */
.my-seat-badge {
  position: absolute;
  top: -9px;
  right: 8px;
  background: #2d553f;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  letter-spacing: .02em;
  z-index: 3;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

/* Кнопка "Занять для себя" */
.btn-quick-book {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  font-size: 11px;
  background: #eef5eb;
  border: 1px solid #b7ccb1;
  border-radius: var(--radius-sm);
  color: #2e533c;
  cursor: pointer;
  margin-top: 4px;
  transition: all 0.15s ease;
}

.btn-quick-book:hover {
  background: #375b48;
  border-color: #375b48;
  color: #fff;
}

/* 7. Мобильный переключатель комнат */
.mobile-office-switcher {
  display: none;
}

@media (max-width: 760px) {
  .mobile-office-switcher {
    display: flex;
    justify-content: center;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
  }

  .mobile-tab {
    padding: 6px 14px;
    border: 1px solid #cbd2c9;
    border-radius: var(--radius-full);
    background: #fff;
    font-size: var(--text-xs);
    color: #556259;
    cursor: pointer;
  }

  .mobile-tab.is-active {
    background: #375b48;
    color: #fff;
    border-color: #375b48;
    font-weight: 500;
  }

  .office-grid[data-mobile-office="1"] .office:nth-child(2) {
    display: none;
  }

  .office-grid[data-mobile-office="2"] .office:nth-child(1) {
    display: none;
  }
}

/* 8. Кнопка "Скопировать для Telegram" */
.scheme-actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.btn-copy-telegram {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 14px;
  border: 1px solid #c8d4c5;
  border-radius: var(--radius-sm);
  background: #fbfdfa;
  color: #3e5645;
  font-size: var(--text-xs);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-copy-telegram:hover {
  background: #eef3eb;
  border-color: #a4ba9f;
}

.btn-copy-telegram.is-copied {
  background: #e8f5e9;
  border-color: #81c784;
  color: #2e7d32;
}

/* Примечание внизу схемы (фото 2) */
.scheme-footnote {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
  line-height: 1.45;
}

@media (max-width: 480px) {
  .date-picker-bar {
    flex-direction: column;
    gap: 8px;
  }
  .date-quick-stack {
    flex-direction: row;
    gap: 6px;
  }
}
