/* Стили Mini App салона «Лаура». Цвета заданы переменными: тёмная тема меняет только их.
   В Telegram js/telegram.js подставляет фон и текст из темы пользователя. */

/* --- Цвета --- */
:root {
  --accent: #2AABEE;
  --accent-text: #0B79B8; /* акцентный текст темнее, чтобы читался на белом */
  --accent-soft: rgba(42, 171, 238, 0.14);
  --on-accent: #FFFFFF;
  --bg: #F1F3F7;
  --card: #FFFFFF;
  --text: #17212B;
  --hint: #667380;
  --sep: rgba(23, 33, 43, 0.1);
  --danger: #D93A3A;
  --danger-soft: rgba(217, 58, 58, 0.1);
  --skeleton: rgba(23, 33, 43, 0.08);
  --shadow: 0 2px 10px rgba(23, 33, 43, 0.07);
  --radius: 16px;
  --radius-sm: 12px;
  --tap: 44px; /* минимальная высота всего, на что можно нажать */
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
  color-scheme: light;
}

:root[data-theme="dark"] {
  --accent-text: #5CC0F5;
  --accent-soft: rgba(42, 171, 238, 0.2);
  --bg: #0F1720;
  --card: #1C2733;
  --text: #F2F5F8;
  --hint: #98A6B3;
  --sep: rgba(255, 255, 255, 0.1);
  --danger: #FF6B6B;
  --danger-soft: rgba(255, 107, 107, 0.14);
  --skeleton: rgba(255, 255, 255, 0.09);
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  color-scheme: dark;
}

/* --- Основа: приложение, а не страница --- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  overscroll-behavior: none;
}

#app {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 430px; /* только мобильный экран: на большом мониторе колонка по центру */
  min-width: 320px;
  height: var(--tg-viewport-stable-height, 100vh);
  height: var(--tg-viewport-stable-height, 100dvh);
  margin: 0 auto;
  overflow: hidden;
  background: var(--bg);
}

h1, h2, p { margin: 0; }
h1 { font-size: 26px; line-height: 1.2; font-weight: 700; }
h2 { font-size: 18px; line-height: 1.25; font-weight: 700; margin-top: 8px; }
img { display: block; background: var(--skeleton); -webkit-user-drag: none; }
a { color: inherit; text-decoration: none; }
small { font-size: 14px; color: var(--hint); display: block; }
b { font-weight: 600; }

