/* Modern Inventory Management System Styles - Enhanced Color Scheme */

:root {
  /* Color Palette - Elegant Deep Blue & Slate Theme */
  --primary-color: #3a86ff;
  --primary-hover: #2667cc;
  --primary-light: #e6f0ff;
  --secondary-color: #6c757d;
  --secondary-hover: #5a6268;
  --accent-color: #ff9f1c;
  --accent-hover: #e68a19;
  
  /* Background Colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #e9ecef;
  --bg-dark: #212529;
  
  /* Text Colors */
  --text-primary: #343a40;
  --text-secondary: #495057;
  --text-muted: #868e96;
  --text-white: #ffffff;
  
  /* Status Colors */
  --success-color: #28a745;
  --success-light: #d4edda;
  --warning-color: #ffc107;
  --warning-light: #fff3cd;
  --danger-color: #dc3545;
  --danger-light: #f8d7da;
  --info-color: #17a2b8;
  --info-light: #d1ecf1;
  
  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.12), 0 10px 10px rgba(0, 0, 0, 0.06);
  
  /* Border Radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-xl: 0.75rem;
  
  /* Transitions */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Menu/UI variables (used by flyout menu & badges) */
  --panel-bg: var(--bg-primary);
  --border: rgba(0,0,0,0.08);
  --text: var(--text-primary);
  --muted: var(--text-muted);
  --primary: var(--primary-color);
  --primary-2: var(--primary-hover);
  --accent: var(--accent-color);
  --danger: var(--danger-color);
  --warn: var(--warning-color);
  --info: var(--info-color);

  /* Used by header gradient (2nd color stop). Themes override for stronger distinction */
  --header-gradient-to: #2a75ff;
}

/* ==============================
   Theme overrides (data-theme)
   ============================== */

html[data-theme="ocean"] {
  /* холодный океан */
  --primary-color: #0077ff;
  --header-gradient-to: #00c2ff;
  --primary-hover: #005fd1;
  --primary-light: #e3f2ff;
  --accent-color: #00d4a6;
  --accent-hover: #00b38b;
  --bg-primary: #f7fcff;
  --bg-secondary: #eef7ff;
}

html[data-theme="forest"] {
  --primary-color: #2f9e44;
  --header-gradient-to: #84cc16;
  --primary-hover: #2b8a3e;
  --primary-light: #e6fcf5;
  --accent-color: #ffd43b;
  --accent-hover: #fcc419;
}

html[data-theme="grape"] {
  --primary-color: #7b2cbf;
  --header-gradient-to: #c026d3;
  --primary-hover: #5a189a;
  --primary-light: #f3e8ff;
  --accent-color: #ff4d6d;
  --accent-hover: #e5383b;
}

html[data-theme="summer"] {
  --primary-color: #ff6b35;
  --header-gradient-to: #ffb703;
  --primary-hover: #e85d2a;
  --primary-light: #fff1e9;
  --accent-color: #2ec4b6;
  --accent-hover: #26a69a;
  --bg-primary: #fffdf8;
  --bg-secondary: #fff6e6;
}

html[data-theme="winter"] {
  --primary-color: #2d6cdf;
  --header-gradient-to: #7dd3fc;
  --primary-hover: #2458b5;
  --primary-light: #e9f2ff;
  --accent-color: #38bdf8;
  --accent-hover: #0ea5e9;
  --bg-primary: #fbfdff;
  --bg-secondary: #eef6ff;
}

html[data-theme="autumn"] {
  --primary-color: #d97706;      /* amber */
  --header-gradient-to: #f97316;  /* orange */
  --primary-hover: #b45309;
  --primary-light: #fff7ed;
  --accent-color: #16a34a;        /* green */
  --accent-hover: #15803d;
  --bg-primary: #fffaf3;
  --bg-secondary: #fff3e0;
}

