/* Базовые сбросы и настройки */
:root {
  --bg-dark: #070913;
  --panel-bg: rgba(17, 22, 44, 0.6);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text-primary: #F3F4F6;
  --text-muted: #9CA3AF;
  --neon-purple: #8B5CF6;
  --neon-purple-glow: rgba(139, 92, 246, 0.4);
  --neon-blue: #06B6D4;
  --neon-blue-glow: rgba(6, 182, 212, 0.4);
  --neon-green: #10B981;
  --neon-green-glow: rgba(16, 185, 129, 0.4);
  --danger: #EF4444;
  --font-main: 'Inter', sans-serif;
  --font-logo: 'Outfit', sans-serif;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-primary);
  font-family: var(--font-main);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  display: flex;
  justify-content: center;
  padding: 40px 20px;
}

/* Фоновые декоративные свечения */
.bg-glow {
  position: fixed;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.15;
  z-index: -1;
  pointer-events: none;
}

.bg-glow-purple {
  background-color: var(--neon-purple);
  top: -100px;
  left: -100px;
}

.bg-glow-blue {
  background-color: var(--neon-blue);
  bottom: -100px;
  right: -100px;
}

/* Контейнер приложения */
.app-container {
  width: 100%;
  max-width: 1100px;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

/* Шапка приложения */
.app-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 20px;
}

.header-top {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.tab-navigation {
  display: flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
}

.tab-btn {
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  padding: 9px 12px;
  font-family: var(--font-main);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.tab-btn.active {
  color: var(--text-primary);
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.22), rgba(139, 92, 246, 0.22));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

@media (max-width: 480px) {
  .header-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .header-actions,
  .tab-navigation,
  .glass-btn {
    width: 100%;
  }

  .tab-btn {
    flex: 1;
    justify-content: center;
  }
}

.logo {
  display: flex;
  align-items: center;
  gap: 15px;
  font-family: var(--font-logo);
}

.logo i {
  font-size: 2.2rem;
}

.logo h1 {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -1px;
}

.neon-text {
  background: linear-gradient(135deg, var(--neon-blue), var(--neon-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 10px var(--neon-blue-glow));
}

.subtitle {
  color: var(--text-muted);
  font-size: 1.1rem;
  font-weight: 400;
}

/* Статус-бар подключений */
.status-bar {
  display: flex;
  gap: 15px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.status-badge {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
}

.status-badge i {
  font-size: 0.7rem;
}

.status-badge.active {
  color: var(--text-primary);
  border-color: rgba(16, 185, 129, 0.3);
}

.status-badge.active i {
  color: var(--neon-green);
  text-shadow: 0 0 8px var(--neon-green-glow);
}

.status-badge.inactive {
  border-color: rgba(239, 68, 68, 0.3);
}

.status-badge.inactive i {
  color: var(--danger);
}

.status-action {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  color: var(--text-primary);
  padding: 7px 14px;
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  transition: var(--transition);
}

.status-action:disabled {
  cursor: default;
}

.status-idle {
  color: var(--text-muted);
}

.status-running {
  border-color: rgba(6, 182, 212, 0.38);
  color: var(--text-primary);
}

.status-running i {
  color: var(--neon-blue);
}

.status-success {
  border-color: rgba(16, 185, 129, 0.38);
}

.status-success i {
  color: var(--neon-green);
}

.status-error,
.status-canceled {
  border-color: rgba(239, 68, 68, 0.38);
}

.status-error i,
.status-canceled i {
  color: var(--danger);
}

.cancel-action {
  cursor: pointer;
  border-color: rgba(239, 68, 68, 0.35);
  color: var(--text-primary);
}

.cancel-action:hover {
  background: rgba(239, 68, 68, 0.12);
}

/* Кнопка в стиле Glassmorphism */
.glass-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  color: var(--text-primary);
  padding: 10px 16px;
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.glass-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.05);
}

.glass-btn:active {
  transform: translateY(1px);
}

/* Эффект матового стекла (Glassmorphism Panel) */
.glass-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 30px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: hidden;
}

.glass-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
}

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

.section-title i {
  color: var(--neon-blue);
  font-size: 1.2rem;
}

.section-title h2 {
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -0.5px;
}

.panel-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 25px;
}

