/* ═════════════════════════════════════════════════════════════
   EbaySearch — Преміальна темна дизайн-система (CSS)
   ═════════════════════════════════════════════════════════════ */

:root {
  /* Базові кольори фону */
  --bg-main: #0b0f19;
  --bg-sidebar: #0f172a;
  --bg-card: rgba(18, 24, 38, 0.75);
  --bg-card-hover: rgba(28, 38, 58, 0.85);
  --bg-glass: rgba(15, 23, 42, 0.65);
  --bg-input: #131b2e;
  
  /* Межі та розділювачі */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(16, 185, 129, 0.4);
  --border-card: rgba(255, 255, 255, 0.06);

  /* Текстові кольори */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-dim: #475569;

  /* Акцентні кольори */
  --accent-emerald: #10b981;
  --accent-emerald-glow: rgba(16, 185, 129, 0.25);
  --accent-cyan: #06b6d4;
  --accent-indigo: #6366f1;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;

  /* Тіні */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px rgba(16, 185, 129, 0.15);

  /* Радіуси */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Шрифти */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Outfit', var(--font-sans);
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Переходи */
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ─── Базові стилі та скидання ────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-image: 
    radial-gradient(ellipse 60% 40% at 20% -10%, rgba(99, 102, 241, 0.12), transparent 70%),
    radial-gradient(ellipse 50% 30% at 85% 10%, rgba(16, 185, 129, 0.08), transparent 60%);
  background-attachment: fixed;
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, select {
  font-family: inherit;
  font-size: inherit;
}

/* ─── Макет додатку (App Layout) ──────────────────────────── */
.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ─── Верхня панель (Header) ─────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
}

.header-container {
  max-width: 1800px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.brand-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.brand-title span {
  color: var(--accent-emerald);
}

.brand-subtitle {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Статусні бейджі */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.03);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.status-demo .status-dot {
  background-color: var(--accent-amber);
  box-shadow: 0 0 8px var(--accent-amber);
}

.status-live .status-dot {
  background-color: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
}

/* ─── Кнопки ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
  white-space: nowrap;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.btn-primary {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.35);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-telegram {
  background: rgba(56, 189, 248, 0.08);
  border-color: rgba(56, 189, 248, 0.25);
  color: #38bdf8;
}

.btn-telegram:hover {
  background: rgba(56, 189, 248, 0.18);
  border-color: rgba(56, 189, 248, 0.5);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(56, 189, 248, 0.22);
}

.btn-telegram-primary {
  background: linear-gradient(135deg, #229ED9 0%, #0088cc 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(34, 158, 217, 0.25);
}

.btn-telegram-primary:hover {
  background: linear-gradient(135deg, #28a8e0 0%, #0099e6 100%);
  box-shadow: 0 6px 18px rgba(34, 158, 217, 0.4);
  transform: translateY(-1px);
}

.tg-status-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
  margin-bottom: 0.75rem;
}

.tg-status-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.tg-badge-connected {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #10b981;
  background: rgba(16, 185, 129, 0.12);
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.tg-badge-not-connected {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-danger-outline {
  background: transparent;
  border-color: rgba(244, 63, 94, 0.25);
  color: var(--accent-rose);
  padding: 0.55rem;
}

.btn-danger-outline:hover {
  background: rgba(244, 63, 94, 0.12);
  border-color: var(--accent-rose);
}

/* ─── Основна робоча зона ─────────────────────────────────── */
.main-content {
  flex: 1;
  max-width: 1800px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
}

/* ─── Ліва колонка: Сайдбар ───────────────────────────────── */
.sidebar {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 120px);
  position: sticky;
  top: 85px;
  overflow: hidden;
}

.sidebar-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.counter-badge {
  background: rgba(255, 255, 255, 0.08);
  color: var(--accent-cyan);
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

/* Панель сортування пошуків у сайдбарі */
.sidebar-sort-bar {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.25);
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-shrink: 0;
}

.sort-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.sort-select {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.3rem 0.55rem;
  outline: none;
  cursor: pointer;
  transition: var(--transition);
  color-scheme: light !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.sort-select:focus, .sort-select:hover {
  border-color: var(--accent-emerald);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
}

.sort-select option,
select option {
  background-color: #ffffff !important;
  color: #0f172a !important;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.35rem 0.5rem;
}

.searches-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Картка збереженого пошуку в сайдбарі */
.search-item {
  padding: 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.search-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
}

.search-item.active {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.35);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.08);
}

.search-item-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.search-item-title {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.search-item-badges {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.badge-region {
  font-size: 0.68rem;
  padding: 0.1rem 0.35rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-secondary);
  font-weight: 600;
}

.badge-min-price {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.1);
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(16, 185, 129, 0.25);
  white-space: nowrap;
}

