/* ABRAMOV Parts Intelligence — Premium B2B SaaS Dark Theme */
/* ===================================================== */

:root {
  /* Graphite / neutral palette */
  --bg-0: #0a0b0f;
  --bg-1: #111319;
  --bg-2: #161922;
  --bg-3: #1c1f2b;
  --bg-4: #232631;
  --bg-hover: #2a2d39;

  /* Borders */
  --border: #2a2d36;
  --border-light: #33363f;
  --border-focus: #3b6cdd;

  /* Cold blue accent */
  --accent: #4c7dff;
  --accent-hover: #6b95ff;
  --accent-dim: #2e4499;
  --accent-glow: rgba(76, 125, 255, 0.12);

  /* Text */
  --text-0: #f0f1f5;
  --text-1: #c4c7d0;
  --text-2: #8b8f9e;
  --text-3: #5d606e;

  /* Status */
  --green: #3dd68c;
  --red: #f05656;
  --yellow: #f5a623;
  --orange: #e8853a;

  /* Sizing */
  --radius: 14px;
  --radius-sm: 8px;
  --radius-xs: 5px;
  --header-h: 62px;
  --max-w: 1280px;

  /* Transitions */
  --t-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --t-med: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { font-size: 15px; -webkit-font-smoothing: antialiased; }

body {
  background: var(--bg-0);
  color: var(--text-1);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

/* === HEADER === */
.header {
  position: sticky; top: 0; z-index: 100;
  height: var(--header-h);
  background: rgba(11, 12, 16, 0.82);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 28px;
}

.header-inner {
  width: 100%; max-width: var(--max-w);
  margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
}

.brand {
  display: flex; align-items: baseline; gap: 10px;
  cursor: pointer; user-select: none;
}

.brand-name {
  font-size: 18px; font-weight: 700;
  letter-spacing: 2px; color: var(--text-0);
}

.brand-sub {
  font-size: 11px; font-weight: 400;
  letter-spacing: 1px; color: var(--text-3);
  text-transform: uppercase;
}

.nav { display: flex; align-items: center; gap: 4px; }

.nav-item {
  padding: 7px 16px;
  font-size: 14px; font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: color var(--t-fast), background var(--t-fast);
  cursor: pointer;
}

.nav-item:hover { color: var(--text-0); background: var(--bg-3); }
.nav-item.active { color: var(--accent); background: var(--accent-glow); }

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

/* === LAYOUT === */
.main {
  width: 100%; max-width: var(--max-w);
  margin: 0 auto;
  padding: 40px 28px 80px;
}

.page { display: none; }
.page.active { display: block; animation: fadeIn 0.4s ease; }

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

/* === SEARCH CARD === */
.search-hero {
  text-align: center;
  margin-bottom: 36px;
}

.search-hero h1 {
  font-size: 28px; font-weight: 700;
  color: var(--text-0);
  margin-bottom: 8px;
}

.search-hero p {
  font-size: 15px; color: var(--text-2);
}

.search-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 680px;
  margin: 0 auto;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

.search-card-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 24px;
}

.search-card-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--accent-glow);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}

.search-card-title {
  font-size: 16px; font-weight: 600; color: var(--text-0);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field.full { grid-column: 1 / -1; }

.form-label {
  font-size: 12px; font-weight: 500;
  color: var(--text-2);
  letter-spacing: 0.3px;
}

.form-label .opt { color: var(--text-3); font-weight: 400; margin-left: 4px; }

.form-input, .form-select, .form-textarea {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text-0);
  font-family: inherit;
  transition: border var(--t-fast), box-shadow var(--t-fast);
  outline: none;
  width: 100%;
}

.form-input::placeholder, .form-textarea::placeholder { color: var(--text-3); }

.form-input:hover, .form-select:hover, .form-textarea:hover {
  border-color: var(--border-light);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-textarea { min-height: 80px; resize: vertical; }

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%238b8f9e' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.form-actions {
  margin-top: 24px;
  display: flex; justify-content: center;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 13px 32px;
  font-size: 15px; font-weight: 600;
  cursor: pointer;
  transition: background var(--t-fast), transform var(--t-fast);
  font-family: inherit;
  display: flex; align-items: center; gap: 8px;
}

.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* === INFO BLOCKS === */
.info-blocks {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 48px;
}

