/* ============================================================
   GasMeter — единый стиль (mobile-first)
   Минималистичный дизайн уровня IT-продукта
   ============================================================ */

:root {
  /* Цвета */
  --color-bg: #FAFAFA;
  --color-surface: #FFFFFF;
  --color-text-primary: #0F172A;
  --color-text-secondary: #64748B;
  --color-border: #E2E8F0;
  --color-accent: #2563EB;
  --color-accent-hover: #1D4ED8;
  --color-success-bg: #ECFDF5;
  --color-success-text: #059669;
  --color-warning-bg: #F8FAFC;
  --color-warning-text: #64748B;
  --color-danger: #DC2626;
  --color-danger-bg: #FEF2F2;

  /* Тени (мягкие, многослойные) */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 6px rgba(15, 23, 42, 0.05), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 25px rgba(15, 23, 42, 0.08), 0 4px 10px rgba(15, 23, 42, 0.03);
  --shadow-card-hover: 0 12px 28px rgba(15, 23, 42, 0.12);

  /* Скругления */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 999px;

  /* Типографика */
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, sans-serif;
  --font-size-xs: 0.8125rem;
  --font-size-sm: 0.9375rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.5rem;
  --font-size-2xl: 2rem;
  --font-size-3xl: 2.75rem;

  /* Отступы (шкала) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --space-16: 64px;
  --space-24: 96px;

  /* Контейнер */
  --container-max: 1200px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--color-text-primary);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  margin: 0 0 0.5rem;
  line-height: 1.2;
  font-weight: 700;
}

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

a {
  color: var(--color-accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding-left: var(--space-6);
  padding-right: var(--space-6);
}

.container-narrow {
  max-width: 640px;
}

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.6rem 1.25rem;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: var(--font-size-base);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  text-decoration: none;
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--color-accent);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--color-accent-hover);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--color-text-secondary);
  border-color: var(--color-border);
}

.btn-outline:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.btn-danger {
  background: transparent;
  color: var(--color-danger);
  border-color: #FECACA;
}

.btn-danger:hover {
  background: var(--color-danger-bg);
  border-color: var(--color-danger);
}

.btn-sm {
  min-height: 38px;
  padding: 0.4rem 0.9rem;
  font-size: var(--font-size-sm);
}

.btn-block {
  width: 100%;
}

/* ---------- Шапка ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
  padding-top: var(--space-4);
  padding-bottom: var(--space-4);
}

.logo {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
  margin-right: auto;
}

.logo:hover {
  text-decoration: none;
}

.header-phones {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  align-items: flex-end;
}

.header-phone {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
}

.header-phone:hover {
  color: var(--color-accent);
  text-decoration: none;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #EFF6FF 0%, #FAFAFA 55%, #FFFFFF 100%);
  padding: var(--space-16) 0 var(--space-24);
}

.hero::before {
  content: "";
  position: absolute;
  top: -140px;
  right: -100px;
  width: 460px;
  height: 460px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.14), transparent 68%);
  filter: blur(40px);
  border-radius: 50%;
  pointer-events: none;
}

.hero-inner {
  position: relative;
}

.hero-title {
  font-size: var(--font-size-3xl);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-4);
  max-width: 720px;
}

.hero-subtitle {
  font-size: var(--font-size-lg);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-8);
  max-width: 560px;
}

/* ---------- Секции ---------- */
.section {
  padding: var(--space-16) 0;
}

.section-title {
  font-size: var(--font-size-2xl);
  text-align: left;
  margin-bottom: var(--space-8);
  letter-spacing: -0.02em;
}

/* ---------- Каталог ---------- */
.catalog-status {
  color: var(--color-text-secondary);
  padding: var(--space-6) 0;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-6);
}

.product-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.product-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-4px);
}

.product-img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #EEF2F7;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.product-img-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
}

.product-body {
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  flex: 1;
}

.product-badges {
  margin-bottom: var(--space-3);
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.7rem;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 600;
}