/* ===== 15 themes pack (light, high-contrast) ===== */
html[data-theme="aurora"]{
  --primary-color:#06b6d4;
  --header-gradient-to:#a78bfa;
  --primary-hover:#0891b2;
  --primary-light:#d9fbff;
  --accent-color:#22c55e;
  --accent-hover:#16a34a;
  --bg-primary:#f7fffe;
  --bg-secondary:#effcff;
}
html[data-theme="sakura"]{
  --primary-color:#ec4899;
  --header-gradient-to:#fb7185;
  --primary-hover:#db2777;
  --primary-light:#ffe4f1;
  --accent-color:#8b5cf6;
  --accent-hover:#7c3aed;
  --bg-primary:#fff7fb;
  --bg-secondary:#ffeef6;
}
html[data-theme="desert"]{
  --primary-color:#f59e0b;
  --header-gradient-to:#fb7185;
  --primary-hover:#d97706;
  --primary-light:#fff3d8;
  --accent-color:#0ea5e9;
  --accent-hover:#0284c7;
  --bg-primary:#fffaf0;
  --bg-secondary:#fff2d6;
}
html[data-theme="coffee"]{
  --primary-color:#a16207;
  --header-gradient-to:#f59e0b;
  --primary-hover:#854d0e;
  --primary-light:#fff2d9;
  --accent-color:#06b6d4;
  --accent-hover:#0891b2;
  --bg-primary:#fffaf5;
  --bg-secondary:#fff1e6;
}
html[data-theme="emerald"]{
  --primary-color:#16a34a;
  --header-gradient-to:#22c55e;
  --primary-hover:#15803d;
  --primary-light:#eafff2;
  --accent-color:#0ea5e9;
  --accent-hover:#0284c7;
  --bg-primary:#fbfffc;
  --bg-secondary:#f1fff7;
}
html[data-theme="lavender"]{
  --primary-color:#7c3aed;
  --header-gradient-to:#60a5fa;
  --primary-hover:#6d28d9;
  --primary-light:#f3e8ff;
  --accent-color:#ec4899;
  --accent-hover:#db2777;
  --bg-primary:#fbf8ff;
  --bg-secondary:#f3eeff;
}
html[data-theme="citrus"]{
  --primary-color:#84cc16;
  --header-gradient-to:#fbbf24;
  --primary-hover:#65a30d;
  --primary-light:#f2ffd9;
  --accent-color:#06b6d4;
  --accent-hover:#0891b2;
  --bg-primary:#fcfff7;
  --bg-secondary:#f4ffe7;
}
html[data-theme="peach"]{
  --primary-color:#fb7185;
  --header-gradient-to:#f59e0b;
  --primary-hover:#f43f5e;
  --primary-light:#ffe5ea;
  --accent-color:#22c55e;
  --accent-hover:#16a34a;
  --bg-primary:#fff9f7;
  --bg-secondary:#fff0ea;
}
html[data-theme="ruby"]{
  --primary-color:#ef4444;
  --header-gradient-to:#a78bfa;
  --primary-hover:#dc2626;
  --primary-light:#ffe3e3;
  --accent-color:#0ea5e9;
  --accent-hover:#0284c7;
  --bg-primary:#fff7f7;
  --bg-secondary:#ffecec;
}
html[data-theme="sky"]{
  --primary-color:#3b82f6;
  --header-gradient-to:#22c55e;
  --primary-hover:#2563eb;
  --primary-light:#e6f0ff;
  --accent-color:#f59e0b;
  --accent-hover:#d97706;
  --bg-primary:#f7fbff;
  --bg-secondary:#edf5ff;
}
html[data-theme="candy"]{
  --primary-color:#f472b6;
  --header-gradient-to:#60a5fa;
  --primary-hover:#ec4899;
  --primary-light:#ffe4f1;
  --accent-color:#22c55e;
  --accent-hover:#16a34a;
  --bg-primary:#fff7fc;
  --bg-secondary:#ffeefa;
}
html[data-theme="steel"]{
  --primary-color:#0f172a;
  --header-gradient-to:#60a5fa;
  --primary-hover:#111827;
  --primary-light:#e8eefc;
  --accent-color:#06b6d4;
  --accent-hover:#0891b2;
  --bg-primary:#f8fafc;
  --bg-secondary:#eef2f7;
}
html[data-theme="mono"]{
  --primary-color:#111827;
  --header-gradient-to:#6b7280;
  --primary-hover:#0b1220;
  --primary-light:#eef2f7;
  --accent-color:#2563eb;
  --accent-hover:#1d4ed8;
  --bg-primary:#ffffff;
  --bg-secondary:#f3f4f6;
}

/* Snow effect (enabled only for winter theme via JS by adding .snow-on to body) */
body.snow-on .snow-layer {
  display: block;
}

.snow-layer {
  display: none;
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 99997; /* below dropdowns but above content */
  overflow: hidden;
}

.snowflake {
  position: absolute;
  top: -10px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,.85);
  filter: blur(.2px);
  opacity: .9;
  animation-name: snow-fall;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

@keyframes snow-fall {
  0% { transform: translateY(-10px); }
  100% { transform: translateY(calc(100vh + 20px)); }
}

