@tailwind base;
@tailwind components;
@tailwind utilities;

:root {
  color-scheme: light dark;
}

.app-root {
  --bg: #282828;
  --surface: #3c3836;
  --surface-2: #504945;
  --text: #ebdbb2;
  --muted: #a89984;
  --accent: #fe8019;
  --danger: #fb4934;
  --success: #b8bb26;
  --warning: #fabd2f;
  --shadow: rgba(0, 0, 0, 0.45);
  --radius: 14px;
  --font-title: "Space Mono", "JetBrains Mono", "Fira Code", monospace;
  --font-body: "JetBrains Mono", "Fira Code", "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  --font-mono: "JetBrains Mono", "Fira Code", "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  --font-size: 16px;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: var(--font-size);
}

.app-root.theme-gruvbox-dark {
  --bg: #282828;
  --surface: #3c3836;
  --surface-2: #504945;
  --text: #ebdbb2;
  --muted: #a89984;
  --accent: #fe8019;
  --danger: #fb4934;
  --success: #b8bb26;
  --warning: #fabd2f;
  --shadow: rgba(0, 0, 0, 0.45);
}

.app-root.theme-gruvbox-light {
  --bg: #fbf1c7;
  --surface: #f2e5bc;
  --surface-2: #ebdbb2;
  --text: #3c3836;
  --muted: #7c6f64;
  --accent: #d65d0e;
  --danger: #cc241d;
  --success: #98971a;
  --warning: #d79921;
  --shadow: rgba(60, 56, 54, 0.25);
}

.app-root.theme-monokai-dark {
  --bg: #1f1f1b;
  --surface: #272822;
  --surface-2: #3b3c35;
  --text: #f8f8f2;
  --muted: #9b9a84;
  --accent: #f92672;
  --danger: #fd5ff1;
  --success: #a6e22e;
  --warning: #fd971f;
  --shadow: rgba(0, 0, 0, 0.55);
}

.app-root.theme-monokai-light {
  --bg: #f8f8f2;
  --surface: #e8e8e3;
  --surface-2: #dcdcd2;
  --text: #272822;
  --muted: #75715e;
  --accent: #f92672;
  --danger: #c0005f;
  --success: #2d8f2d;
  --warning: #fd971f;
  --shadow: rgba(39, 40, 34, 0.2);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: linear-gradient(90deg, var(--surface), var(--surface-2));
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 10px 24px var(--shadow);
}

.vintage-shadow {
  box-shadow: 0 14px 28px var(--shadow);
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, background 0.15s ease;
}

.icon-btn:hover {
  background: var(--accent);
  color: #1b1b1b;
  transform: translateY(-1px);
}

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

.pill {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.75rem;
  background: var(--surface-2);
  color: var(--muted);
}

.panel {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 24px var(--shadow);
}

.card-accent {
  border: 1px solid rgba(254, 128, 25, 0.5);
  box-shadow: 0 10px 30px rgba(254, 128, 25, 0.2);
}

.density-dense .card {
  padding: 12px;
}

.density-comfort .card {
  padding: 20px;
}

.section-title {
  font-family: var(--font-title);
  letter-spacing: 0.5px;
}

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

.input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 8px 10px;
  color: var(--text);
}

.input:focus {
  outline: 2px solid rgba(254, 128, 25, 0.4);
}

.sidebar {
  width: 280px;
  min-width: 240px;
}

.detail-panel {
  width: 320px;
  min-width: 280px;
}

.image-toggle {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 2px;
  background: transparent;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border 0.15s ease;
}

.image-toggle:hover {
  border-color: rgba(254, 128, 25, 0.8);
  transform: translateY(-1px);
}

.image-toggle.selected {
  background: rgba(254, 128, 25, 0.15);
  border-color: rgba(254, 128, 25, 0.9);
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
}

.log-status-panel {
  border-color: rgba(255, 255, 255, 0.1);
}

.log-entry {
  transition: background 0.2s ease;
}

.log-entry-error {
  border-color: rgba(251, 73, 52, 0.7);
  background: rgba(251, 73, 52, 0.07);
  color: var(--danger);
}

.detail-popup {
  border-radius: calc(var(--radius) * 1.2);
  border-width: 1px;
  max-height: calc(100vh - 60px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.view-mode-btn.active-view {
  background: var(--accent);
  color: #1b1b1b;
}

.app-root.layout-compact .sidebar,
.app-root.layout-compact .detail-panel {
  display: none;
}

.app-root.layout-compact .product-grid {
  grid-template-columns: 1fr;
}

.app-root.layout-wide .sidebar {
  width: 320px;
}

.app-root.layout-wide .detail-panel {
  width: 360px;
}

.compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

@media (max-width: 1024px) {
  .sidebar {
    display: none;
  }
  .detail-panel {
    display: none;
  }
}

@media (max-width: 640px) {
  .app-header .toolbar-text {
    display: none;
  }
  .icon-btn {
    width: 36px;
    height: 36px;
  }
  .product-grid {
    grid-template-columns: 1fr;
  }
}