.search-item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.search-item-count {
  color: var(--accent-emerald);
  font-weight: 600;
}

.sidebar-footer {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.15);
}

.auto-update-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ─── Права зона: Контент ─────────────────────────────────── */
.content-area {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Заголовок активного пошуку */
.active-header {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.active-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.25rem;
}

.search-category-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

.active-query {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.search-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.4rem;
}

.meta-dot {
  color: var(--text-dim);
}

.badge-filter-include {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.35);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.78rem;
}

.badge-filter-exclude {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.25);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.78rem;
}

.badge-filter-exact {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.78rem;
}

.active-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* Панель аналітики та метрик */
.analytics-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-subtle);
}

.metric-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
}

.metric-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.metric-value {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
}

.metric-accent {
  color: var(--accent-emerald);
}

.metric-hint {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 0.15rem;
}

/* ─── Панель результатів ──────────────────────────────────── */
.results-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.toolbar-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
  font-size: 1rem;
}

.badge-total-sort {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.1);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(6, 182, 212, 0.2);
}

.view-toggle {
  display: flex;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 2px;
}

.toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.35rem 0.55rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
}

.toggle-btn:hover {
  color: var(--text-primary);
}

.toggle-btn.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

/* ─── Компактний список рядків (Horizontal List View) ─── */
.results-rows-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  width: 100%;
}

.item-row {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 0.65rem 1.15rem;
  display: grid;
  grid-template-columns: 36px minmax(200px, 1fr) 310px 150px;
  align-items: center;
  gap: 1.15rem;
  transition: var(--transition);
  position: relative;
  box-shadow: var(--shadow-sm);
}

.item-row:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.item-row-top {
  border-left: 3px solid var(--accent-emerald);
}

/* Ранг */
.row-rank {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.78rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  min-width: 34px;
  text-align: center;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Інформація про лот */
.row-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  overflow: hidden;
}

.row-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: var(--transition);
}

.row-title:hover {
  color: var(--accent-emerald);
}

.row-meta {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.row-seller {
  font-size: 0.76rem;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.meta-dot {
  color: var(--text-muted);
  opacity: 0.45;
  font-size: 0.75rem;
  line-height: 1;
  flex-shrink: 0;
}

/* Бейджі */
.row-badges {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

/* Блок цін */
.row-pricing {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  width: 310px;
  justify-content: flex-end;
}

.price-col-cell {
  display: flex;
  align-items: center;
}

.col-price {
  width: 75px;
  justify-content: flex-end;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: right;
}

.col-ship {
  width: 110px;
  justify-content: flex-end;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: right;
}

.col-ship.text-free {
  color: var(--accent-emerald);
  font-weight: 600;
}

.col-total {
  width: 85px;
  justify-content: flex-end;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--accent-emerald);
  text-align: right;
}

/* Кнопка дії */
.row-action {
  width: 150px;
  flex-shrink: 0;
}

.row-action .item-btn {
  padding: 0.42rem 0.65rem;
  font-size: 0.82rem;
  width: 100%;
  justify-content: center;
  white-space: nowrap;
}

/* Інтерактивний бейдж-дзвіночок для аукціонів */
.badge-auction-bell {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.6rem;
  border-radius: var(--radius-full);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fbbf24;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  line-height: 1.2;
}

.badge-auction-bell:hover {
  background: rgba(245, 158, 11, 0.22);
  border-color: #f59e0b;
  color: #fef08a;
  transform: translateY(-1px);
}

.badge-auction-bell.active {
  background: rgba(245, 158, 11, 0.28);
  border-color: #f59e0b;
  color: #fef08a;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.35);
  animation: bellBadgePulse 2.5s infinite ease-in-out;
}

@keyframes bellBadgePulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.badge-auction-bell .bell-icon {
  font-size: 0.8rem;
}

/* ─── Сітка карток результатів ────────────────────────────── */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

/* Картка лоту на eBay */
.item-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  position: relative;
  box-shadow: var(--shadow-sm);
}

.item-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow-md);
}