.badge-instock {
  background: var(--color-success-bg);
  color: var(--color-success-text);
}

.badge-order {
  background: var(--color-warning-bg);
  color: var(--color-warning-text);
}

.product-name {
  font-size: var(--font-size-lg);
  font-weight: 600;
  margin-bottom: var(--space-2);
  line-height: 1.3;
}

.product-card-description {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  line-height: 1.6;
  margin: 0 0 var(--space-4);
}

.product-price {
  display: block;
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--color-text-primary);
  margin-top: auto;
  margin-bottom: var(--space-4);
  letter-spacing: -0.01em;
}

.product-card .btn {
  width: 100%;
}

/* ---------- Заявление о лидерстве ---------- */
.section-alt {
  background: var(--color-bg);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.statement {
  max-width: 700px;
  margin: 0 auto;
  text-align: center;
}

.statement-badge {
  display: inline-block;
  padding: 0.25rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-accent);
  background: #EFF6FF;
  margin-bottom: var(--space-4);
}

.statement-title {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 var(--space-4);
}

.statement-subtitle {
  font-size: var(--font-size-lg);
  line-height: 1.6;
  color: var(--color-text-secondary);
  margin: 0;
}

/* ---------- Форма заявки ---------- */
.lead-intro {
  color: var(--color-text-secondary);
  margin-bottom: var(--space-6);
}

.lead-product-label {
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  color: #1E40AF;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
  font-weight: 600;
  font-size: var(--font-size-sm);
}

.lead-card {
  background: var(--color-surface);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
}

.field {
  margin-bottom: var(--space-4);
}

.field label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 44px;
  padding: 0.65rem 0.85rem;
  font-size: var(--font-size-base);
  font-family: inherit;
  color: var(--color-text-primary);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field textarea {
  resize: vertical;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #94A3B8;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-status {
  margin-top: var(--space-3);
  font-weight: 600;
  font-size: var(--font-size-sm);
}

.form-status.success {
  color: var(--color-success-text);
}

.form-status.error {
  color: var(--color-danger);
}

/* ---------- Футер ---------- */
.site-footer {
  background: var(--color-bg);
  border-top: 1px solid var(--color-border);
  padding: var(--space-12) 0;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

.footer-brand .logo {
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
}

.footer-note {
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  margin: 0;
}

.footer-contacts h4 {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-3);
}

.footer-contacts {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.footer-contacts a {
  color: var(--color-text-primary);
  font-weight: 500;
}

.footer-contacts a:hover {
  color: var(--color-accent);
}

.footer-city {
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  margin: 0;
}

.copyright {
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  margin: 0;
}

/* ---------- Страница товара ---------- */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  font-weight: 600;
  margin-bottom: var(--space-6);
}

.back-link:hover {
  color: var(--color-accent);
}

.product-notfound {
  text-align: center;
  padding: var(--space-16) 0;
}

.product-notfound h1 {
  font-size: var(--font-size-2xl);
  margin-bottom: var(--space-4);
}

.product-notfound p {
  color: var(--color-text-secondary);
  margin-bottom: var(--space-6);
}

.product-detail {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-8);
  align-items: start;
}

.product-detail-img {
  width: 100%;
  border-radius: var(--radius-lg);
  background: #EEF2F7;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.product-detail-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-lg);
  background: #EEF2F7;
  font-size: 6rem;
}

.product-detail-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-4);
}

.product-detail-title {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0;
}

.product-detail-price {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: -0.01em;
}

.product-detail-desc {
  color: var(--color-text-secondary);
  font-size: var(--font-size-base);
  line-height: 1.6;
}

.product-detail-desc p {
  margin: 0 0 var(--space-3);
}

.product-detail-desc p:last-child {
  margin-bottom: 0;
}

.product-detail .btn {
  width: 100%;
}

@media (min-width: 769px) {
  .product-detail {
    grid-template-columns: 1fr 1fr;
  }
}

