/* vet.vetpodobed.pro — мини-кабинет внешних клиентов.
   Дизайн: тёплая «приёмная врача» — заботливый теал + тёплый акцент,
   мягкие карточки, крупная типографика. Намеренно НЕ похоже на админку. */

:root {
  --bg: #f6f4ef;
  --card: #ffffff;
  --primary: #0d9488;
  --primary-dark: #0b7a70;
  --primary-soft: #e4f4f1;
  --accent: #f97316;
  --accent-soft: #fff1e6;
  --text: #1c2b2a;
  --text-soft: #53625f;
  --muted: #8fa19d;
  --border: #e5e1d8;
  --danger: #dc2626;
  --radius: 18px;
  --shadow: 0 4px 18px rgba(28, 43, 42, 0.07);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.55;
  min-height: 100dvh;
}
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: 16px; color: var(--text); }
a { color: var(--primary-dark); }
:focus-visible { outline: 3px solid rgba(13, 148, 136, 0.45); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.screen { display: none; min-height: 100dvh; }
.screen.active { display: block; }

/* ── Splash / статусные экраны ── */
.center-screen {
  min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 32px 24px; gap: 14px;
}
.center-screen .logo-circle {
  width: 84px; height: 84px; border-radius: 50%;
  background: var(--primary-soft);
  display: flex; align-items: center; justify-content: center;
}
.center-screen .logo-circle svg { width: 44px; height: 44px; color: var(--primary); }
.center-screen h1 { font-size: 22px; font-weight: 700; }
.center-screen p { color: var(--text-soft); max-width: 420px; }
.pulse { animation: vetPulse 1.6s ease-in-out infinite; }
@keyframes vetPulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.07); opacity: 0.75; } }

/* ── Общий каркас ── */
.page {
  max-width: 560px; margin: 0 auto;
  padding: 18px 16px calc(86px + env(safe-area-inset-bottom));
}
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin-bottom: 14px;
}
h2.section-title { font-size: 18px; font-weight: 700; margin-bottom: 10px; }
.hint { font-size: 13.5px; color: var(--text-soft); }