/* Ранг картки (#1, #2, #3) */
.item-rank {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 5;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 800;
  font-family: var(--font-display);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.rank-1 {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
}

.rank-2 {
  background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
  color: #ffffff;
}

.rank-3 {
  background: linear-gradient(135deg, #b45309 0%, #78350f 100%);
  color: #ffffff;
}

.rank-default {
  background: rgba(15, 23, 42, 0.85);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

/* Зображення лота */
.item-image-wrapper {
  position: relative;
  width: 100%;
  padding-top: 65%;
  background: #0f172a;
  overflow: hidden;
}

.item-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.item-card:hover .item-image {
  transform: scale(1.05);
}

.item-badges {
  position: absolute;
  bottom: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  z-index: 2;
}

.badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  backdrop-filter: blur(8px);
}

.badge-new {
  background: rgba(16, 185, 129, 0.85);
  color: #ffffff;
}

.badge-new-other {
  background: rgba(168, 85, 247, 0.85);
  color: #ffffff;
}

.badge-like-new {
  background: rgba(6, 182, 212, 0.85);
  color: #ffffff;
}

.badge-buy-now {
  background: rgba(99, 102, 241, 0.85);
  color: #ffffff;
}

.badge-auction {
  background: rgba(245, 158, 11, 0.85);
  color: #ffffff;
}

.badge-auction-urgent {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.95), rgba(249, 115, 22, 0.95));
  color: #ffffff;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
  animation: pulse-urgent 2.5s infinite ease-in-out;
}

@keyframes pulse-urgent {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.92; transform: scale(1.03); }
}

.badge-free-ship {
  background: rgba(16, 185, 129, 0.16);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.35);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.badge-origin {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  line-height: 1;
}

.badge-origin .flag-icon {
  display: inline-block;
  border-radius: 2px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  vertical-align: middle;
  flex-shrink: 0;
}

.badge-uk {
  background: rgba(37, 99, 235, 0.22);
  color: #bfdbfe;
  border: 1px solid rgba(59, 130, 246, 0.45);
}

.badge-us {
  background: rgba(239, 68, 68, 0.22);
  color: #fecaca;
  border: 1px solid rgba(239, 68, 68, 0.45);
}

.badge-de {
  background: rgba(245, 158, 11, 0.22);
  color: #fde68a;
  border: 1px solid rgba(245, 158, 11, 0.45);
}

.badge-very-good {
  background: rgba(14, 165, 233, 0.85);
  color: #ffffff;
}

.badge-good {
  background: rgba(99, 102, 241, 0.85);
  color: #ffffff;
}

.badge-acceptable {
  background: rgba(245, 158, 11, 0.85);
  color: #ffffff;
}

.badge-parts {
  background: rgba(239, 68, 68, 0.85);
  color: #ffffff;
}

.badge-default {
  background: rgba(100, 116, 139, 0.85);
  color: #ffffff;
}

/* Вміст картки */
.item-content {
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0.85rem;
}

.item-title-link {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: var(--transition);
}

.item-title-link:hover {
  color: var(--accent-emerald);
}

/* Блок цін: Ціна + Доставка = Тотал */
.price-breakdown {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.price-row.total-row {
  margin-top: 0.25rem;
  padding-top: 0.35rem;
  border-top: 1px dashed var(--border-subtle);
  font-size: 0.88rem;
  color: var(--text-primary);
  font-weight: 600;
}

.total-value {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--accent-emerald);
}

.item-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.seller-info {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.item-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-cyan);
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.2);
  transition: var(--transition);
}

.item-btn:hover {
  background: rgba(6, 182, 212, 0.18);
  color: #ffffff;
}

.footer-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-auction-bell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 1.05rem;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
  user-select: none;
}

.btn-auction-bell:hover {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.5);
  color: #fbbf24;
  transform: translateY(-1px);
}

.btn-auction-bell.active {
  background: rgba(245, 158, 11, 0.28);
  border-color: #f59e0b;
  color: #fef08a;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.45);
  animation: bellPulse 2.5s infinite ease-in-out;
}

@keyframes bellPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

/* ─── Стан порожнього списку (Empty State) ─────────────────── */
.empty-welcome {
  grid-column: 1 / -1;
  background: var(--bg-card);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 4rem 2rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.welcome-icon {
  width: 80px;
  height: 80px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-emerald);
}

.empty-welcome h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: #ffffff;
}

.empty-welcome p {
  max-width: 540px;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.empty-state-small {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
}

/* ─── Модальні вікна (Modals) ─────────────────────────────── */
.modal-backdrop,
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn 0.15s ease-out;
}

.modal-backdrop.active,
.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: min(920px, 95vw);
  max-width: 920px;
  box-shadow: var(--shadow-lg);
  animation: scaleUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.modal-card.modal-lg {
  max-width: 860px;
}

.settings-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.5rem 0 0.2rem 0;
  color: var(--accent-cyan);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.settings-divider::before,
.settings-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
}