/* Форма авторизации */
.auth-panel {
  max-width: 550px;
  margin: 40px auto;
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Рабочая зона Dashboard */
.dashboard-layout {
  display: flex;
  flex-direction: column;
  gap: 30px;
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.tab-content {
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Формы и поля ввода */
.search-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.search-fields-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

@media (max-width: 768px) {
  .search-fields-grid {
    grid-template-columns: 1fr;
  }
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.input-group label i {
  color: var(--neon-purple);
}

.styled-select, input[type="text"], input[type="password"] {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 14px 16px;
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition);
}

.styled-select:focus, input[type="text"]:focus, input[type="password"]:focus {
  border-color: var(--neon-blue);
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.15);
  background: rgba(255, 255, 255, 0.08);
}

.styled-select option {
  background-color: #0F1322;
  color: var(--text-primary);
}

.styled-select:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* Настройки сопоставления */
.settings-section {
  display: flex;
  flex-direction: column;
}

.mapping-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.mapping-grid {
  display: grid;
  gap: 12px;
}

.mapping-row {
  display: grid;
  grid-template-columns: minmax(220px, 0.85fr) minmax(260px, 1.15fr);
  gap: 18px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
}

.mapping-field-info {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.mapping-field-title {
  color: var(--text-primary);
  font-weight: 700;
  font-size: 0.95rem;
}

.mapping-field-desc {
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.mapping-select {
  width: 100%;
}

.btn-save-mapping {
  align-self: flex-end;
  min-width: 280px;
}

@media (max-width: 720px) {
  .mapping-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .btn-save-mapping {
    align-self: stretch;
    min-width: 0;
  }
}

/* Кнопки с неоновым свечением */
.neon-btn {
  background: linear-gradient(135deg, var(--neon-blue), var(--neon-purple));
  border: none;
  border-radius: 10px;
  color: white;
  padding: 16px 28px;
  font-family: var(--font-main);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.25);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.neon-btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: -50%;
  width: 200%;
  height: 100%;
  background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.15), transparent);
  transform: skewX(-25deg);
  transition: 0.75s ease;
}

.neon-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(6, 182, 212, 0.4);
}

.neon-btn:hover::after {
  left: 125%;
}

.neon-btn:active {
  transform: translateY(1px);
}

.neon-btn.disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.spinner {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hidden {
  display: none !important;
}

/* Скелетон загрузки */
.skeleton-panel {
  padding: 40px;
}

.skeleton-layout {
  display: flex;
  gap: 40px;
}

@media (max-width: 768px) {
  .skeleton-layout {
    flex-direction: column;
  }
}

.skeleton-image {
  width: 320px;
  height: 320px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
}

.skeleton-details {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 15px;
  justify-content: center;
}

.skeleton-title {
  height: 32px;
  width: 60%;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
}

.skeleton-text {
  height: 16px;
  width: 90%;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
}

.skeleton-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-top: 15px;
}

.skeleton-box {
  height: 60px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

/* Сияющий эффект скелетона */
.loading-shine {
  position: relative;
  overflow: hidden;
}

.loading-shine::after {
  content: '';
  position: absolute;
  top: 0;
  left: -150%;
  width: 300%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.04), transparent);
  animation: shine 1.5s infinite;
}

@keyframes shine {
  0% { left: -150%; }
  100% { left: 150%; }
}

/* Карточка товара (Предпросмотр) */
.product-card {
  display: flex;
  gap: 40px;
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@media (max-width: 768px) {
  .product-card {
    flex-direction: column;
    gap: 30px;
  }
}

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

.product-media {
  width: 320px;
  height: 320px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.2);
}

.product-media img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.5s ease;
}

.product-media:hover img {
  transform: scale(1.05);
}

.product-media-fallback {
  font-size: 4rem;
  color: rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.product-media-fallback span {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.product-info {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.product-meta-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.product-brand {
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--neon-blue);
}

.product-title {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

/* Характеристики в виде плашек */
.product-details-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (max-width: 480px) {
  .product-details-grid {
    grid-template-columns: 1fr;
  }
}

.detail-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
}

.detail-label {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-label i {
  color: var(--neon-purple);
  width: 14px;
}

.detail-value {
  font-weight: 550;
  color: var(--text-primary);
}

/* Блок размеров и логистики */
.logistic-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.logistic-title {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.logistic-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.logistic-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 12px 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.logistic-box-value {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--neon-blue);
}

.logistic-box-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Блок цен */
.pricing-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.price-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  overflow: hidden;
}

.price-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 4px;
}

.price-card.buy::after {
  background-color: var(--neon-purple);
}

.price-card.sell::after {
  background-color: var(--neon-blue);
}

.price-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.price-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Блок описания */
.description-container {
  border-top: 1px solid var(--panel-border);
  padding-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.description-title {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.description-text {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #D1D5DB;
}

/* Блок кнопок управления */
.action-bar {
  margin-top: 10px;
  display: flex;
  gap: 15px;
}

.btn-import {
  flex-grow: 1;
}

.btn-import.success {
  background: linear-gradient(135deg, var(--neon-green), #059669);
  box-shadow: 0 4px 20px var(--neon-green-glow);
}

.btn-import.success:hover {
  box-shadow: 0 6px 25px rgba(16, 185, 129, 0.5);
}

/* Тост уведомления */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
  pointer-events: none;
}

.toast {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--panel-border);
  border-left: 4px solid var(--neon-blue);
  color: var(--text-primary);
  padding: 16px 24px;
  border-radius: 10px;
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  gap: 15px;
  min-width: 320px;
  transform: translateX(120%);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: auto;
}

.toast.show {
  transform: translateX(0);
}

.toast.success {
  border-left-color: var(--neon-green);
}

.toast.success i {
  color: var(--neon-green);
}

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

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

.toast-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.toast-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.toast-message {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.toast-message a {
  color: var(--neon-blue);
  text-decoration: none;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.toast-message a:hover {
  text-decoration: underline;
}

.toast-close {
  margin-left: auto;
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition);
}

.toast-close:hover {
  color: var(--text-primary);
}