/* ===== Autumn leaves effect (enabled by body.leaves-on) ===== */
#leaves{
  display:none;
  position: fixed;
  inset: 0;
  pointer-events:none;
  z-index: 99996; /* below dropdowns, above content */
  overflow: hidden;
  text-align: right;
}
body.leaves-on #leaves{ display:block; }

body.leaves-on #leaves i{
  position: absolute;
  top: -40px;
  right: -40px;
  display: inline-block;
  width: 30px;
  height: 23px;
  background: linear-gradient(to bottom right, #309900, #005600);
  transform: skew(20deg) rotate(180deg);
  border-radius: 5% 40% 70%;
  box-shadow: inset 0px 0px 1px rgba(0,0,0,.35);
  border: 1px solid rgba(0,0,0,.25);
  opacity: .55;
  animation: falling 6s ease-in-out infinite;
}

body.leaves-on #leaves i:before{
  position: absolute;
  content: '';
  top: 17px;
  right: 1px;
  height: 5px;
  width: 7px;
  transform: rotate(49deg);
  border-radius: 0% 15% 15% 0%;
  border-top: 1px solid rgba(0,0,0,.25);
  border-bottom: 1px solid rgba(0,0,0,.25);
  border-right: 1px solid rgba(0,0,0,.25);
  background: linear-gradient(to right, rgba(0,100,0,1), #005600);
}

body.leaves-on #leaves i:after{
  content: '';
  height: 17px;
  width: 2px;
  background: linear-gradient(to right, rgba(0,0,0,.15), rgba(0,0,0,0));
  display: block;
  transform: rotate(125deg);
  position: absolute;
  left: 12px;
  top: 0px;
  border-radius:50%;
}

body.leaves-on #leaves i:nth-of-type(2n){ animation-name: falling2; opacity:.45; }
body.leaves-on #leaves i:nth-of-type(3n){ animation-name: falling3; opacity:.35; }

body.leaves-on #leaves i:nth-of-type(2n+2){ background: linear-gradient(to bottom right, #5e9900, #2b5600); }
body.leaves-on #leaves i:nth-of-type(4n+1){ background: linear-gradient(to bottom right, #990, #564500); }

@keyframes falling {
  0%   { transform: translate3d(20vw,0,0) rotate(0deg) skew(20deg); }
  100% { transform: translate3d(-80vw,110vh,0) rotate(90deg) skew(20deg); opacity: 0; }
}
@keyframes falling2 {
  0%   { transform: translate3d(10vw,0,0) rotate(90deg) skew(20deg); }
  100% { transform: translate3d(-90vw,105vh,0) rotate(0deg) skew(20deg); opacity: 0; }
}
@keyframes falling3 {
  0%   { transform: translate3d(5vw,0,0) rotate(-20deg) skew(20deg); }
  100% { transform: translate3d(-70vw,100vh,0) rotate(-70deg) skew(20deg); opacity: 0; }
}


html[data-theme="dark"] {
  --bg-primary: #121417;
  --bg-secondary: #0f1113;
  --bg-tertiary: #1b1f24;
  --text-primary: #e9ecef;
  --text-secondary: #ced4da;
  --text-muted: #adb5bd;

  --primary-color: #4dabf7;
  --primary-hover: #339af0;
  --primary-light: rgba(77, 171, 247, 0.15);
  --accent-color: #ffa94d;
  --accent-hover: #ff922b;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 10px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.55);
}

/* Dark variants (readable: dark bg + light text) */
html[data-theme="dark_ocean"] {
  --bg-primary: #0f141a;
  --bg-secondary: #0b1015;
  --bg-tertiary: #151d26;
  --text-primary: #eef2f6;
  --text-secondary: #d7dde5;
  --text-muted: #aeb7c2;

  --primary-color: #4cc9f0;
  --primary-hover: #2fb7e5;
  --primary-light: rgba(76, 201, 240, 0.14);
  --accent-color: #f9c74f;
  --accent-hover: #f6b93b;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.40);
  --shadow-md: 0 4px 10px rgba(0, 0, 0, 0.50);
  --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.60);
}

html[data-theme="dark_emerald"] {
  --bg-primary: #101615;
  --bg-secondary: #0b100f;
  --bg-tertiary: #17211f;
  --text-primary: #eef6f4;
  --text-secondary: #d4e3df;
  --text-muted: #a8bbb5;

  --primary-color: #2dd4bf;
  --primary-hover: #22c1ae;
  --primary-light: rgba(45, 212, 191, 0.14);
  --accent-color: #60a5fa;
  --accent-hover: #3b82f6;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.40);
  --shadow-md: 0 4px 10px rgba(0, 0, 0, 0.50);
  --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.60);
}