.modal-close,
.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover,
.btn-close:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.modal-form {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.required {
  color: var(--accent-rose);
}

.form-input {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem;
  color: var(--text-primary);
  outline: none;
  transition: var(--transition);
}

.form-input:focus {
  border-color: var(--accent-emerald);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.form-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.form-row {
  display: flex;
  gap: 1.25rem;
}

.form-row .form-group {
  min-width: 0;
}

.query-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.exact-match-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--accent-cyan);
  cursor: pointer;
  user-select: none;
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.25);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.exact-match-toggle:hover {
  background: rgba(6, 182, 212, 0.16);
  color: #fff;
}

.exact-match-toggle input[type="checkbox"] {
  accent-color: var(--accent-cyan);
  width: 14px;
  height: 14px;
  cursor: pointer;
}

.price-range-inputs {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
}

.price-range-inputs .form-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  padding: 0.65rem 0.5rem;
  text-align: center;
}

/* Приховуємо стрілочки числового поля для компактного та охайного вигляду */
.price-range-inputs input[type="number"]::-webkit-outer-spin-button,
.price-range-inputs input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.price-range-inputs input[type="number"] {
  -moz-appearance: textfield;
}

.price-range-sep {
  color: var(--text-muted);
  font-weight: 600;
  user-select: none;
  padding: 0 0.15rem;
}

.badge-filter-exact {
  color: var(--accent-cyan);
  font-weight: 600;
}

.badge-filter-exclude {
  color: var(--accent-rose);
  font-weight: 500;
}

select.form-input {
  cursor: pointer;
  color-scheme: light;
}

select.form-input option {
  background-color: #ffffff !important;
  color: #0f172a !important;
  font-size: 0.88rem;
  padding: 0.35rem 0.5rem;
}

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

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.3rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
}

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

/* Сітка вибору станів */
.condition-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

.condition-quick-links {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent-cyan);
  font-size: 0.74rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  transition: var(--transition);
}

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

.conditions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  margin-bottom: 0.25rem;
}

.conditions-grid .checkbox-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.conditions-grid .checkbox-label:hover {
  color: var(--text-primary);
}

.conditions-grid .checkbox-label span strong {
  color: var(--text-primary);
}

/* Поле з префіксом валюти */
.input-with-currency {
  position: relative;
  display: flex;
  align-items: center;
}

.currency-prefix {
  position: absolute;
  left: 0.85rem;
  color: var(--accent-emerald);
  font-weight: 700;
  font-size: 0.95rem;
  pointer-events: none;
}

.input-with-currency .form-input {
  padding-left: 1.8rem;
  width: 100%;
}

.info-alert {
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.2);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  display: flex;
  gap: 0.75rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.info-alert a {
  color: var(--accent-cyan);
  text-decoration: underline;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}

.font-mono {
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

/* Анімація обертання кнопки оновлення */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.spin {
  animation: spin 0.8s linear infinite;
  pointer-events: none;
}

/* ─── Сповіщення Toast ────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.1rem;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  animation: slideInRight 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 360px;
}

.toast-success {
  border-left: 3px solid var(--accent-emerald);
}

.toast-error {
  border-left: 3px solid var(--accent-rose);
}

/* ─── Анімації ────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleUp {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

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

/* ─── Адаптивність ────────────────────────────────────────── */
@media (max-width: 1024px) {
  .main-content {
    grid-template-columns: 1fr;
  }
  .sidebar {
    height: auto;
    position: static;
  }
  .searches-list {
    max-height: 250px;
  }
  .item-row {
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
  }
  .row-info {
    flex: 1 1 100%;
  }
  .row-title {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
  .row-pricing {
    margin-left: 0;
    gap: 0.85rem;
  }
}

@media (max-width: 640px) {
  .header-container {
    padding: 0.75rem 1rem;
  }
  .brand-subtitle {
    display: none;
  }
  .active-title-row {
    flex-direction: column;
  }
  .form-row {
    flex-direction: column;
  }
  .results-grid {
    grid-template-columns: 1fr;
  }
}

/* ─── Стилі для динаміки цін та All-Time Low (Етап 3.2) ─────── */

.metric-atl-card {
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.metric-atl-card::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 40px;
  height: 40px;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.2) 0%, transparent 70%);
  pointer-events: none;
}

.metric-atl-card:hover {
  transform: translateY(-2px);
  border-color: rgba(245, 158, 11, 0.5);
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.12);
}

.metric-gold {
  color: #fbbf24 !important;
  text-shadow: 0 0 12px rgba(245, 158, 11, 0.25);
}

.modal-lg {
  max-width: 960px;
  width: min(960px, 95vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}

.badge-history-period {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
}

.history-modal-body {
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.history-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

@media (max-width: 800px) {
  .history-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.history-stat-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: var(--transition);
}

.history-stat-card.card-atl {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08) 0%, rgba(30, 41, 59, 0.4) 100%);
  border-color: rgba(245, 158, 11, 0.35);
}

