/* style.css — оформление в стиле нативного Telegram. Цвета и тема задаются переменными в начале файла. */

:root {
  --accent: #AD877C;            /* пудровый акцент; реальное значение ставит app.js из config.js */
  --accent-2: #D9BFA3;
  --accent-text: #ffffff;
  --bg: #f1f2f5;               /* фон приложения */
  --card: #ffffff;             /* фон карточек */
  --text: #111418;
  --hint: #7d8590;
  --line: rgba(0, 0, 0, .08);
  --shadow: 0 2px 10px rgba(16, 24, 40, .08);
  --radius: 16px;
  --danger: #e5484d;
  --ok: #34c759;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
/* Тёмная тема: включается скриптом (data-theme="dark") по теме Telegram или системе */
:root[data-theme="dark"] {
  --bg: #0f1114;
  --card: #1b1e23;
  --text: #f2f4f7;
  --hint: #8c95a1;
  --line: rgba(255, 255, 255, .09);
  --shadow: 0 2px 10px rgba(0, 0, 0, .4);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden;       /* никакой прокрутки страницы целиком */
  background: var(--bg); color: var(--text);
  font: 16px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-user-select: none; user-select: none;     /* как в приложении, текст не выделяется */
  overscroll-behavior: none;
}

/* ---------- Экраны и переходы ---------- */
#screens { position: fixed; inset: 0; overflow: hidden; }
.screen {
  position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden;
  padding: calc(var(--safe-top) + 14px) 14px calc(var(--safe-bottom) + 96px);
  background: var(--bg);
  transition: transform .28s ease, opacity .28s ease;
  -webkit-overflow-scrolling: touch;
}
.screen.enter-right { transform: translateX(100%); }       /* новый экран заезжает справа */
.screen.leave-left  { transform: translateX(-24%); opacity: 0; }
.screen.leave-right { transform: translateX(100%); }       /* уходящий экран при «назад» */
.screen.enter-left  { transform: translateX(-24%); opacity: 0; }
.screen.fade-in { opacity: 0; }

h1 { font-size: 24px; margin: 6px 2px 4px; letter-spacing: -.3px; }
h2 { font-size: 18px; margin: 18px 2px 10px; }
.sub { color: var(--hint); font-size: 14px; margin: 0 2px 12px; }
.title-row { display: flex; align-items: center; gap: 10px; padding-left: 52px; min-height: 44px; }
.title-row h1 { margin: 0; }

/* ---------- Кнопки ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 48px; padding: 12px 16px; border: 0; border-radius: 14px;
  font-family: inherit; font-weight: 600; font-size: 16px; line-height: 1.2; cursor: pointer; transition: transform .1s, opacity .15s;
}
.btn:active, .tap:active { transform: scale(.97); opacity: .85; }   /* отклик на касание */
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-secondary { background: var(--card); color: var(--accent); box-shadow: var(--shadow); }
.btn-danger { background: var(--card); color: var(--danger); box-shadow: var(--shadow); }
.btn[disabled] { opacity: .4; pointer-events: none; }

.bottom-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding: 10px 14px calc(var(--safe-bottom) + 10px);
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}
.hidden { display: none !important; }
.back-btn {
  position: fixed; top: calc(var(--safe-top) + 14px); left: 12px; z-index: 30;
  width: 44px; height: 44px; border-radius: 22px; border: 0; background: var(--card);
  color: var(--accent); font-size: 30px; line-height: 40px; box-shadow: var(--shadow); cursor: pointer;
}

/* ---------- Карточки ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 12px; }
.pad { padding: 14px; }
.tap { cursor: pointer; transition: transform .1s, opacity .15s; }

/* Фото с градиентом-запасным вариантом (если файла нет в img/) */
.ph { background-size: cover; background-position: center; position: relative; }
.cover { height: 220px; border-radius: var(--radius); margin-bottom: 12px; display: flex; align-items: flex-end; box-shadow: var(--shadow); }
.cover .cover-text { padding: 16px; width: 100%; color: #3a3434; background: linear-gradient(to top, rgba(255,255,255,.75), transparent); border-radius: 0 0 var(--radius) var(--radius); }
.cover h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 28px; }
.cover p { margin: 2px 0 0; font-size: 14px; }