button {
  appearance: none;
  border: 0;
  margin: 0;
  padding: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: inherit;
  cursor: pointer;
  touch-action: manipulation;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.accent { color: var(--accent-text); }
.hint { color: var(--hint); font-size: 14px; }
.grow { flex: 1; min-width: 0; display: block; }

/* --- Экраны и переходы --- */
#screens { position: relative; flex: 1; min-height: 0; overflow: hidden; }

.screen {
  position: absolute;
  inset: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: var(--bg);
}
.screen.is-leaving { pointer-events: none; }

.page { display: flex; flex-direction: column; gap: 12px; padding: 16px 16px 24px; }

/* Длительность 250 мс: должна совпадать с TRANSITION_MS в js/app.js */
.anim-push-in { animation: slide-in-right 250ms cubic-bezier(.2, .8, .2, 1) both; z-index: 2; }
.anim-push-out { animation: slide-out-left 250ms cubic-bezier(.2, .8, .2, 1) both; z-index: 1; }
.anim-pop-in { animation: slide-in-left 250ms cubic-bezier(.2, .8, .2, 1) both; z-index: 1; }
.anim-pop-out { animation: slide-out-right 250ms cubic-bezier(.2, .8, .2, 1) both; z-index: 2; }
.anim-fade-in { animation: fade-in 200ms ease both; z-index: 2; }
.anim-fade-out { animation: fade-out 200ms ease both; z-index: 1; }

@keyframes slide-in-right { from { transform: translateX(100%); } to { transform: none; } }
@keyframes slide-out-left { from { transform: none; } to { transform: translateX(-28%); } }
@keyframes slide-in-left { from { transform: translateX(-28%); } to { transform: none; } }
@keyframes slide-out-right { from { transform: none; } to { transform: translateX(100%); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { from { opacity: 1; } to { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .screen { animation-duration: 1ms !important; }
}

/* --- Панели вокруг экрана --- */
#browser-bar { flex: none; padding: 4px 8px 0; background: var(--bg); }

#tabs {
  flex: none;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 4px 4px calc(4px + var(--safe-bottom));
  background: var(--card);
  box-shadow: 0 -1px 0 var(--sep);
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 56px;
  border-radius: var(--radius-sm);
  color: var(--hint);
  font-size: 14px;
  transition: color 150ms ease, transform 120ms ease;
}
.tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.tab.is-on { color: var(--accent-text); font-weight: 600; }
.tab:active { transform: scale(.93); }

#fallback-main { flex: none; padding: 8px 16px calc(8px + var(--safe-bottom)); background: var(--bg); }

/* --- Кнопки --- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  transition: transform 120ms ease, opacity 120ms ease;
}
.btn:active { transform: scale(.97); opacity: .82; }
.btn:disabled { opacity: .55; }
.btn--wide { width: 100%; }
.btn--primary { background: var(--accent); color: var(--on-accent); }
.btn--tinted { background: var(--accent-soft); color: var(--accent-text); }
.btn--danger { background: var(--danger-soft); color: var(--danger); }
.btn-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.icon-btn {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: var(--tap);
  height: var(--tap);
  border-radius: 50%;
  color: var(--accent-text);
  transition: transform 120ms ease, background 120ms ease;
}
.icon-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:active { transform: scale(.9); background: var(--accent-soft); }
.icon-btn--tinted { background: var(--accent-soft); }

/* --- Карточки и списки --- */
.card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card b { display: block; }
.card[data-act], button.card { cursor: pointer; transition: transform 120ms ease, opacity 120ms ease; }
.card[data-act]:active, button.card:active { transform: scale(.98); opacity: .85; }
.info { flex-direction: column; align-items: flex-start; gap: 4px; }

.avatar { width: 48px; height: 48px; flex: none; border-radius: 50%; object-fit: cover; }
.avatar--lg { width: 64px; height: 64px; }

.chevron { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--hint); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.list { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 60px;
  padding: 10px 12px 10px 16px;
  transition: background 120ms ease;
}
.row b { display: block; font-weight: 500; }
.row + .row { box-shadow: inset 0 1px 0 var(--sep); }
.row:active { background: var(--accent-soft); }

.segment { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 3px; background: var(--skeleton); border-radius: var(--radius-sm); }
.segment button {
  min-height: 44px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  transition: background 150ms ease, color 150ms ease;
}
.segment button.is-on { background: var(--card); color: var(--accent-text); font-weight: 600; box-shadow: var(--shadow); }
:root[data-theme="dark"] .segment button.is-on { background: rgba(255, 255, 255, 0.16); }
.segment button:active { opacity: .7; }

.subtitle { color: var(--hint); font-size: 16px; margin-top: -8px; }
.demo-note { padding: 8px 12px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent-text); font-size: 14px; }
.fine { color: var(--hint); font-size: 14px; }
.notice { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--danger); font-size: 14px; }

/* --- С1. Главная --- */
.hero { position: relative; height: 200px; overflow: hidden; }
.hero--short { height: 160px; }
.hero__img { width: 100%; height: 100%; object-fit: cover; }
.hero__text {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 48px 16px 14px;
  color: #FFFFFF;
  background: linear-gradient(transparent, rgba(0, 0, 0, .62));
}
.hero__text h1 { font-size: 30px; }
.hero__text p { font-size: 14px; opacity: .92; }

.cats { display: flex; flex-direction: column; gap: 10px; }
.cat {
  position: relative;
  display: block;
  width: 100%;
  height: 112px;
  overflow: hidden;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 120ms ease, opacity 120ms ease;
}
.cat:active { transform: scale(.98); opacity: .88; }
.cat__img { width: 100%; height: 100%; object-fit: cover; object-position: center 30%; }
.cat[data-key="nails"] .cat__img { object-position: center 58%; } /* в кадре ногти, а не руль машины */
.cat[data-key="podology"] .cat__img { object-position: center 25%; }
.cat__text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 12px 14px;
  color: #FFFFFF;
  background: linear-gradient(transparent 25%, rgba(0, 0, 0, .66));
}
.cat__text b { font-size: 20px; font-weight: 700; }
.cat__text small { color: #FFFFFF; opacity: .92; }

.master-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.master-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-height: var(--tap);
  padding: 4px 0;
  font-size: 14px;
  text-align: center;
  border-radius: var(--radius-sm);
  transition: transform 120ms ease, background 120ms ease;
}
.master-chip:active { transform: scale(.95); background: var(--accent-soft); }
.master-chip span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