.stat-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.stat-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.card-atl .stat-value {
  color: #fbbf24;
}

.stat-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.history-chart-wrapper {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.76rem;
  color: var(--text-secondary);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.legend-dot.dot-min {
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.legend-dot.dot-avg {
  background: #94a3b8;
}

.legend-dot.dot-atl {
  background: #f59e0b;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.6);
}

.chart-period-label {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.history-chart-canvas-box {
  width: 100%;
  height: 250px;
  position: relative;
  overflow: hidden;
  user-select: none;
}

.chart-loading, .chart-empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.88rem;
  text-align: center;
  padding: 1rem;
}

.chart-tooltip {
  position: absolute;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(56, 189, 248, 0.4);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
  font-size: 0.75rem;
  pointer-events: none;
  z-index: 50;
  transition: opacity 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
  color: var(--text-primary);
}

.chart-tooltip-date {
  font-weight: 600;
  color: #38bdf8;
  margin-bottom: 0.25rem;
}

.chart-tooltip-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.15rem;
}

.chart-tooltip-title {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 0.7rem;
  margin-top: 0.35rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
  padding-top: 0.25rem;
}

.history-table-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.history-table-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.history-table-scroll {
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.01);
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.76rem;
}

.history-table th {
  text-align: left;
  padding: 0.55rem 0.75rem;
  background: rgba(30, 41, 59, 0.5);
  color: var(--text-secondary);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 1px solid var(--border-subtle);
}

.history-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
}

.history-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.table-min-price {
  color: #10b981;
  font-weight: 700;
}

.table-avg-price {
  color: var(--text-secondary);
}

.table-item-link {
  color: #38bdf8;
  text-decoration: none;
  display: inline-block;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-item-link:hover {
  text-decoration: underline;
}

/* ─── Стилі для Мультикористувацької системи та Авторизації (Етап 3.3) ─── */

/* Бейджик користувача в хедері */
.user-profile-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.65rem 0.35rem 0.45rem;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  backdrop-filter: blur(8px);
  transition: all 0.2s ease;
}

.user-profile-badge:hover {
  border-color: rgba(56, 189, 248, 0.3);
  background: rgba(30, 41, 59, 0.9);
}

.user-avatar-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(129, 140, 248, 0.2));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary-light);
}

.user-name {
  font-weight: 600;
  color: var(--text-primary);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-tag {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.logout-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem;
  margin-left: 0.2rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.logout-btn:hover {
  color: #f43f5e;
  background: rgba(244, 63, 94, 0.12);
  transform: scale(1.05);
}

/* Модальне вікно авторизації */
.auth-overlay {
  z-index: 9999;
  background: rgba(10, 15, 29, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.auth-modal {
  max-width: 420px;
  width: 100%;
  padding: 2.2rem;
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 30px rgba(56, 189, 248, 0.1);
  border-radius: var(--radius-xl);
  animation: modalScaleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.auth-brand-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2) 0%, rgba(99, 102, 241, 0.2) 100%);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #38bdf8;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.2);
}

.auth-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 0.35rem;
}

.auth-title span {
  background: linear-gradient(135deg, #38bdf8 0%, #818cf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.4;
}

.auth-error-alert {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.3);
  border-radius: var(--radius-md);
  color: #fda4af;
  font-size: 0.82rem;
  margin-bottom: 1.25rem;
}

.auth-form .form-group {
  margin-bottom: 1.15rem;
}

.auth-form .form-input {
  width: 100%;
  height: 44px;
  box-sizing: border-box;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  padding: 0.65rem 0.85rem;
}

.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-input-wrapper .form-input {
  width: 100%;
  padding-right: 2.75rem;
}

.btn-toggle-password {
  position: absolute;
  right: 0.6rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: color 0.15s ease;
}

.btn-toggle-password:hover {
  color: var(--text-primary);
}

.auth-footer-note {
  text-align: center;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Таблиця адмін-панелі користувачів */
.admin-table-container {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.4);
}

.admin-users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}

.admin-users-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  background: rgba(30, 41, 59, 0.6);
  color: var(--text-secondary);
  font-weight: 600;
  border-bottom: 1px solid var(--border-subtle);
}

.admin-users-table td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  vertical-align: middle;
}

.admin-users-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.user-role-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 600;
}

.user-role-admin {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.user-role-user {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.user-search-count-pill {
  display: inline-block;
  min-width: 24px;
  padding: 0.15rem 0.5rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.78rem;
}

.btn-reset-pw {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-reset-pw:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
}

