/* ==========================================================================
   DM STOCK — ПРЕМИАЛЬНЫЙ СТРОГИЙ МИНИМАЛИЗМ С АКЦЕНТАМИ ИЗ НЕРЖАВЕЮЩЕЙ СТАЛИ
   ========================================================================== */

:root {
  /* Базовая тёмная палитра (глубокий обсидиан, графит и титан) */
  --bg-primary: #0a0b0e;
  --bg-secondary: #101216;
  --bg-card: #15181d;
  --bg-card-hover: #1a1e24;
  --bg-surface-elevated: #20242b;
  --bg-surface-overlay: rgba(10, 11, 14, 0.82);

  /* Металлические оттенки нержавеющей стали (AISI 304) */
  --steel-100: #ffffff;
  --steel-200: #f1f5f9;
  --steel-300: #e2e8f0;
  --steel-400: #cbd5e1;
  --steel-500: #94a3b8;
  --steel-600: #64748b;
  --steel-700: #475569;
  --steel-800: #334155;
  --steel-900: #1e293b;

  /* Градиенты шлифованной и полированной стали */
  --grad-steel-sheen: linear-gradient(135deg, #a0aab4 0%, #eef2f6 28%, #828e9a 62%, #d8e0e8 100%);
  --grad-steel-plate: linear-gradient(180deg, #242931 0%, #15181d 100%);
  --grad-steel-plate-hover: linear-gradient(180deg, #2d343e 0%, #1c2027 100%);
  --grad-steel-subtle: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%);
  --grad-steel-border: linear-gradient(135deg, rgba(203, 213, 225, 0.45) 0%, rgba(71, 85, 105, 0.2) 50%, rgba(203, 213, 225, 0.3) 100%);
  --grad-mirror-reflection: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);

  /* Цвета состояний и складского статуса */
  --color-success: #2ed573;
  --color-success-bg: rgba(46, 213, 115, 0.12);
  --color-success-border: rgba(46, 213, 115, 0.35);

  --color-warning: #ffa502;
  --color-warning-bg: rgba(255, 165, 2, 0.12);
  --color-warning-border: rgba(255, 165, 2, 0.4);

  --color-danger: #ff4757;
  --color-danger-bg: rgba(255, 71, 87, 0.15);
  --color-danger-border: rgba(255, 71, 87, 0.45);

  --color-reserved: #70a1ff;
  --color-reserved-bg: rgba(112, 161, 255, 0.12);
  --color-reserved-border: rgba(112, 161, 255, 0.35);

  /* Текст и иконки */
  --text-main: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverted: #0a0b0e;

  /* Границы и тени */
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-steel: rgba(203, 213, 225, 0.22);
  --border-steel-bright: rgba(226, 232, 240, 0.45);

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.75);
  --shadow-steel-glow: 0 0 20px rgba(203, 213, 225, 0.15);

  /* Типографика и радиусы */
  --font-sans: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;

  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 9999px;

  /* Touch Targets для условий цеха и работы в перчатках */
  --touch-min: 56px;
  --header-height: 64px;
  --bottom-nav-height: 68px;

  /* Анимации */
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: 0.18s ease;
  --transition-normal: 0.28s var(--ease-spring);
}

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

/* ==========================================================================
   МИНИМАЛИСТИЧНЫЕ СКРОЛЛ-ЛИНЕЙКИ (ТАЧСКРИН: УЛЬТРАТОНКИЕ 3-4px БЕЗ СТРЕЛОК)
   ========================================================================== */

/* WebKit / Chromium (Chrome, Edge, Opera, Safari, Android WebView) */
::-webkit-scrollbar {
  width: 4px !important;
  height: 4px !important;
  background-color: transparent !important;
}

::-webkit-scrollbar-button {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  background: transparent !important;
}

::-webkit-scrollbar-track,
::-webkit-scrollbar-track-piece {
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  margin: 0 !important;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2) !important;
  border-radius: 9999px !important;
  border: none !important;
  min-height: 24px !important;
  min-width: 24px !important;
}

::-webkit-scrollbar-thumb:hover,
::-webkit-scrollbar-thumb:active {
  background: rgba(255, 255, 255, 0.4) !important;
}

::-webkit-scrollbar-corner {
  background: transparent !important;
}

/* Резерв для браузеров без префиксов WebKit (Firefox) */
@supports not selector(::-webkit-scrollbar) {
  * {
    scrollbar-width: thin !important;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent !important;
  }
}

html, body {
  width: 100%;
  min-height: 100%;
  background-color: #0c0e12;
  background-image: radial-gradient(rgba(255, 255, 255, 0.16) 1.2px, transparent 1.2px);
  background-size: 20px 20px;
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  user-select: none;
}

/* Полное скрытие верхней панели, оффлайн-баннера и нижнего меню (строжайший минимализм) */
.app-header,
.offline-banner,
.bottom-nav {
  display: none !important;
}

