/* ============================================================
   Havells Smart Search — Design System & Styles
   ============================================================ */

:root {
  /* Color Palette */
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #1a1a26;
  --bg-card-hover: #222233;
  --bg-elevated: #1e1e2e;
  --bg-input: #16161f;

  --text-primary: #f0f0f5;
  --text-secondary: #9494a8;
  --text-muted: #6b6b80;
  --text-accent: #818cf8;

  --accent-primary: #6366f1;
  --accent-hover: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.15);
  --accent-gradient: linear-gradient(135deg, #6366f1, #a78bfa);

  --success: #34d399;
  --warning: #fbbf24;
  --error: #f87171;

  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-focus: rgba(99, 102, 241, 0.5);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 24px rgba(99, 102, 241, 0.2);

  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-smooth: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* Subtle animated gradient background */
body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at 30% 20%, rgba(99, 102, 241, 0.06) 0%, transparent 50%),
              radial-gradient(ellipse at 70% 80%, rgba(167, 139, 250, 0.04) 0%, transparent 50%);
  z-index: -1;
  animation: bgShift 30s ease-in-out infinite alternate;
}

@keyframes bgShift {
  0% { transform: translate(0, 0) rotate(0deg); }
  100% { transform: translate(-5%, 5%) rotate(3deg); }
}

/* ============================================================
   Header
   ============================================================ */

#header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(20px) saturate(1.5);
  border-bottom: 1px solid var(--border-subtle);
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-gradient);
  border-radius: var(--radius-md);
  color: white;
}

.brand-name {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-accent {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mode-badge {
  padding: 5px 14px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent-hover);
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.icon-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-focus);
}

/* ============================================================
   Search Section
   ============================================================ */

.search-section {
  padding: 60px 24px 32px;
  max-width: 720px;
  margin: 0 auto;
}

.search-hero {
  text-align: center;
  margin-bottom: 36px;
}

.search-title {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 10px;
  background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

.search-container {
  position: relative;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 4px 4px 4px 18px;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-sm);
}

.search-box:focus-within {
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-glow), 0 0 0 3px var(--accent-glow);
}

.search-icon {
  color: var(--text-muted);
  flex-shrink: 0;
  transition: color var(--transition-fast);
}

.search-box:focus-within .search-icon {
  color: var(--accent-primary);
}

#searchInput {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  padding: 14px 12px;
  outline: none;
}

#searchInput::placeholder {
  color: var(--text-muted);
}

.search-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.clear-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

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

.search-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--accent-gradient);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-normal);
}

.search-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
}

.search-btn:active {
  transform: translateY(0);
}

/* ============================================================
   Autocomplete Dropdown
   ============================================================ */

.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 420px;
  overflow-y: auto;
  z-index: 50;
  animation: dropdownIn 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.autocomplete-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  cursor: pointer;
  transition: background var(--transition-fast);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.active {
  background: rgba(99, 102, 241, 0.08);
}

.ac-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent-hover);
  font-size: 0.8rem;
  flex-shrink: 0;
}

.ac-text {
  flex: 1;
  font-size: 0.92rem;
  color: var(--text-primary);
}

.ac-text mark {
  background: transparent;
  color: var(--accent-hover);
  font-weight: 600;
}

.ac-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Grouped dropdown sections */
.ac-group-header {
  padding: 8px 16px 6px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border-top: 1px solid var(--border-subtle);
}

.ac-group-header:first-child {
  border-top: none;
}

.ac-correction {
  padding: 8px 16px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  background: rgba(99, 102, 241, 0.06);
  border-bottom: 1px solid var(--border-subtle);
}

.ac-correction strong {
  color: var(--accent-hover);
  font-weight: 600;
}

.ac-count {
  margin-left: 8px;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 400;
}

.ac-price {
  margin-left: 8px;
  font-size: 0.78rem;
  color: var(--success);
  font-weight: 600;
}

.ac-source {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.ac-source.es {
  background: rgba(52, 211, 153, 0.12);
  color: var(--success);
}

.ac-source.llm {
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent-hover);
}

.ac-source.json {
  background: rgba(251, 191, 36, 0.12);
  color: var(--warning);
}

/* ============================================================
   Quick Filters
   ============================================================ */

.quick-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
  justify-content: center;
}