/* ===== Dark theme readability fixes =====
   Light borders like rgba(0,0,0,.05) become invisible on dark backgrounds.
   These overrides improve contrast for cards/tables/forms and make dropdown
   menus readable in dark themes.
*/
html[data-theme^="dark"] {
  --border-soft: rgba(255,255,255,0.10);
  --border-soft-2: rgba(255,255,255,0.14);
  --surface-hover: rgba(255,255,255,0.04);
}

html[data-theme^="dark"] .card-modern,
html[data-theme^="dark"] .form-modern,
html[data-theme^="dark"] .table-modern {
  border-color: var(--border-soft) !important;
}

html[data-theme^="dark"] .card-header,
html[data-theme^="dark"] .table-modern th {
  border-bottom-color: var(--border-soft) !important;
}

html[data-theme^="dark"] .table-modern td {
  border-bottom-color: rgba(255,255,255,0.08) !important;
}

html[data-theme^="dark"] .table-modern tbody tr:hover {
  background: var(--surface-hover) !important;
}

html[data-theme^="dark"] .form-control-modern,
html[data-theme^="dark"] input,
html[data-theme^="dark"] textarea,
html[data-theme^="dark"] select {
  border-color: var(--border-soft) !important;
  background: rgba(255,255,255,0.03) !important;
  color: var(--text-primary) !important;
}

html[data-theme^="dark"] .form-control-modern::placeholder,
html[data-theme^="dark"] input::placeholder,
html[data-theme^="dark"] textarea::placeholder {
  color: rgba(255,255,255,0.55) !important;
}

/* Select arrow should be light on dark */
html[data-theme^="dark"] .form-select-modern {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23e9ecef' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e") !important;
}

/* Dropdowns (menu + theme picker) */
html[data-theme^="dark"] .dropdown-menu {
  background: var(--bg-primary) !important;
  border: 1px solid var(--border-soft) !important;
  box-shadow: var(--shadow-lg) !important;
}

html[data-theme^="dark"] .dropdown-item {
  color: var(--text-primary) !important;
}

html[data-theme^="dark"] .dropdown-item:hover,
html[data-theme^="dark"] .dropdown-item:focus {
  background: rgba(255,255,255,0.06) !important;
  color: var(--text-primary) !important;
}

html[data-theme^="dark"] .dropdown-header {
  color: rgba(255,255,255,0.70) !important;
}

html[data-theme^="dark"] .dropdown-divider {
  border-top-color: rgba(255,255,255,0.10) !important;
}

/* Bootstrap text utility fixes for dark themes */
html[data-theme^="dark"] .text-muted{ color: var(--text-muted) !important; }
html[data-theme^="dark"] .text-secondary{ color: var(--text-secondary) !important; }
html[data-theme^="dark"] .text-dark{ color: var(--text-primary) !important; }

/* Flyout submenus in quick menu */
html[data-theme^="dark"] .menu-flyout > .flyout-menu {
  background: var(--bg-primary) !important;
  border: 1px solid var(--border-soft) !important;
}

html[data-theme^="dark"] .nav-quick-menu{
  background: var(--bg-primary) !important;
  border: 1px solid var(--border-soft) !important;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 14px;
  min-height: 100vh;
}

.container-wider {
  max-width: 100%;
  width: 100%;
  padding-left: 2rem;
  padding-right: 2rem;
}

/* Header Styles */
.header-modern {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--header-gradient-to) 100%);
  color: var(--text-white);
  padding: 1.75rem 0;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.header-modern::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.15)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
  opacity: 0.4;
}

.header-modern .container {
  position: relative;
  z-index: 1;
}

.header-modern h1 {
  font-size: 2.25rem;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  letter-spacing: -0.025em;
}

.header-modern h1 i {
  font-size: 1.75rem;
  opacity: 0.9;
}

/* Navigation Bar */
.nav-bar {
  background: var(--bg-primary);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  padding: 1rem 0;
  box-shadow: var(--shadow-sm);
}

.nav-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.user-badge {
  background: var(--primary-light);
  color: var(--primary-color);
  padding: 0.375rem 0.875rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(58, 134, 255, 0.2);
}

.nav-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
  flex: 1;
}

