/* ============================================================
   screens.css — Переходы между экранами (iOS-стиль)
   Все экраны фиксированы, переключение через translateX
   ============================================================ */

/* ─── Базовый экран ─── */
.screen {
  position: absolute;
  inset: 0;
  background: var(--tg-bg);
  /* По умолчанию экран справа (скрыт) */
  transform: translateX(100%);
  transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Активный экран — по центру */
.screen.active {
  transform: translateX(0);
  z-index: 1;
}

/* Экран уходит влево (iOS: предыдущий экран смещается немного влево) */
.screen.behind {
  transform: translateX(-28%);
  z-index: 0;
}

/* ─── Экраны без стека (tab bar корневые) ─── */
/* Корневые экраны не используют translateX — они просто show/hide */
.screen.root {
  transform: none !important;
  transition: opacity 0.2s ease;
  opacity: 0;
  pointer-events: none;
  z-index: 0;
}

.screen.root.active {
  opacity: 1;
  pointer-events: all;
  z-index: 1;
}

/* ─── Экраны в стеке (booking flow) ─── */
/* Стек экранов управляется через .active и .behind */
.screen.stacked {
  transform: translateX(100%);
  z-index: 2;
}

.screen.stacked.active {
  transform: translateX(0);
}

.screen.stacked.behind {
  transform: translateX(-28%);
}

/* ─── Bottom Sheet (модалка снизу) ─── */
.bottom-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.bottom-sheet-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--tg-bg);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  z-index: 201;
  max-height: 80vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bottom-sheet.visible {
  transform: translateY(0);
}

/* Ручка bottom sheet */
.bottom-sheet-handle {
  width: 36px;
  height: 4px;
  background: rgba(0,0,0,0.15);
  border-radius: 2px;
  margin: var(--gap-sm) auto var(--gap-md);
}

[data-theme="dark"] .bottom-sheet-handle {
  background: rgba(255,255,255,0.2);
}

.bottom-sheet-header {
  display: flex;
  align-items: center;
  padding: 0 var(--gap-lg) var(--gap-md);
}

.bottom-sheet-title {
  font-size: var(--text-lg);
  font-weight: 700;
  flex: 1;
}

.bottom-sheet-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--tg-secondary-bg);
  border: none;
  font-size: var(--text-lg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--tg-hint);
  transition: opacity 0.15s;
  font-family: var(--font);
}

.bottom-sheet-close:active { opacity: 0.7; }

.bottom-sheet-content {
  padding: 0 var(--gap-lg) var(--gap-xl);
}

/* ─── Диалог подтверждения отмены ─── */
.confirm-dialog {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--gap-xl);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.confirm-dialog.visible {
  opacity: 1;
  pointer-events: all;
}

.confirm-dialog-box {
  background: var(--tg-bg);
  border-radius: var(--radius-xl);
  padding: var(--gap-xl);
  width: 100%;
  max-width: 320px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  transform: scale(0.9);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.confirm-dialog.visible .confirm-dialog-box {
  transform: scale(1);
}

.confirm-dialog-title {
  font-size: var(--text-lg);
  font-weight: 700;
  margin-bottom: var(--gap-sm);
}

.confirm-dialog-text {
  font-size: var(--text-md);
  color: var(--tg-hint);
  margin-bottom: var(--gap-xl);
  line-height: 1.5;
}

.confirm-dialog-actions {
  display: flex;
  gap: var(--gap-sm);
}

.confirm-dialog-actions .btn {
  flex: 1;
  padding: 0 var(--gap-md);
}

/* ─── Галерея (карточка услуги) ─── */
.gallery {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--tg-secondary-bg);
}

.gallery-track {
  display: flex;
  height: 100%;
  transition: transform 250ms ease;
  will-change: transform;
}

.gallery-slide {
  flex-shrink: 0;
  width: 100%;
  height: 100%;
}

/* Точки галереи */
.gallery-dots {
  position: absolute;
  bottom: var(--gap-sm);
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 5px;
}

.gallery-dot {
  width: 6px;
  height: 6px;
  border-radius: 3px;
  background: rgba(255,255,255,0.5);
  transition: all 0.2s;
}

.gallery-dot.active {
  width: 16px;
  background: #fff;
}

/* ─── Конкретные экраны ─── */

/* Экран подтверждения записи — плотная раскладка без комментария мастеру,
   чтобы весь экран умещался без прокрутки */
#screen-confirm .section {
  padding: var(--gap-md);
}

#screen-confirm .summary-card {
  padding: var(--gap-md);
}

#screen-confirm .summary-row {
  padding: var(--gap-xs) 0;
}

/* Экран успеха — центрированный */
#screen-success .screen-scroll {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 100%;
  padding: var(--gap-2xl) var(--gap-xl);
}

/* Профиль мастера — большой аватар */
#screen-profile .profile-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--gap-2xl) var(--gap-xl) var(--gap-lg);
  text-align: center;
}

#screen-profile .profile-name {
  font-size: var(--text-2xl);
  font-weight: 700;
  margin-top: var(--gap-md);
}

#screen-profile .profile-title {
  font-size: var(--text-md);
  color: var(--tg-hint);
  margin-top: 4px;
}

#screen-profile .profile-stats {
  display: flex;
  gap: var(--gap-xl);
  margin-top: var(--gap-lg);
  padding: var(--gap-md) 0;
}

#screen-profile .stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

#screen-profile .stat-value {
  font-size: var(--text-xl);
  font-weight: 700;
}

#screen-profile .stat-label {
  font-size: var(--text-xs);
  color: var(--tg-hint);
}

#screen-profile .profile-actions {
  display: flex;
  gap: var(--gap-sm);
  margin-top: var(--gap-md);
  width: 100%;
}

/* Карточка услуги — большой заголовок */
#screen-service .service-title {
  font-size: var(--text-xl);
  font-weight: 700;
  margin-bottom: var(--gap-xs);
}

#screen-service .service-meta {
  font-size: var(--text-sm);
  color: var(--tg-hint);
  margin-bottom: var(--gap-md);
}

#screen-service .service-desc {
  font-size: var(--text-md);
  line-height: 1.6;
  color: var(--tg-text);
}