/* ============================================================
   АДМИН-ПАНЕЛЬ
   ============================================================ */

.admin-body {
  background: var(--color-bg);
}

.admin-login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.admin-login-card {
  width: 100%;
  max-width: 400px;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-8);
}

.admin-login-card h1 {
  font-size: var(--font-size-xl);
  text-align: center;
}

.admin-login-card .login-sub {
  text-align: center;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-6);
  font-size: var(--font-size-sm);
}

.admin-topbar {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.admin-topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-top: var(--space-4);
  padding-bottom: var(--space-4);
  flex-wrap: wrap;
}

.admin-topbar .logo {
  color: var(--color-text-primary);
  margin-right: 0;
}

.admin-user {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin-right: auto;
}

.admin-tabs {
  display: flex;
  gap: var(--space-2);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
}

.admin-tab {
  padding: var(--space-3) var(--space-4);
  min-height: 44px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--color-text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease;
}

.admin-tab:hover {
  color: var(--color-text-primary);
}

.admin-tab.active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

.admin-panel {
  display: none;
  padding: var(--space-6) 0;
}

.admin-panel.active {
  display: block;
}

.admin-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-6);
}

.admin-section-head h2 {
  font-size: var(--font-size-xl);
  margin: 0;
}

/* ---------- Таблицы ---------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-md);
}

.table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

.table th,
.table td {
  padding: var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.table th {
  font-weight: 600;
  color: var(--color-text-secondary);
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.table tr:last-child td {
  border-bottom: none;
}

.table .thumb {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: #EEF2F7;
}

.table .thumb-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  background: #EEF2F7;
  font-size: 1.4rem;
}

.table .actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.price-cell {
  cursor: pointer;
  font-weight: 600;
  display: inline-block;
  min-width: 70px;
}

.price-cell:hover {
  color: var(--color-accent);
}

.price-input {
  width: 120px;
  min-height: 38px;
  padding: 0.35rem 0.6rem;
  font-size: var(--font-size-sm);
  font-family: inherit;
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-sm);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.lead-new td {
  background: #FFFBEB;
}

.status-badge {
  display: inline-block;
  padding: 0.2rem 0.7rem;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 600;
}

.status-new {
  background: var(--color-success-bg);
  color: var(--color-success-text);
}

.status-processed {
  background: #F1F5F9;
  color: var(--color-text-secondary);
}

.empty-row {
  text-align: center;
  color: var(--color-text-secondary);
  padding: var(--space-8) !important;
}

/* ---------- Переключатель ---------- */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch .slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #CBD5E1;
  border-radius: var(--radius-full);
  transition: background 0.2s ease;
}

.switch .slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
}

.switch input:checked + .slider {
  background: var(--color-accent);
}

.switch input:checked + .slider::before {
  transform: translateX(20px);
}

/* ---------- Модальное окно ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: var(--space-4);
  z-index: 100;
  overflow-y: auto;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  width: 100%;
  max-width: 520px;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  margin: auto 0;
  max-height: 90vh;
  overflow-y: auto;
  padding: var(--space-6);
}

.modal h2 {
  font-size: var(--font-size-xl);
  margin-bottom: var(--space-4);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-6);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-text-primary);
  color: #fff;
  padding: 0.7rem 1.2rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: var(--font-size-sm);
  z-index: 200;
  opacity: 0;
  transition: opacity 0.2s ease;
  max-width: 90vw;
}

.toast.show {
  opacity: 1;
}

.toast.error {
  background: var(--color-danger);
}

.toast.success {
  background: var(--color-success-text);
}

/* ============================================================
   Брейкпоинты
   ============================================================ */

/* Планшеты */
@media (min-width: 769px) {
  .footer-inner {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
  }
  .hero-title {
    font-size: var(--font-size-3xl);
  }
}

/* ПК / ноутбуки */
@media (min-width: 1025px) {
  .hero {
    padding: var(--space-24) 0;
  }
}
