/* ═══════════════════════════════════════════════
   НАСТАВНИК PWA — style.css
   Базовые стили, переменные, типографика
═══════════════════════════════════════════════ */

/* ── CSS ПЕРЕМЕННЫЕ ──────────────────────────── */
:root {
  /* Зелёная палитра */
  --green-900: #04342C;
  --green-800: #085041;
  --green-700: #0F6E56;
  --green-500: #1D9E75;
  --green-300: #5DCAA5;
  --green-100: #9FE1CB;
  --green-50:  #E1F5EE;

  /* Акценты */
  --amber:        #EF9F27;
  --amber-light:  #FAEEDA;
  --amber-dark:   #633806;
  --purple:       #534AB7;
  --purple-light: #EEEDFE;
  --red:          #E24B4A;
  --red-light:    #FDEAEA;
  --blue:         #185FA5;
  --blue-light:   #E8F1FB;

  /* Нейтральные */
  --white:      #FFFFFF;
  --bg:         #F6FDF9;
  --text-dark:  #0D2B22;
  --text-mid:   #2C6B55;
  --text-muted: #4A8A72;
  --border:     #9FE1CB;

  /* Типографика */
  --font-main:  'Nunito', sans-serif;
  --font-head:  'Unbounded', sans-serif;

  /* Скругления */
  --radius-sm:  8px;
  --radius-md:  14px;
  --radius-lg:  20px;
  --radius-xl:  28px;
  --radius-full: 999px;

  /* Тени */
  --shadow-sm:  0 2px 8px rgba(8,80,65,.08);
  --shadow-md:  0 6px 24px rgba(8,80,65,.12);
  --shadow-lg:  0 16px 48px rgba(8,80,65,.16);

  /* Transitions */
  --ease:       .2s ease;

  /* Высота навбаров */
  --nav-top:    56px;
  --nav-bottom: 64px;

  /* Safe areas (iOS) */
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top:    env(safe-area-inset-top, 0px);
}

/* ── RESET ───────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  height: 100%;
}

body {
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--text-dark);
  line-height: 1.5;
  min-height: 100%;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; }
ul, ol { list-style: none; }

/* ── ТИПОГРАФИКА ─────────────────────────────── */
h1, h2, h3, h4, h5 {
  font-family: var(--font-head);
  line-height: 1.2;
  color: var(--text-dark);
}

h1 { font-size: clamp(22px, 5vw, 32px); font-weight: 900; }
h2 { font-size: clamp(18px, 4vw, 26px); font-weight: 900; }
h3 { font-size: clamp(15px, 3vw, 20px); font-weight: 700; }
h4 { font-size: 15px; font-weight: 700; }

p { font-size: 15px; line-height: 1.6; }