.nav-actions-left,
.nav-actions-right {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.nav-actions-spacer {
  flex: 1;
}

.theme-switcher {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(0,0,0,0.06);
}

html[data-theme="dark"] .theme-switcher {
  border-color: rgba(255,255,255,0.10);
}

.theme-select {
  min-width: 120px;
  border-radius: var(--radius-md);
}

/* Modern Button Styles */
.btn-modern {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.btn-modern:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-modern:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color) 0%, #2a75ff 100%);
  color: var(--text-white);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-hover) 0%, #1f5fd0 100%);
  color: var(--text-white);
}

.btn-secondary {
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: none;
}

.btn-secondary:hover {
  background: var(--bg-secondary);
  border-color: rgba(0, 0, 0, 0.15);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.btn-success {
  /* tie to theme accent so buttons clearly change with theme */
  background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-hover) 100%);
  color: var(--text-white);
}

.btn-warning {
  background: linear-gradient(135deg, var(--warning-color) 0%, #e0a800 100%);
  color: var(--text-primary);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger-color) 0%, #c82333 100%);
  color: var(--text-white);
}

.btn-info {
  /* use primary palette */
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
  color: var(--text-white);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
}

/* ==============================
   Theme-aware outline buttons (bootstrap-like)
   Used for toggles where default Bootstrap blue looked чужеродно и плохо читалось в темах.
   ============================== */
.btn-theme-outline{
  --_c: var(--primary-color);
  --_bg: transparent;
  background: var(--_bg);
  border: 1px solid var(--_c);
  color: var(--_c);
}
.btn-theme-outline:hover{
  background: var(--primary-light);
  border-color: var(--primary-hover);
  color: var(--primary-hover);
}
.btn-theme-outline:active{
  transform: translateY(0);
}
.btn-check:checked + .btn-theme-outline,
.btn-theme-outline.active{
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: var(--text-white);
}
.btn-check:focus + .btn-theme-outline,
.btn-theme-outline:focus{
  box-shadow: 0 0 0 .2rem rgba(58,134,255,.25);
}

/* Make small icon buttons match theme too */
.btn-theme-outline.btn-sm{ padding: .25rem .55rem; font-weight: 700; }

/* ==============================
   FAQ tabs / accordion: theme-aware (instead of default blue)
   ============================== */
.nav-pills .nav-link{
  border-radius: 999px;
  background: rgba(0,0,0,0.04);
  color: var(--text-primary);
  border: 1px solid rgba(0,0,0,0.06);
}
html[data-theme^="dark"] .nav-pills .nav-link{
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.92);
}
.nav-pills .nav-link:hover{ opacity: .95; }
.nav-pills .nav-link.active,
.nav-pills .show > .nav-link{
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: var(--text-white);
}

.accordion-button:not(.collapsed){
  background: var(--primary-light);
  color: var(--text-primary);
}
html[data-theme^="dark"] .accordion-button:not(.collapsed){
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.95);
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1rem;
}

/* Bootstrap button overrides so theme affects ALL buttons (including Excel, фильтры и т.д.) */
html[data-theme] .btn.btn-primary{
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--header-gradient-to) 100%) !important;
  border-color: transparent !important;
}
html[data-theme] .btn.btn-outline-primary{
  color: var(--primary-color) !important;
  border-color: rgba(0,0,0,0.14) !important;
}
html[data-theme] .btn.btn-outline-primary:hover{
  background: var(--primary-light) !important;
  color: var(--primary-hover) !important;
}
html[data-theme] .btn.btn-success{
  background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-hover) 100%) !important;
  border-color: transparent !important;
}
html[data-theme] .btn.btn-info{
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%) !important;
  border-color: transparent !important;
}

/* Card Styles */
.card-modern {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(0, 0, 0, 0.05);
  overflow: hidden;
  transition: all var(--transition-normal);
}

.card-modern:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}