/* Плашка и чипы */
.promo { background: linear-gradient(120deg, var(--accent), var(--accent-2)); color: var(--accent-text); padding: 12px 14px; border-radius: 14px; font-weight: 600; margin-bottom: 12px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  min-height: 44px; padding: 10px 14px; border-radius: 22px; background: var(--card); box-shadow: var(--shadow);
  font-size: 15px; font-weight: 600; border: 2px solid transparent; display: inline-flex; align-items: center; justify-content: center;
}
.chip.sel { border-color: var(--accent); color: var(--accent); }
.chip.off { opacity: .35; pointer-events: none; }

/* Плитки главной */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); min-height: 84px; padding: 12px; display: flex; flex-direction: column; justify-content: center; gap: 4px; font-weight: 600; }
.tile .em { font-size: 24px; }

/* Список услуг */
.svc { display: flex; gap: 12px; padding: 12px; align-items: center; border: 2px solid transparent; border-radius: var(--radius); }
.svc.sel { border-color: var(--accent); }
.svc .thumb { width: 72px; height: 72px; border-radius: 12px; flex: none; }
.svc .info { flex: 1; min-width: 0; }
.svc .name { font-weight: 600; font-size: 16px; }
.svc .meta { color: var(--hint); font-size: 14px; margin-top: 2px; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; color: #fff; background: #ff9500; padding: 2px 8px; border-radius: 8px; margin-left: 6px; }
.check { width: 28px; height: 28px; border-radius: 14px; border: 2px solid var(--line); flex: none; display: flex; align-items: center; justify-content: center; color: transparent; font-weight: 700; }
.sel .check { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.info-btn { width: 44px; height: 44px; border: 0; background: transparent; color: var(--hint); font-size: 20px; flex: none; }

/* Лента дат */
.dates { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: none; }
.dates::-webkit-scrollbar { display: none; }
.date { flex: none; width: 56px; min-height: 68px; border-radius: 14px; background: var(--card); box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; justify-content: center; border: 2px solid transparent; }
.date b { font-size: 18px; }
.date small { font-size: 13px; color: var(--hint); }
.date.sel { border-color: var(--accent); background: var(--accent); }
.date.sel b, .date.sel small { color: var(--accent-text); }
.date.off { opacity: .5; }
.slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.slot { min-height: 48px; border-radius: 12px; background: var(--card); box-shadow: var(--shadow); font-weight: 600; font-size: 16px; display: flex; align-items: center; justify-content: center; border: 2px solid transparent; }
.slot.sel { border-color: var(--accent); background: var(--accent); color: var(--accent-text); }

/* Строки с данными */
.row { display: flex; justify-content: space-between; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 15px; }
.row:last-child { border-bottom: 0; }
.row span:first-child { color: var(--hint); }
.row b { text-align: right; }
textarea {
  width: 100%; min-height: 80px; padding: 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font-family: inherit; font-size: 16px; line-height: 1.3; resize: none; -webkit-user-select: text; user-select: text;
}
.note { color: var(--hint); font-size: 14px; margin: 8px 2px 14px; }

/* Сетка фото */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.photo { aspect-ratio: 4 / 5; border-radius: var(--radius); box-shadow: var(--shadow); display: flex; align-items: flex-end; overflow: hidden; }
.photo.sq { aspect-ratio: 1 / 1; }
.photo .cap { width: 100%; padding: 22px 10px 10px; color: #fff; font-weight: 600; font-size: 14px; background: linear-gradient(to top, rgba(0,0,0,.55), transparent); }
.tag { position: absolute; top: 8px; left: 8px; background: rgba(255,255,255,.9); color: #3a3434; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 8px; }

/* Успех */
.success { text-align: center; padding-top: 40px; }
.big-check { width: 88px; height: 88px; border-radius: 44px; background: var(--ok); color: #fff; font-size: 48px; line-height: 88px; margin: 0 auto 14px; animation: pop .4s ease; }
@keyframes pop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Скелетон загрузки */
.skeleton { background: linear-gradient(90deg, var(--card) 25%, var(--line) 50%, var(--card) 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 12px; height: 64px; margin-bottom: 10px; }
@keyframes sk { to { background-position: -200% 0; } }
.empty { text-align: center; color: var(--hint); padding: 30px 10px; }
.empty .em { font-size: 44px; }

/* Лист снизу и тост */
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.4); opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 40; }
.sheet-bg.show { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 86%; overflow-y: auto;
  background: var(--card); border-radius: 22px 22px 0 0; padding: 18px 16px calc(var(--safe-bottom) + 16px);
  transform: translateY(105%); transition: transform .28s ease;
}
.sheet.show { transform: translateY(0); }
.sheet .ph { height: 180px; border-radius: 14px; margin-bottom: 12px; }
.sheet-back { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; margin: -8px 0 8px -8px; padding: 4px 10px 4px 4px; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 15px; cursor: pointer; }
.sheet-back:first-letter { font-size: 30px; line-height: 20px; }
.sheet ul { padding-left: 20px; margin: 8px 0 14px; }
.sheet li { margin: 4px 0; }
.toast { position: fixed; left: 50%; top: calc(var(--safe-top) + 16px); transform: translate(-50%, -120px); background: rgba(30,30,30,.92); color: #fff; padding: 12px 18px; border-radius: 14px; z-index: 60; transition: transform .25s; font-size: 14px; max-width: 90%; text-align: center; }
.toast.show { transform: translate(-50%, 0); }
.seg { display: flex; background: var(--bg); border-radius: 12px; padding: 3px; margin: 10px 0; }
.seg button { flex: 1; min-height: 44px; border: 0; border-radius: 10px; background: transparent; color: var(--text); font-family: inherit; font-weight: 600; font-size: 15px; }
.seg button.sel { background: var(--card); box-shadow: var(--shadow); color: var(--accent); }
.checkrow { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.checkrow:last-child { border-bottom: 0; }
.checkrow .grow { flex: 1; }
.checkrow small { color: var(--hint); display: block; }
.stars { color: #ff9f0a; letter-spacing: 2px; }

/* ---------- Мастер ---------- */
select, input[type=number], input[type=text] {
  width: 100%; min-height: 48px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font-family: inherit; font-size: 16px; -webkit-user-select: text; user-select: text;
}
.fld { margin-bottom: 12px; } .fld label { display: block; font-size: 14px; color: var(--hint); margin: 0 2px 4px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.new { border-left: 4px solid var(--accent); }
.badge.acc { background: var(--accent); color: var(--accent-text); }
.master-entry { border: 2px solid var(--accent); }
.switch { width: 52px; height: 30px; border-radius: 15px; background: var(--line); position: relative; flex: none; transition: background .2s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 12px; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch.on { background: var(--accent); } .switch.on::after { transform: translateX(22px); }

/* Согласие, баннер «нет связи», отметки посещения */
.consent { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--hint); margin: 4px 2px 16px; min-height: 44px; cursor: pointer; }
.consent input { width: 24px; height: 24px; margin: 0; flex: none; accent-color: var(--accent); }
#offline-bar { position: fixed; top: 0; left: 0; right: 0; background: var(--danger, #d64545); color: #fff; text-align: center; padding: 10px; font-size: 14px; z-index: 50; transform: translateY(-110%); transition: transform .25s; }
#offline-bar.show { transform: none; }
.badge.ok { background: #3c9a5f; } .badge.bad { background: #d64545; }
.daynav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 0 10px; }
.daynav .arrow { width: 44px; height: 44px; border-radius: 50%; background: var(--card); box-shadow: var(--shadow); border: 0; font-size: 24px; color: var(--accent); cursor: pointer; }
.daynav .day { text-align: center; flex: 1; } .daynav .day b { font-size: 20px; display: block; } .daynav .day span { color: var(--hint); font-size: 14px; }