.info-block {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: border var(--t-fast), transform var(--t-fast);
}

.info-block:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
}

.info-block-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  margin-bottom: 14px;
}

.info-block h3 {
  font-size: 14px; font-weight: 600;
  color: var(--text-0);
  margin-bottom: 6px;
}

.info-block p {
  font-size: 13px; color: var(--text-2);
  line-height: 1.45;
}

/* === KPI CARDS === */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
}

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

.kpi-value {
  font-size: 22px; font-weight: 700;
  color: var(--text-0);
}

.kpi-value.accent { color: var(--accent); }
.kpi-value.green { color: var(--green); }
.kpi-value.orange { color: var(--orange); }

.kpi-unit {
  font-size: 13px; font-weight: 400;
  color: var(--text-3);
  margin-left: 4px;
}

/* === FILTERS BAR === */
.filters-bar {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.filter-item {
  display: flex; flex-direction: column; gap: 4px;
}

.filter-label {
  font-size: 10px; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.5px;
}

.filter-input {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 7px 12px;
  font-size: 13px;
  color: var(--text-0);
  outline: none;
  transition: border var(--t-fast);
  font-family: inherit;
}

.filter-input:focus { border-color: var(--border-focus); }
.filter-input:hover { border-color: var(--border-light); }

/* === RESULTS TABLE === */
.results-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.results-table thead th {
  background: var(--bg-2);
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.results-table tbody td {
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text-1);
  border-bottom: 1px solid var(--border);
}

.results-table tbody tr {
  transition: background var(--t-fast);
}

.results-table tbody tr:hover { background: var(--bg-3); }
.results-table tbody tr:last-child td { border-bottom: none; }

.tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.3px;
}

.tag-original { background: rgba(61, 214, 140, 0.12); color: var(--green); }
.tag-analog { background: rgba(76, 125, 255, 0.12); color: var(--accent); }
.tag-new { background: rgba(61, 214, 140, 0.12); color: var(--green); }
.tag-used { background: rgba(245, 166, 35, 0.12); color: var(--yellow); }
.tag-instock { background: rgba(61, 214, 140, 0.12); color: var(--green); }
.tag-order { background: rgba(245, 166, 35, 0.12); color: var(--yellow); }
.tag-info { background: rgba(139, 143, 158, 0.12); color: var(--text-2); }

.price-pending { color: var(--text-3); font-size: 12px; font-style: italic; }

.price-cell { font-weight: 600; color: var(--text-0); }
.price-cell.min { color: var(--green); }

.link-btn {
  color: var(--accent);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: color var(--t-fast);
}

.link-btn:hover { color: var(--accent-hover); text-decoration: underline; }

/* === SEARCH REQUEST SUMMARY === */
.request-summary {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 24px;
}

.request-summary h3 {
  font-size: 13px; font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 14px;
}

.request-tags {
  display: flex; flex-wrap: wrap; gap: 8px;
}

.request-tag {
  background: var(--bg-3);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 13px;
  color: var(--text-1);
}

.request-tag strong { color: var(--text-0); margin-right: 6px; font-weight: 600; }

/* === DEMO BANNER === */
.demo-banner {
  background: rgba(76, 125, 255, 0.08);
  border: 1px solid rgba(76, 125, 255, 0.2);
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--accent);
  display: flex; align-items: center; gap: 8px;
}

.demo-banner-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s infinite;
}

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

/* === EMPTY STATE === */
.empty-state {
  text-align: center;
  padding: 80px 20px;
}

.empty-state-icon {
  width: 64px; height: 64px;
  margin: 0 auto 20px;
  border-radius: 16px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
}

.empty-state h2 {
  font-size: 18px; font-weight: 600;
  color: var(--text-1);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px; color: var(--text-3);
  max-width: 400px;
  margin: 0 auto;
  line-height: 1.5;
}

/* === ADMIN === */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.admin-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  cursor: pointer;
  transition: border var(--t-fast), transform var(--t-fast);
}

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

.admin-card-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--bg-3);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  margin-bottom: 12px;
}

.admin-card h3 {
  font-size: 14px; font-weight: 600;
  color: var(--text-0);
  margin-bottom: 4px;
}

.admin-card p {
  font-size: 12px; color: var(--text-3);
}

/* === LOADING === */
.loader {
  display: flex; align-items: center; justify-content: center;
  padding: 60px;
  gap: 10px;
}