.filter-chip {
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-normal);
  white-space: nowrap;
}

.filter-chip:hover {
  background: var(--accent-glow);
  border-color: var(--accent-primary);
  color: var(--accent-hover);
  transform: translateY(-1px);
}

/* ============================================================
   Results
   ============================================================ */

.results-section {
  padding: 0 24px 48px;
  max-width: 1280px;
  margin: 0 auto;
  animation: fadeInUp 400ms cubic-bezier(0.16, 1, 0.3, 1);
}

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

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 8px;
}

.results-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.results-count {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.results-time {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 3px 10px;
  background: var(--bg-card);
  border-radius: var(--radius-full);
}

.results-reason {
  font-size: 0.78rem;
  color: var(--text-muted);
  max-width: 50%;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

/* Product Card */
.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-smooth);
  animation: cardIn 400ms cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

.product-card:hover {
  transform: translateY(-4px);
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow: var(--shadow-lg), 0 0 20px rgba(99, 102, 241, 0.08);
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.card-image-wrap {
  position: relative;
  height: 200px;
  background: linear-gradient(135deg, #1a1a2e, #16162a);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.card-image-wrap img {
  max-width: 85%;
  max-height: 85%;
  object-fit: contain;
  transition: transform var(--transition-smooth);
}

.product-card:hover .card-image-wrap img {
  transform: scale(1.05);
}

.card-image-placeholder {
  font-size: 3rem;
  opacity: 0.3;
}

.card-score {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 10px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent-hover);
}

.card-category {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 10px;
  background: rgba(99, 102, 241, 0.85);
  border-radius: var(--radius-full);
  font-size: 0.68rem;
  font-weight: 600;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.card-body {
  padding: 18px;
}

.card-sku {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.card-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-price {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--success);
}

.card-price-na {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.card-attrs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.card-attr {
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  color: var(--text-secondary);
}

/* ============================================================
   Loading
   ============================================================ */

.loading-overlay {
  display: flex;
  justify-content: center;
  padding: 80px 24px;
}

.loading-spinner {
  text-align: center;
}

.spinner-ring {
  width: 44px;
  height: 44px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ============================================================
   Empty State
   ============================================================ */

.empty-state {
  text-align: center;
  padding: 80px 24px;
  animation: fadeInUp 400ms ease;
}

.empty-icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
  opacity: 0.6;
}

.empty-state h3 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ============================================================
   Status Modal
   ============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeIn 200ms ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  width: 90%;
  max-width: 560px;
  max-height: 80vh;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalIn 300ms cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast);
}

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

.modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: calc(80vh - 70px);
}

.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.status-row:last-child { border-bottom: none; }

.status-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.status-value {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.status-value.ok { color: var(--success); }
.status-value.warn { color: var(--warning); }
.status-value.error { color: var(--error); }

.status-loading {
  text-align: center;
  color: var(--text-muted);
  padding: 24px;
}

/* ============================================================
   LLM Loader (in dropdown)
   ============================================================ */

.ac-llm-loader {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  color: var(--text-muted);
  font-size: 0.82rem;
  border-top: 1px solid var(--border-subtle);
  animation: fadeIn 200ms ease;
}

.ac-loader-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-subtle);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

/* ============================================================
   Latency Badge
   ============================================================ */

.latency-badge {
  padding: 4px 10px;
  font-size: 0.7rem;
  font-weight: 600;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  border-radius: var(--radius-full);
  background: rgba(52, 211, 153, 0.1);
  color: var(--success);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

/* ============================================================
   Request Log
   ============================================================ */

.log-section {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px 48px;
}

.log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.log-header h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.clear-log-btn {
  padding: 4px 12px;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.clear-log-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-focus);
  background: var(--bg-elevated);
}

.log-entries {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 320px;
  overflow-y: auto;
}

.log-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
  padding: 24px;
}

.log-entry {
  animation: fadeIn 200ms ease;
}

.log-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  transition: background var(--transition-fast);
}

.log-row:hover {
  background: var(--bg-card-hover);
}