.card-header {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  padding: 1.5rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.card-header h3, .card-header h4, .card-header h5 {
  margin: 0;
  color: var(--text-primary);
  font-weight: 700;
}

.card-body {
  padding: 1.5rem;
}

/* Form Styles */
.form-modern {
  background: var(--bg-primary);
  padding: 2rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.form-control-modern {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.form-control-modern:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem rgba(58, 134, 255, 0.25);
}

.form-select-modern {
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
  background-position: right 0.75rem center;
  background-repeat: no-repeat;
  background-size: 16px 12px;
  padding-right: 2.5rem;
}

/* Table Styles */
.table-modern {
  width: 100%;
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.table-modern thead {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
}

.table-modern th {
  padding: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  text-align: left;
  border-bottom: 2px solid rgba(0, 0, 0, 0.05);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.table-modern td {
  padding: 1rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  color: var(--text-primary);
  font-size: 0.875rem;
}

/* Compact tables (used on inventory lists) */
.table-modern.table-compact th,
.table-modern.table-compact td {
  padding: 0.42rem 0.5rem;
  font-size: 0.8rem;
}

.table-modern.table-compact th {
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

/* Consumables with zero stock */
.table-modern tr.stock-zero td {
  background: rgba(220, 53, 69, 0.08) !important;
}
.table-modern tr.stock-zero td:first-child {
  border-left: 3px solid rgba(220, 53, 69, 0.7);
}
.table-modern tr.stock-zero,
.table-modern tr.stock-zero .fw-semibold {
  color: rgba(220, 53, 69, 0.95);
}

/* Make "Место / Кол-во / Стеллаж" columns tighter so the table fits */
#equip-table {
  table-layout: fixed;
}

#equip-table .col-location,
#equip-table .col-qty,
#equip-table .col-rack {
  white-space: nowrap;
}

#equip-table th.col-location,
#equip-table td.col-location {
  width: 86px;
}

#equip-table th.col-qty,
#equip-table td.col-qty {
  width: 64px;
  text-align: center;
}

#equip-table th.col-rack,
#equip-table td.col-rack {
  width: 96px;
}

/* Keep group badge compact */
#equip-table td.col-group .badge {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
}

/* Truncate some wide columns to keep the table within viewport */
#equip-table td.col-comment {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Smaller badges inside compact tables */
.table-modern.table-compact .status-badge {
  padding: 0.25rem 0.5rem;
  font-size: 0.68rem;
  gap: 0.25rem;
}

/* Bulk toolbar */
.bulk-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
  border-radius: 12px;
  background: rgba(58, 134, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(58, 134, 255, 0.18);
}

.bulk-toolbar__badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.65);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06);
  font-size: 0.85rem;
}

.bulk-toolbar__right {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Slightly tighter buttons inside dense tables */
.table-modern.table-compact .btn,
.table-modern.table-compact .btn-modern {
  padding-top: 0.32rem;
  padding-bottom: 0.32rem;
}

.table-modern tbody tr {
  transition: all var(--transition-fast);
}

.table-modern tbody tr:hover {
  background: rgba(58, 134, 255, 0.05);
}

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

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.status-working {
  background: var(--success-light);
  color: var(--success-color);
}

.status-broken {
  background: var(--danger-light);
  color: var(--danger-color);
}

.status-check {
  background: var(--warning-light);
  color: var(--warning-color);
}

.status-warehouse {
  background: var(--info-light);
  color: var(--info-color);
}

.status-station {
  background: var(--warning-light);
  color: var(--warning-color);
}

.status-repair {
  background: var(--danger-light);
  color: var(--danger-color);
}

/* Filter Panel */
.filter-panel {
  background: var(--bg-primary);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(0, 0, 0, 0.05);
  margin-bottom: 2rem;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  align-items: end;
}

/* Alert Styles */
.alert-modern {
  padding: 1rem 1.5rem;
  border-radius: var(--radius-md);
  border: 1px solid;
  margin-bottom: 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  box-shadow: var(--shadow-sm);
}

.alert-info {
  background: var(--info-light);
  border-color: rgba(23, 162, 184, 0.3);
  color: #0c5460;
}

.alert-success {
  background: var(--success-light);
  border-color: rgba(40, 167, 69, 0.3);
  color: #155724;
}

.alert-warning {
  background: var(--warning-light);
  border-color: rgba(255, 193, 7, 0.3);
  color: #856404;
}

.alert-danger {
  background: var(--danger-light);
  border-color: rgba(220, 53, 69, 0.3);
  color: #721c24;
}

/* Loading Spinner */
.spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(58, 134, 255, 0.2);
  border-radius: 50%;
  border-top-color: var(--primary-color);
  animation: spin 1s ease-in-out infinite;
}

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

/* Responsive Design */
@media (max-width: 768px) {
  .header-modern h1 {
    font-size: 1.75rem;
  }
  
  .nav-content {
    flex-direction: column;
    align-items: stretch;
  }
  
  .nav-actions {
    justify-content: flex-start;
  }
  
  .filter-grid {
    grid-template-columns: 1fr;
  }
  
  .table-modern {
    font-size: 0.8125rem;
  }
  
  .table-modern th,
  .table-modern td {
    padding: 0.75rem 0.5rem;
  }
}