/* ── СКРОЛЛБАР ───────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--green-100); border-radius: 4px; }

/* ── КНОПКИ ──────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-main);
  font-weight: 800;
  border-radius: var(--radius-full);
  transition: background var(--ease), transform var(--ease), box-shadow var(--ease);
  cursor: pointer;
  border: none;
  white-space: nowrap;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--green-800);
  color: var(--white);
  padding: 14px 28px;
  font-size: 15px;
  box-shadow: var(--shadow-md);
}
.btn-primary:hover { background: var(--green-700); box-shadow: var(--shadow-lg); }

.btn-secondary {
  background: var(--green-50);
  color: var(--green-800);
  padding: 14px 28px;
  font-size: 15px;
  border: 2px solid var(--green-100);
}
.btn-secondary:hover { background: var(--green-100); }

.btn-amber {
  background: var(--amber);
  color: var(--amber-dark);
  padding: 14px 28px;
  font-size: 15px;
  box-shadow: 0 4px 16px rgba(239,159,39,.3);
}
.btn-amber:hover { filter: brightness(1.05); }

.btn-danger {
  background: var(--red-light);
  color: var(--red);
  padding: 12px 24px;
  font-size: 14px;
}
.btn-danger:hover { background: var(--red); color: var(--white); }

.btn-ghost {
  background: transparent;
  color: var(--text-mid);
  padding: 12px 20px;
  font-size: 14px;
}
.btn-ghost:hover { background: var(--green-50); }

.btn-sm { padding: 9px 18px; font-size: 13px; }
.btn-lg { padding: 18px 36px; font-size: 17px; }
.btn-full { width: 100%; }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── ФОРМЫ ───────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-mid);
}

.form-input {
  width: 100%;
  padding: 13px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dark);
  background: var(--white);
  transition: border-color var(--ease), box-shadow var(--ease);
  outline: none;
}

.form-input:focus {
  border-color: var(--green-500);
  box-shadow: 0 0 0 3px rgba(29,158,117,.12);
}

.form-input::placeholder { color: var(--text-muted); font-weight: 400; }

.form-input.error { border-color: var(--red); }
.form-error { font-size: 12px; color: var(--red); font-weight: 600; }
.form-hint { font-size: 12px; color: var(--text-muted); }

textarea.form-input { resize: vertical; min-height: 100px; }

select.form-input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%234A8A72' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 16px center; padding-right: 40px; }

/* ── КАРТОЧКИ ────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius-xl);
  border: 1.5px solid var(--green-50);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}

.card-hover {
  transition: transform var(--ease), box-shadow var(--ease);
}
.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* ── БЕЙДЖИ / СТАТУСЫ ────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
}

.badge-green   { background: var(--green-50);   color: var(--green-700); }
.badge-amber   { background: var(--amber-light); color: var(--amber-dark); }
.badge-red     { background: var(--red-light);   color: var(--red); }
.badge-purple  { background: var(--purple-light);color: var(--purple); }
.badge-blue    { background: var(--blue-light);  color: var(--blue); }

.badge-dot::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

/* ── TOAST УВЕДОМЛЕНИЯ ───────────────────────── */
#toast-container {
  position: fixed;
  bottom: calc(var(--nav-bottom) + 16px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  width: calc(100% - 32px);
  max-width: 380px;
  pointer-events: none;
}

.toast {
  background: var(--green-900);
  color: var(--white);
  padding: 12px 18px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: toastIn .3s cubic-bezier(.34,1.56,.64,1) forwards;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast.success { background: var(--green-700); }
.toast.error   { background: var(--red); }
.toast.warning { background: var(--amber-dark); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(20px) scale(.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
  to   { opacity: 0; transform: translateY(10px) scale(.95); }
}

/* ── МОДАЛЬНЫЕ ОКНА ──────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4,52,44,.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn .2s ease;
}

.modal-overlay.center { align-items: center; }

.modal {
  background: var(--white);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 24px 20px calc(20px + var(--safe-bottom));
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp .3s cubic-bezier(.34,1.56,.64,1);
}

.modal.center-modal {
  border-radius: var(--radius-xl);
  padding: 28px 24px;
  margin: 16px;
  max-height: 85vh;
}

.modal-handle {
  width: 40px; height: 4px;
  background: var(--green-100);
  border-radius: 4px;
  margin: 0 auto 20px;
}

.modal-title {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 900;
  color: var(--text-dark);
  margin-bottom: 16px;
  text-align: center;
}

@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(40px); } to { transform: translateY(0); } }

/* ── ЗАГРУЗКА ────────────────────────────────── */
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--green-100);
  border-top-color: var(--green-500);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-screen {
  position: fixed;
  inset: 0;
  background: var(--green-800);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  gap: 20px;
}

.loading-screen .spinner {
  border-color: rgba(255,255,255,.2);
  border-top-color: var(--white);
  width: 40px; height: 40px;
}

/* ── УТИЛИТЫ ─────────────────────────────────── */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.flex   { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.divider {
  height: 1px;
  background: var(--green-50);
  margin: 16px 0;
}
