/* =====================================================
   Relo Cat — лейаут, навигация, оверлеи.
   Опирается на токены и примитивы из theme.css.
   ===================================================== */

.main-content {
  padding: var(--spacing-md);
  padding-bottom: calc(var(--nav-h) + 40px);
  max-width: 600px;
  margin: 0 auto;
}
.container { width: 100%; }

.page-header { margin: 4px 2px 16px; }
.page-title {
  font-size: 28px;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.6px;
}

.view { animation: viewIn var(--dur) var(--ease); }
.view.hidden { display: none; }
@keyframes viewIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.card-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 14px;
  color: var(--text-primary);
}
.card-title svg { width: 19px; height: 19px; color: var(--color-primary); flex: none; }

.muted { color: var(--text-muted); }
.list { display: flex; flex-direction: column; gap: 12px; }
.list-compact { display: flex; flex-direction: column; gap: 8px; }

/* ----------------- Кнопки ----------------- */
.block-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 4px 0 14px;
}
.block-btn svg { width: 18px; height: 18px; }
.btn-danger {
  border: none;
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--color-danger) 14%, transparent);
  color: var(--color-danger);
  font-weight: 650;
  font-size: 15px;
  padding: 12px 22px;
  cursor: pointer;
  margin-top: 18px;
}
.btn-danger:active { filter: brightness(0.96); }

/* ----------------- Поля ----------------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; color: var(--text-secondary); }

/* ----------------- Сегменты (табы) ----------------- */
.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--fill-track);
  border-radius: var(--r-pill);
  margin-bottom: 16px;
  overflow-x: auto;
}
.seg-btn {
  flex: 1;
  white-space: nowrap;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 650;
  padding: 8px 12px;
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.seg-btn.active {
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-card);
}
.pane.hidden { display: none; }

/* ----------------- Нижняя навигация ----------------- */
.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  width: min(560px, calc(100% - 24px));
  height: var(--nav-h);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 0 6px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-float);
  z-index: 1000;
}
.nav-item {
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  flex: 1;
  padding: 7px 0;
  border-radius: var(--r-md);
  transition: color var(--dur) var(--ease), transform var(--dur) var(--ease-spring);
}
.nav-item svg { width: 22px; height: 22px; transition: transform var(--dur) var(--ease-spring); }
.nav-item.active { color: var(--color-primary); }
.nav-item.active svg { transform: translateY(-1px) scale(1.06); }
.nav-item:active { transform: scale(0.92); }

.bottom-fade {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(12px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, var(--bg-app) 40%, transparent);
  pointer-events: none;
  z-index: 999;
}

/* ----------------- Subview (детали / формы) ----------------- */
.subview {
  position: fixed;
  inset: 0;
  z-index: 2400;
  background: var(--bg-app);
  transform: translateX(100%);
  transition: transform 0.28s var(--ease);
  overflow-y: auto;
  padding: var(--spacing-md);
  padding-bottom: 40px;
}
.subview.open { transform: translateX(0); }
.subview-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}
.subview-back {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: none;
  background: none;
  color: var(--color-primary);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
}
.subview-back svg { width: 22px; height: 22px; }
.subview-title { font-weight: 700; font-size: 16px; }
.subview-body { max-width: 600px; margin: 0 auto; }

/* ----------------- Toast ----------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(16px);
  background: var(--text-primary);
  color: var(--surface);
  padding: 10px 18px;
  border-radius: var(--r-pill);
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-float);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease-spring);
  z-index: 3500;
  max-width: calc(100vw - 32px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ----------------- Лайтбокс ----------------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(0, 0, 0, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.lightbox.open { display: flex; }
.lightbox-stage {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-stage img {
  max-width: 100%;
  max-height: 86vh;
  border-radius: var(--r-md);
  object-fit: contain;
}
.lightbox-close {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top, 0px));
  right: 16px;
  width: 38px;
  height: 38px;
  border-radius: var(--r-pill);
  border: none;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-close svg { width: 20px; height: 20px; }

/* ----------------- Пустые состояния ----------------- */
.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 24px;
}
.empty-state svg { width: 40px; height: 40px; margin-bottom: 12px; color: var(--text-muted); opacity: 0.7; }
.empty-title { font-size: 16px; font-weight: 700; color: var(--text-secondary); margin-bottom: 6px; }
.empty-sub { font-size: 13px; line-height: 1.5; max-width: 320px; margin: 0 auto; }
.empty-mini { color: var(--text-muted); font-size: 13px; padding: 6px 2px; }
