/* assets/css/app.css — mobile-first, Яндекс-стиль */

:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-hover: #f0f2f5;
  --border: #e0e3e8;
  --text: #1a1d21;
  --text-secondary: #6b7280;
  --accent: #fc3f1d;
  --accent-light: rgba(252, 63, 29, 0.12);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --danger-bright: #ff1744;   /* яркий красный для отрицательных балансов */
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --space: 8px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

[data-theme="dark"] {
  --bg: #121212;
  --surface: #1e1e1e;
  --surface-hover: #2a2a2a;
  --border: #333333;
  --text: #e8eaed;
  --text-secondary: #9aa0a6;
  --accent: #ff6b4a;
  --accent-light: rgba(255, 107, 74, 0.15);
  --danger-bright: #ff5252;   /* чуть мягче на тёмном фоне, но всё ещё ярко */
  --shadow: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
  transition: background .3s, color .3s;
}

/* Главный контейнер */
.main-content {
  padding: 16px 16px 96px;
  min-height: 100vh;
  max-width: 1200px;
  margin: 0 auto;
}

/* Заголовки экранов */
.screen-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
}

/* Карточки */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  transition: transform .15s, box-shadow .15s, background .3s;
}
.card:active { transform: scale(0.98); }

/* Карточка клиента */
.client-card {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  animation: cmFadeUp .22s ease both;
}
.client-card__avatar {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--accent);
  font-size: 18px;
  flex: 0 0 auto;
}
.client-card__body { flex: 1; min-width: 0; }
.client-card__name { font-weight: 600; }
.client-card__meta {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.client-card__chevron {
  flex: 0 0 auto;
  color: var(--text-secondary);
}

@keyframes cmFadeUp {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== Отрицательные балансы ===== */

/* Инлайновое красное значение в строках вида «Хостинг: X · Мой: Y» */
.balance-negative {
  color: var(--danger-bright) !important;
  font-weight: 700;
}

/* Блок с отрицательным балансом (на экране клиента) */
.balance-box-negative {
  background: rgba(255, 23, 68, 0.10) !important;
  border: 1px solid rgba(255, 23, 68, 0.35);
}
[data-theme="dark"] .balance-box-negative {
  background: rgba(255, 82, 82, 0.12) !important;
  border: 1px solid rgba(255, 82, 82, 0.4);
}
.balance-box-negative .balance-box__value {
  color: var(--danger-bright) !important;
  font-weight: 700;
}

.balance-box__label {
  font-size: 12px;
  color: var(--text-secondary);
}
.balance-box__value {
  font-weight: 600;
  font-size: 18px;
}

/* ===== Фильтры (pill-кнопки в стиле Яндекс) ===== */

.filter-bar {
  display: flex;
  gap: 8px;
  margin: 0 -16px 16px;
  padding: 4px 16px 8px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.filter-bar::-webkit-scrollbar { display: none; }

.filter-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  min-height: 36px;
  border: none;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  scroll-snap-align: start;
  box-shadow: var(--shadow);
  transition: background .2s ease, color .2s ease, transform .15s ease, box-shadow .2s ease;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

.filter-btn:active { transform: scale(0.96); }

.filter-btn .filter-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  line-height: 1;
  opacity: .85;
}
.filter-btn .filter-icon svg { display: block; }

.filter-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 12px rgba(252, 63, 29, 0.28);
}
.filter-btn.active .filter-icon { opacity: 1; }

@media (hover: hover) {
  .filter-btn:not(.active):hover {
    background: var(--surface-hover);
  }
}

[data-theme="dark"] .filter-btn.active {
  background: var(--accent);
  box-shadow: 0 4px 14px rgba(255, 107, 74, 0.35);
}

@media (min-width: 768px) {
  .filter-bar { margin: 0 0 20px; padding: 4px 0 8px; }
}

/* Кнопки действий */
.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, color .2s, transform .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
}
.btn-primary:active { transform: scale(0.98); }
.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:active { transform: scale(0.98); }

/* Поля ввода */
.input,
input[type="text"],
input[type="search"],
input[type="number"],
input[type="email"],
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* Таб-бар */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 4px 0 max(4px, env(safe-area-inset-bottom));
  z-index: 100;
  transition: background .3s, border-color .3s;
}
.tab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 10px;
  padding: 6px 12px;
  min-width: 64px;
  min-height: 44px;
  cursor: pointer;
  transition: color .2s;
}
.tab-btn.active { color: var(--accent); }
.tab-btn svg { width: 22px; height: 22px; }

/* FAB */
.fab {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  z-index: 99;
  transition: transform .15s, opacity .2s;
}
.fab:active { transform: scale(0.9); }

/* Toast */
.toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--surface);
  color: var(--text);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  animation: toastIn .25s ease;
  pointer-events: auto;
  max-width: 90vw;
}
.toast--success { border-left: 4px solid var(--success); }
.toast--error { border-left: 4px solid var(--danger-bright); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Skeleton */
.skeleton { padding: 16px; }
.skeleton-card {
  height: 88px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--border) 25%, var(--surface) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  margin-bottom: 12px;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Модальное окно / шторка */
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* Чек (рендер 1080px) */
.receipt {
  width: 1080px;
  padding: 48px;
  background: #ffffff;
  color: #1a1d21;
  font-family: system-ui, -apple-system, sans-serif;
  border-radius: 24px;
}
.receipt-header { display: flex; align-items: center; gap: 24px; margin-bottom: 40px; }
.receipt-logo { width: 96px; height: 96px; border-radius: 20px; object-fit: contain; }
.receipt-title { font-size: 36px; font-weight: 700; }
.receipt-body { margin-bottom: 40px; }
.receipt-row {
  display: flex;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid #e0e3e8;
}
.receipt-label { color: #6b7280; font-size: 24px; }
.receipt-value { font-size: 24px; font-weight: 500; }
.receipt-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 24px;
  border-top: 3px solid #1a1d21;
}
.receipt-total-label { font-size: 28px; font-weight: 600; }
.receipt-total { font-size: 48px; font-weight: 700; color: #fc3f1d; }

/* Утилиты */
.hidden { display: none !important; }
.text-secondary { color: var(--text-secondary); }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
}
.badge--warning { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge--danger  { background: rgba(255, 23, 68, 0.15);  color: var(--danger-bright); }

/* Breakpoints */
@media (min-width: 768px) {
  .main-content { padding: 24px 24px 96px; }
}
@media (min-width: 1200px) {
  .main-content { padding: 32px 32px 96px; max-width: 960px; }
}