.loader-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: bounce 1.4s infinite ease-in-out both;
}

.loader-dot:nth-child(1) { animation-delay: -0.32s; }
.loader-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* === BURGER === */
.burger {
  display: none;
  width: 32px; height: 32px;
  flex-direction: column; justify-content: center; gap: 5px;
  cursor: pointer;
}

.burger span {
  height: 2px; width: 22px;
  background: var(--text-1);
  border-radius: 2px;
  transition: var(--t-fast);
}

.burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger.open span:nth-child(2) { opacity: 0; }
.burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* === RESPONSIVE === */
@media (max-width: 1024px) {
  .info-blocks { grid-template-columns: repeat(2, 1fr); }
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .admin-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .header { padding: 0 16px; }
  .main { padding: 24px 14px 60px; }
  .search-card { padding: 18px 16px; border-radius: 12px; }
  .form-grid { grid-template-columns: 1fr; gap: 14px; }
  .info-blocks { grid-template-columns: 1fr; gap: 12px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .admin-grid { grid-template-columns: 1fr; }

  .nav { display: none; }
  .nav.open {
    display: flex;
    position: fixed;
    top: var(--header-h); left: 0; right: 0;
    flex-direction: column;
    background: var(--bg-1);
    border-bottom: 1px solid var(--border);
    padding: 10px 12px;
    gap: 2px;
    z-index: 99;
    box-shadow: 0 12px 24px rgba(0,0,0,0.4);
  }
  .nav.open .nav-item { padding: 14px 16px; font-size: 15px; border-radius: 10px; }

  .burger { display: flex; padding: 8px; }

  /* Search form: comfortable touch targets */
  .form-input, .form-select, .form-textarea {
    padding: 13px 14px;
    font-size: 16px; /* prevents iOS zoom-on-focus */
    border-radius: 10px;
  }
  .form-select { padding-right: 40px; }
  .form-label { font-size: 13px; margin-bottom: 2px; }

  .btn-primary {
    width: 100%;
    padding: 16px 24px;
    font-size: 16px;
    border-radius: 12px;
    justify-content: center;
  }

  .search-hero h1 { font-size: 21px; }
  .search-hero p { font-size: 13px; }
  .search-card-icon { width: 40px; height: 40px; }

  /* Results table -> cards on mobile */
  .results-table, .results-table thead, .results-table tbody,
  .results-table tr, .results-table td { display: block; width: 100%; }

  .results-table { border: none; background: transparent; }
  .results-table thead { display: none; }

  .results-table tbody tr {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 14px 12px;
    margin-bottom: 10px;
  }

  .results-table tbody tr:hover { background: var(--bg-1); }

  .results-table tbody td {
    border: none;
    padding: 3px 0;
    font-size: 14px;
    white-space: normal;
  }

  /* Brand + number line */
  .results-table tbody td:nth-child(4) { font-weight: 600; color: var(--text-0); font-size: 15px; padding-top: 8px; }
  .results-table tbody td:nth-child(4) span { display: block; font-size: 12px; font-weight: 400; margin-top: 1px; }

  /* Price row highlighted */
  .results-table tbody td.price-cell { font-size: 18px; font-weight: 700; padding-top: 8px; }
  .results-table tbody td.price-cell .price-pending { font-size: 13px; }

  /* Open link as button */
  .results-table tbody td:last-child { padding-top: 8px; }
  .results-table tbody td:last-child .link-btn {
    display: inline-block;
    padding: 10px 18px;
    background: var(--accent-glow);
    border: 1px solid var(--accent-dim);
    border-radius: 9px;
    font-size: 14px;
  }

  .filters-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 14px;
    gap: 10px;
  }
  .filter-item { width: 100%; }
  .filter-input { width: 100%; padding: 11px 12px; font-size: 15px; }

  .request-summary { padding: 16px 16px; }
  .request-tags { gap: 6px; }
  .request-tag { font-size: 12px; padding: 6px 10px; }

  .kpi-card { padding: 13px 14px; }
  .kpi-value { font-size: 18px; }
  .kpi-label { font-size: 10px; }

  .empty-state { padding: 56px 16px; }
  .admin-card { padding: 18px; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .brand-sub { display: none; }
  .search-hero h1 { font-size: 19px; }
  .form-textarea { min-height: 90px; }
}