/* Mobile: stack navigation buttons (back/forward/dashboard/etc.) one under another */
@media (max-width: 576px) {
  .nav-actions,
  .nav-actions-left,
  .nav-actions-right {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
  .nav-actions-spacer { display:none; }
  .nav-actions a,
  .nav-actions button,
  .nav-actions .btn,
  .nav-actions .btn-modern {
    width: 100%;
    justify-content: center;
  }
}

/*
  ВАЖНО: тёмная тема в проекте отключена.
  На некоторых телефонах включён системный тёмный режим, и браузер может
  автоматически менять цвета через prefers-color-scheme. Мы это отключаем.
*/
html, :root { color-scheme: light; }

/* Animation Classes */
.fade-in {
  animation: fadeIn 0.5s ease-in-out;
}

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

.slide-in {
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.p-0 { padding: 0; }
.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

.d-flex { display: flex; }
.d-block { display: block; }
.d-inline-block { display: inline-block; }
.d-none { display: none; }

.justify-content-center { justify-content: center; }
.justify-content-between { justify-content: space-between; }
.justify-content-end { justify-content: flex-end; }

.align-items-center { align-items: center; }
.align-items-start { align-items: flex-start; }
.align-items-end { align-items: flex-end; }

.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

.w-100 { width: 100%; }
.h-100 { height: 100%; }

.rounded { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }

.shadow { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

/* Footer */
.footer {
  margin-top: 4rem;
  padding: 2rem 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8125rem;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  background: var(--bg-primary);
}
/* Добавьте это в конец файла */
.sortable-header {
  position: relative;
  transition: all var(--transition-fast);
}

.sortable-header:hover {
  background: rgba(58, 134, 255, 0.1) !important;
}

.sortable-header.sorted {
  background: rgba(58, 134, 255, 0.15) !important;
  color: var(--primary-color);
  font-weight: 700;
}

/* Обновите стили .notif-badge в вашем CSS файле */
.notif-badge {
  position: absolute;
  top: -5px; /* Сдвигаем вверх на 5px */
  right: -8px; /* Сдвигаем влево на 8px */
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--danger-color);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
  border: 2px solid var(--bg-primary);
  z-index: 10;
}

/* Для кнопки меньшего размера (btn-sm) */
.btn-sm .notif-badge {
  top: -4px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  font-size: 10px;
}

/* Убираем display: none из .notif-badge.d-none */
.notif-badge.d-none {
  display: none !important;
}


/* Extra status badge helpers */
.status-info { background: var(--info-light); color: var(--info-color); }
.status-warning { background: var(--warning-light); color: var(--warning-color); }
.status-danger { background: var(--danger-light); color: var(--danger-color); }
.status-success { background: var(--success-light); color: var(--success-color); }

.avatar-circle { border-radius: 999px; object-fit: cover; }


/* ===== Theme flyout in menu ===== */
.menu-flyout{ position: relative; }
.menu-flyout > a{ cursor: pointer; }
.menu-flyout .flyout-menu{
  position: absolute;
  top: 0;
  left: 100%;
  margin-left: .25rem;
  min-width: 220px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: .35rem;
  box-shadow: 0 12px 30px rgba(0,0,0,.12);
  opacity: 0;
  transform: translateX(-8px);
  pointer-events: none;
  transition: opacity .15s ease, transform .15s ease;
  z-index: 100000;
}
.menu-flyout:hover .flyout-menu,
.menu-flyout:focus-within .flyout-menu{
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}
.flyout-menu li{ list-style: none; }
.flyout-menu .dropdown-item{ border-radius: 10px; }

/* Mobile: flyouts open DOWN inside the same dropdown (no right overflow) */
@media (max-width: 768px){
  .menu-flyout .flyout-menu{
    position: static;
    left: auto;
    top: auto;
    margin: .25rem 0 0 0;
    min-width: 100%;
    box-shadow: none;
    transform: none;
    opacity: 1;
    pointer-events: auto;
    display: none;
  }
  .menu-flyout:hover .flyout-menu,
  .menu-flyout:focus-within .flyout-menu{ display: none; }
  .menu-flyout.open-mobile > .flyout-menu{ display: block; }
}


/* ===== Additional themes (strong contrast) ===== */
html[data-theme="spring"]{
  /* весна */
  --primary-color: #22c55e;
  --header-gradient-to: #a3e635;
  --primary-hover: #16a34a;
  --primary-light: #eafff2;
  --accent-color: #ff6aa2;
  --accent-hover: #e2558a;
  --bg-primary: #fbfffc;
  --bg-secondary: #f1fff7;
}

html[data-theme="autumn"]{
  /* осень */
  --primary-color: #f97316;
  --header-gradient-to: #facc15;
  --primary-hover: #ea580c;
  --primary-light: #fff0e6;
  --accent-color: #8b5cf6;
  --accent-hover: #7c3aed;
  --bg-primary: #fffaf5;
  --bg-secondary: #fff1e6;
}

html[data-theme="sunset"]{
  /* новая яркая тема */
  --primary-color: #ec4899;
  --header-gradient-to: #fb7185;
  --primary-hover: #db2777;
  --primary-light: #ffe4f1;
  --accent-color: #06b6d4;
  --accent-hover: #0891b2;
  --bg-primary: #fff7fb;
  --bg-secondary: #ffeef7;
}


/* ===== Menu NEW badge (circle) ===== */
.menu-badge{
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ff3b30;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 3px 8px rgba(0,0,0,.20);
  border: 2px solid var(--panel-bg, #fff);
}

/* ===== Requests bell with numeric badge (for menu items) ===== */
.menu-bell-with-count{
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 12px;
  background: rgba(0,0,0,.04);
  color: var(--text-color, #1f2937);
}
html[data-theme="dark"] .menu-bell-with-count{
  background: rgba(255,255,255,.06);
}
.menu-bell-with-count .menu-badge{
  position: absolute;
  top: -6px;
  right: -6px;
  transform: translate(0,0);
}

/* ===== Menu bell badge (for group indicators like "Склад") ===== */
.menu-bell{
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 10px;
  background: rgba(255, 59, 48, .12);
  color: #ff3b30;
  border: 1px solid rgba(255, 59, 48, .25);
}
.menu-bell i{ font-size: 14px; }
.menu-bell-count{
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: #ff3b30;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--panel-bg, #fff);
  line-height: 1;
}

/* ===== Status pill (stations responsibility etc.) ===== */
.status-pill{
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .28rem .55rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
  line-height: 1;
  border: 1px solid rgba(0,0,0,.06);
  white-space: nowrap;
}
.status-pill i{ font-size: 14px; }
.status-accepted{ background: rgba(25,135,84,.12); color: #198754; }
.status-pending{  background: rgba(255,193,7,.16); color: #b78103; }
.status-idle{     background: rgba(220,53,69,.10); color: #dc3545; }
.status-neutral{  background: rgba(108,117,125,.12); color: #6c757d; }

/* ===== Quick menu should be solid and above tables ===== */
.nav-quick-menu{
  background: var(--panel-bg) !important;
  backdrop-filter: none !important;
  opacity: 1 !important;
  z-index: 20000 !important;
}
.header-modern .dropdown{ position: relative; z-index: 20000; }

/* IMPORTANT: flyout visibility is controlled by .menu-flyout:hover (do NOT force opacity here) */
.flyout-menu{ background: var(--panel-bg) !important; }

/* ===== Force solid dropdown backgrounds (no transparency) ===== */
.dropdown-menu.nav-quick-menu{ background-color: var(--panel-bg, #fff) !important; --bs-dropdown-bg: var(--panel-bg, #fff) !important; opacity: 1 !important; backdrop-filter: none !important; }
.dropdown-menu.nav-quick-menu *{ backdrop-filter: none !important; }
.flyout-menu{ background-color: var(--panel-bg, #fff) !important; --bs-dropdown-bg: var(--panel-bg, #fff) !important; }
.menu-flyout, .nav-quick-menu{ overflow: visible !important; }

/* ===== Modals: keep header above, dialogs under header ===== */
.header-modern{ position: sticky; top: 0; z-index: 300000 !important; }
.modal-backdrop{ z-index: 250000 !important; }
.modal{ z-index: 260000 !important; padding-top: 84px !important; }

/* ===== Responsive header action buttons ===== */
@media (max-width: 576px){
  /* Export/Back, Read all/Dashboard, etc. */
  .page-actions{
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100%;
  }
  .page-actions > *{ width: 100% !important; }
  .page-actions .btn-modern{ width: 100% !important; justify-content: center; }
  .page-actions form{ width: 100% !important; }
  .page-actions form .btn-modern{ width: 100% !important; }
}

/* =========================
   Scroll-to-top button
   ========================= */
.scroll-top-btn{
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.08);
  background: var(--bg-primary);
  color: var(--text-primary);
  box-shadow: var(--shadow-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  z-index: 99999;
}
.scroll-top-btn:hover{
  transform: translateY(6px);
}
.scroll-top-btn.show{
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.scroll-top-btn i{
  font-size: 1.15rem;
}