#app {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 !important;
  justify-content: center;
  align-items: center;
}

/* Основной контейнер экрана - строго центрирован */
.main-content {
  flex: 1;
  width: 100%;
  min-height: 100vh;
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.brand-emblem {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: #0d1017;
  border: 1px solid var(--border-steel-bright);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: var(--shadow-sm), 0 2px 8px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  flex-shrink: 0;
}

.brand-emblem-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: inherit;
  pointer-events: none;
  position: relative;
  z-index: 1;
}

.brand-emblem::after {
  content: '';
  position: absolute;
  top: 0;
  left: -120%;
  width: 65%;
  height: 100%;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.4) 50%, transparent 100%);
  transform: skewX(-25deg);
  animation: metallicShimmer 5s infinite ease-in-out;
  pointer-events: none;
  z-index: 2;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--grad-steel-sheen);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-subtitle {
  font-size: 10px;
  color: var(--steel-500);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

/* Блок профиля пользователя в шапке */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--grad-steel-plate);
  border: 1px solid var(--border-steel);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: var(--transition-fast);
  min-height: 42px;
}

.user-badge:hover, .user-badge:active {
  border-color: var(--border-steel-bright);
  background: var(--grad-steel-plate-hover);
}

.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--steel-300);
  color: var(--text-inverted);
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
}

.user-info {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.user-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.2;
}

.user-role-label {
  font-size: 9px;
  color: var(--steel-500);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--color-success);
  box-shadow: 0 0 8px var(--color-success);
}

.status-dot.offline {
  background-color: var(--color-warning);
  box-shadow: 0 0 8px var(--color-warning);
}

/* --- ОСНОВНОЙ КОНТЕНТ (VIEW CONTAINER) --- */
.main-content {
  flex: 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* --- НИЖНЯЯ НАВИГАЦИЯ (BOTTOM NAV) --- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--bottom-nav-height);
  background: rgba(12, 14, 18, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-steel);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 0 8px;
  max-width: 1200px;
  margin: 0 auto;
}

.nav-item {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--steel-600);
  cursor: pointer;
  transition: var(--transition-fast);
  text-decoration: none;
  padding: 8px 4px;
  position: relative;
}

.nav-item .nav-icon {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  transition: var(--transition-fast);
}

.nav-item .nav-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav-item.active {
  color: var(--steel-200);
}

.nav-item.active .nav-icon {
  stroke: var(--steel-100);
  filter: drop-shadow(0 0 6px rgba(226, 232, 240, 0.6));
  transform: translateY(-2px);
}

.nav-item.active::after {
  content: '';
  position: absolute;
  top: 0;
  left: 30%;
  right: 30%;
  height: 2px;
  background: var(--grad-steel-sheen);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
  border-radius: 2px;
}

.nav-badge {
  position: absolute;
  top: 6px;
  right: calc(50% - 18px);
  background: var(--color-danger);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 1px 5px;
  border-radius: 10px;
  box-shadow: 0 0 8px rgba(255, 71, 87, 0.8);
}

/* Оффлайн баннер */
.offline-banner {
  display: none;
  background: var(--grad-steel-plate);
  border: 1px solid var(--color-warning-border);
  color: var(--color-warning);
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  border-radius: var(--radius-sm);
}

.offline-banner.visible {
  display: flex;
}

/* Тост уведомления */
.toast-container {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + 16px);
  left: 16px;
  right: 16px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 480px;
  margin: 0 auto;
}

.toast {
  pointer-events: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-steel-bright);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-lg), 0 0 20px rgba(0, 0, 0, 0.8);
  animation: slideUpToast 0.3s var(--ease-spring);
  color: var(--text-main);
  backdrop-filter: blur(12px);
}

.toast.success {
  border-left: 4px solid var(--color-success);
}

.toast.warning {
  border-left: 4px solid var(--color-warning);
}

.toast.danger {
  border-left: 4px solid var(--color-danger);
}

.toast.info {
  border-left: 4px solid var(--steel-300);
}

/* Модальные окна */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(8, 9, 12, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-steel-bright);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg), 0 0 30px rgba(0, 0, 0, 0.9);
  transform: translateY(20px) scale(0.98);
  transition: transform var(--transition-normal);
}

.modal-overlay.active .modal-dialog {
  transform: translateY(0) scale(1);
}

.modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-steel);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--grad-steel-plate);
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--grad-steel-sheen);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.modal-close {
  background: none;
  border: none;
  color: var(--steel-500);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}

.modal-close:hover {
  color: var(--steel-200);
  background: rgba(255, 255, 255, 0.08);
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-steel);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: rgba(16, 18, 22, 0.5);
}

/* Keyframes */
@keyframes metallicShimmer {
  0% { left: -120%; }
  35% { left: 140%; }
  100% { left: 140%; }
}

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