/* === Ozon FBO Manager — Premium Dark Theme === */
:root {
  --bg-primary: #0c0e14;
  --bg-secondary: #141821;
  --bg-card: rgba(22, 28, 40, 0.85);
  --bg-glass: rgba(255, 255, 255, 0.04);
  --border-color: rgba(255, 255, 255, 0.07);
  --border-hover: rgba(255, 255, 255, 0.14);

  --text-primary: #e8eaf0;
  --text-secondary: #8b91a5;
  --text-muted: #5a5f72;

  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.25);

  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #f97316;
  --notice: #a855f7;

  --sidebar-width: 220px;
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

body {
  display: flex;
}

/* --- Карточки товаров для модального окна выбора --- */
.product-list-item {
  margin-bottom: 0;
}

.product-list-item > div:hover {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.05);
}

.product-list-item.selected > div {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.1);
  box-shadow: 0 0 0 1px var(--accent);
}

.product-image {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.product-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.product-card.selected {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.1);
  box-shadow: 0 0 0 1px var(--accent);
}

.product-info {
  flex: 1;
  min-width: 0;
}

.product-article {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.product-name {
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-stock {
  font-size: 11px;
  color: var(--text-secondary);
}

.product-checkbox {
  position: absolute;
  top: 8px;
  right: 8px;
}

.product-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

.selected-product-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: var(--accent);
  color: white;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
}

.selected-product-tag button {
  color: white;
  font-size: 14px;
  padding: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.2);
}

.selected-product-tag button:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* === Sidebar === */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  flex-shrink: 0;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  margin-bottom: 32px;
}

.logo-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #a855f7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  color: #fff;
}

.logo-text {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.3px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 12px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-glass);
}

.nav-link.active {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 2px 12px var(--accent-glow);
}

.nav-link svg {
  flex-shrink: 0;
}

/* === Main Content === */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  height: 100vh;
  overflow-y: auto;
  padding: 32px 40px;
  position: relative;
}

.page-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 24px;
}

/* === Tabs === */
.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

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

/* === Stats Cards === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  backdrop-filter: blur(12px);
  transition: border-color var(--transition), transform var(--transition);
}

.stat-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 32px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent-hover), var(--notice));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* === Cards === */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 24px;
  backdrop-filter: blur(12px);
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

/* === Low Stock === */
.low-stock-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.low-stock-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-glass);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.low-stock-qty {
  color: var(--danger);
  font-weight: 700;
}

/* === Anomaly Badge === */
.anomaly-badge {
  font-size: 48px;
  font-weight: 800;
  color: var(--warning);
  line-height: 1;
  margin-bottom: 8px;
}

.anomaly-hint {
  color: var(--text-muted);
  font-size: 13px;
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 12px var(--accent-glow);
}
.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-glass);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover {
  background: var(--border-color);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.quick-actions {
  display: flex;
  gap: 12px;
}

.file-btn {
  cursor: pointer;
}

/* === Search & Inputs === */
.search-input, .form-input, .filter-select {
  width: 100%;
  padding: 10px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 13px;
  transition: border-color var(--transition);
  outline: none;
}

.search-input:focus, .form-input:focus, .filter-select:focus {
  border-color: var(--accent);
}

.toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  align-items: center;
}

.toolbar .search-input {
  max-width: 400px;
}

.filter-select {
  width: auto;
  min-width: 200px;
}

/* === Products Grid === */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all var(--transition);
  cursor: pointer;
}

.product-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.product-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: var(--bg-secondary);
}

.product-info {
  padding: 16px;
}

.product-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-secondary);
}

.product-price {
  font-weight: 700;
  color: var(--success);
}

.product-stock {
  background: var(--bg-glass);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}

.placeholder-text {
  color: var(--text-muted);
  text-align: center;
  padding: 60px 20px;
  font-size: 14px;
}

/* === Tables === */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  background: var(--bg-secondary);
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.data-table th:hover {
  color: var(--text-primary);
}