/* ── Кнопки ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 14px; padding: 14px 20px;
  font-size: 16px; font-weight: 600; min-height: 48px;
  transition: background-color .2s, box-shadow .2s, opacity .2s;
  -webkit-tap-highlight-color: transparent;
}
.btn:disabled { opacity: 0.55; cursor: default; }
.btn svg { width: 20px; height: 20px; flex: 0 0 auto; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: #ea6a0e; }
.btn-soft { background: var(--primary-soft); color: var(--primary-dark); }
.btn-soft:hover { background: #d5ece8; }
.btn-ghost { background: transparent; color: var(--text-soft); border: 1.5px solid var(--border); }
.btn-block { width: 100%; }

/* ── Формы ── */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.field .req { color: var(--danger); }
.input, textarea.input, select.input {
  width: 100%; padding: 13px 14px;
  border: 1.5px solid var(--border); border-radius: 12px;
  background: #fff; transition: border-color .15s;
}
.input:focus { border-color: var(--primary); outline: none; }
textarea.input { resize: vertical; min-height: 84px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1.5px solid var(--border); background: #fff; border-radius: 999px;
  padding: 10px 18px; font-size: 15px; min-height: 44px;
  transition: background-color .15s, border-color .15s, color .15s;
}
.chip.selected { background: var(--primary); border-color: var(--primary); color: #fff; }
.form-row { display: flex; gap: 10px; }
.form-row .field { flex: 1; }

/* ── Шапка главного экрана ── */
.hero {
  background: linear-gradient(140deg, #0d9488 0%, #14b8a6 70%, #2dd4bf 100%);
  border-radius: 22px; color: #fff; padding: 22px 20px; margin-bottom: 16px;
  box-shadow: 0 8px 24px rgba(13, 148, 136, 0.25);
}
.hero .greet { font-size: 21px; font-weight: 700; }
.hero .sub { font-size: 14px; opacity: 0.9; margin-top: 2px; }
.doctor-card {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255, 255, 255, 0.14); border-radius: 16px;
  padding: 12px 14px; margin-top: 14px;
}
.doctor-card .ava {
  width: 48px; height: 48px; border-radius: 50%; flex: 0 0 auto;
  background: #fff; color: var(--primary-dark);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 17px;
}
.doctor-card .nm { font-weight: 700; font-size: 15px; line-height: 1.3; }
.doctor-card .sp { font-size: 12.5px; opacity: 0.9; }

/* Плашка «заполните анкету» */
.q-banner {
  display: flex; align-items: center; gap: 12px;
  background: var(--accent-soft); border: 1.5px solid #fed7aa;
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px;
}
.q-banner svg { width: 26px; height: 26px; color: var(--accent); flex: 0 0 auto; }
.q-banner .tt { font-weight: 700; font-size: 15px; }
.q-banner .dd { font-size: 13px; color: var(--text-soft); }

/* ── Нижняя навигация ── */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: rgba(255, 255, 255, 0.96); backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-around;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
.tabbar button {
  flex: 1; max-width: 140px; background: none; border: none;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 4px; border-radius: 12px; color: var(--muted);
  font-size: 11.5px; font-weight: 600; min-height: 52px; position: relative;
  transition: color .15s, background-color .15s;
}
.tabbar button svg { width: 24px; height: 24px; }
.tabbar button.active { color: var(--primary-dark); background: var(--primary-soft); }
.tab-dot {
  position: absolute; top: 4px; right: calc(50% - 20px);
  min-width: 18px; height: 18px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 700;
  display: none; align-items: center; justify-content: center; padding: 0 5px;
}
.tab-dot.show { display: inline-flex; }

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: vetFadeIn .22s ease; }
@keyframes vetFadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── Файлы ── */
.file-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 4px; border-bottom: 1px solid #f0ede5;
  background: none; border-radius: 10px; width: 100%; text-align: left; border: none;
}
.file-row:hover { background: #faf9f5; }
.file-row:last-child { border-bottom: none; }
.file-row .fico {
  width: 42px; height: 42px; border-radius: 12px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
}
.file-row .fico.study { background: var(--primary-soft); color: var(--primary-dark); }
.file-row .fico.discharge { background: var(--accent-soft); color: var(--accent); }
.file-row .fico svg { width: 22px; height: 22px; }
.file-row .fname { font-size: 14.5px; font-weight: 600; word-break: break-word; }
.file-row .fmeta { font-size: 12px; color: var(--muted); }
.empty-note { text-align: center; color: var(--muted); font-size: 14px; padding: 18px 8px; }

.upload-zone {
  border: 2px dashed #bcd9d3; border-radius: var(--radius);
  background: #f2faf8; padding: 22px 16px; text-align: center;
  width: 100%; transition: background-color .15s, border-color .15s;
}
.upload-zone:hover { background: #e8f6f3; border-color: var(--primary); }
.upload-zone svg { width: 30px; height: 30px; color: var(--primary); margin-bottom: 6px; }
.upload-zone .uz-t { font-weight: 700; font-size: 15px; color: var(--primary-dark); }
.upload-zone .uz-d { font-size: 13px; color: var(--text-soft); margin-top: 2px; }

/* ── Чат ── */
.chat-box { display: flex; flex-direction: column; gap: 8px; min-height: 180px; }
.msg {
  max-width: 84%; border-radius: 16px; padding: 10px 14px;
  font-size: 15px; white-space: pre-wrap; word-break: break-word;
}
.msg.client { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 5px; }
.msg.doctor { align-self: flex-start; background: #fff; border: 1px solid var(--border); border-bottom-left-radius: 5px; }
.msg .mtime { display: block; font-size: 10.5px; opacity: 0.65; margin-top: 3px; }
.msg .fpill {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 5px;
  background: rgba(255, 255, 255, 0.18); border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 10px; padding: 7px 11px; font-size: 13.5px; cursor: pointer;
}
.msg.doctor .fpill { background: var(--primary-soft); color: var(--primary-dark); border: none; }
.composer { display: flex; gap: 8px; align-items: flex-end; margin-top: 12px; }
.composer textarea {
  flex: 1; border: 1.5px solid var(--border); border-radius: 14px;
  padding: 12px 14px; resize: none; max-height: 120px; background: #fff;
}
.composer .send-btn {
  width: 48px; height: 48px; border-radius: 50%; border: none; flex: 0 0 auto;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: background-color .2s;
}
.composer .send-btn:hover { background: var(--primary-dark); }
.composer .send-btn svg { width: 21px; height: 21px; }

/* ── Звонок ── */
.call-illustration {
  width: 92px; height: 92px; border-radius: 50%; margin: 6px auto 12px;
  background: var(--primary-soft); display: flex; align-items: center; justify-content: center;
}
.call-illustration svg { width: 44px; height: 44px; color: var(--primary); }

/* Входящий звонок */
.incoming-banner {
  position: fixed; left: 12px; right: 12px; top: 14px; z-index: 90;
  background: #103c38; color: #fff; border-radius: 20px;
  padding: 18px; text-align: center; box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
  animation: vetFadeIn .25s ease;
}
.incoming-banner .ib-title { font-weight: 700; font-size: 17px; margin-bottom: 2px; }
.incoming-banner .ib-sub { font-size: 13.5px; opacity: 0.85; margin-bottom: 14px; }
.incoming-banner .ib-row { display: flex; gap: 12px; }
.incoming-banner .ib-row .btn { flex: 1; }

/* Оверлей активного звонка */
.call-overlay {
  position: fixed; inset: 0; z-index: 100; background: #0b1f1d;
  display: flex; flex-direction: column;
}
.call-overlay video.remote { flex: 1; width: 100%; object-fit: cover; background: #0b1f1d; }
.call-overlay video.local {
  position: absolute; top: 14px; right: 14px; width: 110px; border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.4); background: #000;
}
.call-overlay .audio-face {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #fff; gap: 10px;
}
.call-overlay .audio-face .ava {
  width: 96px; height: 96px; border-radius: 50%; background: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 34px; font-weight: 800;
}
.call-overlay .call-status {
  position: absolute; top: 16px; left: 0; right: 0; text-align: center;
  color: rgba(255, 255, 255, 0.9); font-size: 14px; text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}
.call-controls {
  display: flex; justify-content: center; gap: 16px;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
}
.call-controls button {
  width: 58px; height: 58px; border-radius: 50%; border: none;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.16); color: #fff;
  transition: background-color .2s;
}
.call-controls button svg { width: 24px; height: 24px; }
.call-controls button.off { background: rgba(255, 255, 255, 0.85); color: #0b1f1d; }
.call-controls .hangup { background: var(--danger); }

/* ── Анкета (шаги онбординга) ── */
.steps-dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 16px; }
.steps-dots span { width: 26px; height: 5px; border-radius: 3px; background: var(--border); }
.steps-dots span.on { background: var(--primary); }

.toast {
  position: fixed; bottom: calc(96px + env(safe-area-inset-bottom)); left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #103c38; color: #fff; border-radius: 12px;
  padding: 11px 18px; font-size: 14px; opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s; z-index: 120; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (min-width: 700px) {
  .page { padding-top: 28px; }
  .hero .greet { font-size: 24px; }
}