/* --- С3, С8. Списки карточек --- */
.offers { display: flex; flex-direction: column; gap: 10px; }

/* --- С4. Мастера --- */
.master-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.master-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 120ms ease, opacity 120ms ease;
}
.master-card:active { transform: scale(.97); opacity: .86; }
.master-card__img { width: 100%; aspect-ratio: 1; object-fit: cover; object-position: center 20%; }
.master-card__body { display: block; padding: 10px 12px 12px; }
.master-card__body b { display: block; font-size: 16px; }

/* --- С5. Мастер --- */
/* Как профиль в Telegram: круглое фото по центру, работы видны сразу */
.profile { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px 16px 0; text-align: center; }
.profile__img { width: 120px; height: 120px; margin-bottom: 8px; border-radius: 50%; object-fit: cover; object-position: center 20%; box-shadow: var(--shadow); }
.page--tight { padding-top: 12px; }
.works { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; border-radius: var(--radius); overflow: hidden; }
.work { display: block; aspect-ratio: 1; min-height: var(--tap); overflow: hidden; transition: opacity 120ms ease; }
.work:active { opacity: .7; }
.work__img { width: 100%; height: 100%; object-fit: cover; }

/* --- С6. Время --- */
.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.day {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 64px;
  background: var(--card);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  transition: background 150ms ease, color 150ms ease, transform 120ms ease;
}
.day small { color: inherit; opacity: .78; }
.day b { font-size: 18px; }
.day:active:not(:disabled) { transform: scale(.94); }
.day:disabled { background: transparent; box-shadow: none; color: var(--hint); opacity: .55; cursor: default; }
.day.is-on { background: var(--accent); color: var(--on-accent); }
.day.is-on small { opacity: 1; }

.slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.slot {
  min-height: 48px;
  background: var(--card);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  font-size: 16px;
  font-weight: 500;
  text-align: center;
  transition: background 150ms ease, color 150ms ease, transform 120ms ease;
}
.slot:active { transform: scale(.95); }
.slot.is-on { background: var(--accent); color: var(--on-accent); font-weight: 700; }

/* --- С7. Готово и пустые состояния --- */
.state { align-items: center; gap: 14px; padding-top: 48px; text-align: center; }
.done__mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--accent);
  animation: pop 300ms cubic-bezier(.2, 1.4, .4, 1) both;
}
.done__mark svg { width: 48px; height: 48px; fill: none; stroke: #FFFFFF; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.done__when { font-size: 22px; font-weight: 700; }
.done .subtitle { margin-top: -6px; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }

/* --- С8. Мои записи --- */
.booking { flex-direction: column; align-items: stretch; }
.booking__head { display: flex; align-items: center; gap: 12px; }
.booking__when { font-size: 18px; font-weight: 700; }

/* --- Заготовки на время загрузки --- */
.sk { background: var(--skeleton); border-radius: var(--radius-sm); animation: pulse 1.1s ease-in-out infinite alternate; }
.sk--title { height: 30px; width: 55%; }
.sk--card { height: 112px; border-radius: var(--radius); }
.sk--row { height: 60px; }
.sk--slot { height: 48px; }
@keyframes pulse { from { opacity: 1; } to { opacity: .45; } }

/* --- Просмотр фото --- */
#viewer { position: absolute; inset: 0; z-index: 10; background: #000000; animation: fade-in 200ms ease both; touch-action: pan-y; }
#viewer-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: none; opacity: 0; transition: opacity 200ms ease; }
#viewer-img.is-visible { opacity: 1; }
.viewer__zone { position: absolute; top: 0; bottom: 0; width: 30%; }
.viewer__zone--prev { left: 0; }
.viewer__zone--next { right: 0; }
.viewer__close { position: absolute; top: 12px; right: 12px; color: #FFFFFF; background: rgba(0, 0, 0, .5); }
#viewer-count { position: absolute; left: 0; right: 0; bottom: calc(16px + var(--safe-bottom)); color: #FFFFFF; font-size: 14px; text-align: center; pointer-events: none; }

/* --- Всплывающее сообщение --- */
#toast {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: calc(76px + var(--safe-bottom));
  z-index: 20;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  text-align: center;
  animation: fade-in 200ms ease both;
}