.data-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: var(--bg-glass);
}

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

/* Editable cell */
.editable-cell {
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background var(--transition);
}
.editable-cell:hover {
  background: var(--bg-glass);
}

/* === Warehouse Sections === */
.section-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: var(--bg-secondary);
  padding: 4px;
  border-radius: var(--radius-sm);
  width: fit-content;
}

.section-tab {
  padding: 8px 20px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.section-tab.active {
  background: var(--accent);
  color: #fff;
}

.warehouse-section {
  display: none;
}
.warehouse-section.active {
  display: block;
}

.group-toggle {
  display: flex;
  gap: 4px;
  background: var(--bg-secondary);
  padding: 3px;
  border-radius: 6px;
}

.group-btn {
  padding: 6px 14px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.group-btn.active {
  background: var(--accent);
  color: #fff;
}

/* === Upload Zone === */
.upload-zone {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}

.upload-card {
  flex: 1;
  background: var(--bg-card);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}

.upload-card h4 {
  margin-bottom: 12px;
  font-size: 14px;
  color: var(--text-secondary);
}

.upload-status {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  color: var(--success);
}

/* === Anomalies Block === */
.anomalies-block {
  margin-bottom: 24px;
}

.anomaly-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  font-size: 13px;
  border-left: 4px solid;
}

.anomaly-item.warning { border-left-color: var(--warning); }
.anomaly-item.danger { border-left-color: var(--danger); }
.anomaly-item.info { border-left-color: var(--info); }
.anomaly-item.notice { border-left-color: var(--notice); }

.anomaly-article {
  font-weight: 700;
  min-width: 140px;
}

.anomaly-msg {
  color: var(--text-secondary);
}

/* === Plan Actions === */
.plan-actions {
  margin-top: 20px;
  display: flex;
  gap: 12px;
}

/* === Settings === */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group {
  margin-bottom: 16px;
  position: relative;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.hint-text {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

.settings-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.btn-show-pass {
  position: absolute;
  right: 8px;
  top: 30px;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 11px;
  font-family: var(--font);
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-show-pass:hover {
  color: var(--text-primary);
  border-color: var(--accent);
}

/* Connection Status Bar */
.connection-status-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 13px;
  font-weight: 500;
}

.connection-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
  transition: background 0.3s ease;
}

.connection-dot.connected {
  background: var(--success);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
  animation: pulse-green 2s infinite;
}

.connection-dot.disconnected {
  background: var(--danger);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

.connection-dot.checking {
  background: var(--warning);
  animation: pulse-yellow 1s infinite;
}

@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 4px rgba(34, 197, 94, 0.3); }
  50% { box-shadow: 0 0 12px rgba(34, 197, 94, 0.6); }
}

@keyframes pulse-yellow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.connection-result {
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.6;
  min-height: 0;
  transition: all 0.3s ease;
}

.connection-result.success {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: var(--success);
}

.connection-result.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--danger);
}

.connection-result:empty {
  display: none;
}

/* === Toast === */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
  backdrop-filter: blur(12px);
}

.toast.success { background: rgba(34, 197, 94, 0.9); }
.toast.error { background: rgba(239, 68, 68, 0.9); }
.toast.info { background: rgba(99, 102, 241, 0.9); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

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

/* === Hidden Utility === */
.hidden {
  display: none !important;
}

/* === Liquidity Colors === */
.liq-high { color: var(--success); }
.liq-medium { color: var(--warning); }
.liq-low { color: var(--danger); }

/* === Scrollbar === */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* === Responsive === */
@media (max-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .dashboard-grid, .settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    width: 60px;
  }
  .sidebar .logo-text, .sidebar .nav-link span {
    display: none;
  }
  .main-content {
    margin-left: 60px;
    padding: 20px;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .upload-zone {
    flex-direction: column;
  }
}

/* === Advertising Sections === */
.ad-section {
  display: none;
  animation: fadeIn 0.25s ease;
}
.ad-section.active {
  display: block;
}

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