.log-timestamp {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.7rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.log-badge {
  padding: 2px 8px;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.log-badge-es {
  background: rgba(52, 211, 153, 0.12);
  color: var(--success);
}

.log-badge-llm {
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent-hover);
}

.log-badge-json {
  background: rgba(251, 191, 36, 0.12);
  color: var(--warning);
}

.log-badge-cache {
  background: rgba(99, 102, 241, 0.08);
  color: var(--text-muted);
}

.log-query-text {
  color: var(--text-primary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.log-spacer {
  flex: 1;
}

.log-result-count {
  font-size: 0.72rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.log-latency {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.log-fast {
  background: rgba(52, 211, 153, 0.1);
  color: var(--success);
}

.log-medium {
  background: rgba(251, 191, 36, 0.1);
  color: var(--warning);
}

.log-slow {
  background: rgba(248, 113, 113, 0.1);
  color: var(--error);
}

/* ============================================================
   Utility
   ============================================================ */

.hidden { display: none !important; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

/* Responsive */
@media (max-width: 640px) {
  .search-title { font-size: 1.6rem; }
  .search-section { padding: 36px 16px 24px; }
  .results-section { padding: 0 16px 32px; }
  .results-grid { grid-template-columns: 1fr; }
  .results-reason { display: none; }
  .search-btn span { display: none; }
  .search-btn { padding: 10px 14px; }
}

/* ============================================================
   Product Details, Justification & Recommendation Styles
   ============================================================ */

.product-card {
  cursor: pointer;
}

/* AI Justification in Search Grid Card */
.card-justification {
  margin-top: 14px;
  padding: 10px;
  background: rgba(99, 102, 241, 0.04);
  border: 1px dashed rgba(99, 102, 241, 0.15);
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  line-height: 1.4;
  animation: fadeIn 300ms ease forwards;
}

.justification-badge {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--accent-hover);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

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

/* Product Details Modal Customization */
.product-details-card {
  max-width: 840px;
  width: 95%;
}

.details-grid-layout {
  display: grid;
  grid-template-columns: 1.2fr 1.8fr;
  gap: 28px;
  margin-bottom: 24px;
}

.details-left {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.details-image-container {
  background: linear-gradient(135deg, #171725, #11111b);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 20px;
}

.details-image-container img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform var(--transition-smooth);
}

.details-image-placeholder {
  font-size: 4rem;
  opacity: 0.25;
}

.details-right {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.details-sku-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
}

.details-score-badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent-hover);
  padding: 4px 8px;
  background: rgba(99, 102, 241, 0.1);
  border-radius: var(--radius-sm);
}

.details-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.details-price {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--success);
}

.details-price-na {
  font-size: 1rem;
  color: var(--text-muted);
}

.details-section {
  border-top: 1px solid var(--border-subtle);
  padding-top: 16px;
}

.details-section h4 {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.details-justification {
  padding: 12px 16px;
  background: rgba(99, 102, 241, 0.06);
  border: 1.5px solid rgba(99, 102, 241, 0.18);
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  color: var(--text-primary);
  line-height: 1.5;
}

.sparkle-icon {
  color: var(--warning);
  margin-right: 4px;
}

.details-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.specs-table {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.spec-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.spec-label {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.spec-value {
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-primary);
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* AI Recommendations */
.recommendations-section {
  margin-top: 8px;
}

.recommendations-container {
  min-height: 100px;
}

.reco-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.88rem;
  padding: 16px 0;
}

.spinner-ring.small {
  width: 18px;
  height: 18px;
  border-width: 2px;
  margin: 0;
}

.reco-empty, .reco-error {
  color: var(--text-muted);
  font-size: 0.88rem;
  padding: 16px 0;
}

.reco-error {
  color: var(--error);
}

.reco-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 4px;
}

.reco-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition-normal);
}

.reco-card:hover {
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.25);
  background: rgba(99, 102, 241, 0.04);
}

.reco-image-wrap {
  height: 80px;
  background: rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 6px;
}

.reco-image-wrap img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
}

.reco-image-placeholder {
  font-size: 1.5rem;
  opacity: 0.2;
}

.reco-body {
  padding: 8px;
}

.reco-sku {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.reco-title {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.reco-price {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--success);
}

.reco-price-na {
  font-size: 0.7rem;
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .details-grid-layout {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .product-details-card {
    width: 95%;
    max-height: 90vh;
  }
  .details-image-container {
    height: 200px;
  }
  .reco-list {
    grid-template-columns: repeat(2, 1fr);
  }
  .specs-table {
    grid-template-columns: 1fr;
  }
}

