/* ==========================================================================
   LootHawk App UI — Deal Scanner Dashboard
   Extends theme.css design tokens. Never overrides base variables.
   ========================================================================== */

/* APP HEADER */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 15, 0.95);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.app-header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.app-logo {
  text-decoration: none;
  flex-shrink: 0;
}

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

.app-nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--fg-secondary);
  text-decoration: none;
  border: 1px solid transparent;
  transition: all 0.2s;
  position: relative;
}

.app-nav-link:hover {
  color: var(--fg-primary);
  border-color: var(--border);
}

.app-nav-link.active {
  color: var(--accent);
  border-color: rgba(240, 192, 64, 0.2);
  background: rgba(240, 192, 64, 0.05);
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  background: var(--accent);
  color: #0a0a0f;
  font-size: 11px;
  font-weight: 700;
  border-radius: 9px;
}

/* SEARCH */
.app-header-search {
  flex: 1;
  max-width: 360px;
  margin-left: auto;
}

.search-wrap {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--fg-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--fg-primary);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.search-input::placeholder { color: var(--fg-muted); }

.search-input:focus {
  border-color: rgba(240, 192, 64, 0.4);
}

.search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  z-index: 200;
  max-height: 320px;
  overflow-y: auto;
}

.search-dropdown.hidden { display: none; }

.search-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: rgba(255,255,255,0.03); }

.search-result-title {
  font-size: 14px;
  color: var(--fg-primary);
}

.search-result-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.search-badge {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--accent);
  border: 1px solid rgba(240, 192, 64, 0.3);
  padding: 2px 6px;
}

.search-empty {
  padding: 16px;
  font-size: 14px;
  color: var(--fg-muted);
  text-align: center;
}

/* APP MAIN */
.app-main {
  min-height: calc(100vh - 60px);
  background: var(--bg-primary);
}

/* STATS BAR */
.stats-bar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}

.stats-bar-inner {
  max-width: 1280px;
  margin: 0 auto;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 0;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 24px 0 0;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
}

.stat-key {
  font-size: 12px;
  color: var(--fg-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.stat-sep {
  width: 1px;
  height: 24px;
  background: var(--border);
  margin: 0 24px 0 0;
}

.stat-refresh {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.refresh-label {
  font-size: 12px;
  color: var(--fg-muted);
}

/* BUTTONS */
.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-secondary);
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-ghost:hover {
  border-color: rgba(240,192,64,0.3);
  color: var(--accent);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  background: var(--accent);
  color: #0a0a0f;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s;
}

.btn-primary:hover { background: var(--accent-dim); }

/* DEALS SECTION */
.deals-section { padding: 40px 24px 80px; }

.deals-inner { max-width: 1280px; margin: 0 auto; }

.deals-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 32px;
  gap: 24px;
  flex-wrap: wrap;
}

.section-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 4px;
}

.section-sub {
  font-size: 14px;
  color: var(--fg-muted);
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-secondary);
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn:hover {
  border-color: rgba(240,192,64,0.3);
  color: var(--fg-primary);
}

.filter-btn.active {
  background: rgba(240,192,64,0.1);
  border-color: rgba(240,192,64,0.4);
  color: var(--accent);
}

/* DEAL CARDS */
.deals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.deal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s, transform 0.2s;
  position: relative;
}

.deal-card:hover {
  border-color: rgba(240,192,64,0.25);
  transform: translateY(-2px);
}

.deal-card-link {
  display: flex;
  flex-direction: column;
  flex: 1;
  text-decoration: none;
  color: inherit;
  padding: 20px;
}

.deal-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  min-height: 28px;
}

.deal-badge {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  padding: 3px 8px;
  border: 1px solid;
}

.deal-badge.badge-historic {
  color: #ffd700;
  border-color: rgba(255,215,0,0.4);
  background: rgba(255,215,0,0.08);
}

.deal-badge.badge-day {
  color: var(--accent);
  border-color: rgba(240,192,64,0.4);
  background: rgba(240,192,64,0.08);
}

.deal-badge.badge-hot {
  color: #ff6b35;
  border-color: rgba(255,107,53,0.4);
  background: rgba(255,107,53,0.08);
}

.deal-badge.badge-sale {
  color: #4ecdc4;
  border-color: rgba(78,205,196,0.4);
  background: rgba(78,205,196,0.08);
}

.deal-badge.badge-lg {
  font-size: 12px;
  padding: 5px 14px;
}

.deal-score-wrap { flex-shrink: 0; }

.deal-score-ring {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(240,192,64,0.08);
}

.deal-score-ring.mini {
  width: 32px;
  height: 32px;
}

.deal-score-num {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
}

.deal-card-body { flex: 1; }

.deal-genre {
  font-size: 11px;
  color: var(--fg-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.deal-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 8px;
  color: var(--fg-primary);
}

.deal-store-tag {
  font-size: 12px;
  color: var(--fg-muted);
}

.deal-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.deal-price-wrap {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.deal-original {
  font-size: 13px;
  color: var(--fg-muted);
  text-decoration: line-through;
}

.deal-current {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
}

.deal-discount {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: #4ecdc4;
  background: rgba(78,205,196,0.1);
  border: 1px solid rgba(78,205,196,0.3);
  padding: 2px 8px;
}

.watch-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: transparent;
  border-top: 1px solid var(--border);
  border-left: none;
  border-right: none;
  border-bottom: none;
  color: var(--fg-muted);
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
  width: 100%;
  justify-content: center;
  transition: all 0.2s;
}

.watch-btn:hover { color: var(--accent); background: rgba(240,192,64,0.05); }

.watch-btn.watching {
  color: var(--accent);
  background: rgba(240,192,64,0.05);
}

/* LOAD MORE */
.load-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: 40px;
}

/* EMPTY STATE */
.empty-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--fg-secondary);
  grid-column: 1 / -1;
}

.empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 { font-family: var(--font-display); font-size: 22px; margin-bottom: 8px; color: var(--fg-primary); }
.empty-sub { font-size: 14px; color: var(--fg-muted); margin-bottom: 24px; }

/* GAME DETAIL */
.game-detail { padding: 40px 24px 80px; }
.game-detail-inner { max-width: 1000px; margin: 0 auto; }

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--fg-muted);
  margin-bottom: 32px;
}

.breadcrumb a { color: var(--fg-secondary); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb-current { color: var(--fg-primary); }

.game-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 40px;
  margin-bottom: 48px;
  flex-wrap: wrap;
}

.game-info { flex: 1; min-width: 240px; }

.game-genre-tag {
  font-size: 11px;
  color: var(--fg-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.game-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 48px);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 20px;
}

.deal-score-display {
  display: flex;
  align-items: center;
  gap: 16px;
}

.score-ring-large {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(240,192,64,0.08);
  box-shadow: 0 0 24px rgba(240,192,64,0.15);
}

.score-num-large {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.score-label-large {
  font-size: 9px;
  color: var(--fg-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* BEST PRICE BOX */
.game-actions { display: flex; flex-direction: column; gap: 16px; align-items: flex-end; }

.best-price-box {
  background: var(--bg-card);
  border: 1px solid rgba(240,192,64,0.25);
  padding: 20px 24px;
  text-align: right;
  min-width: 220px;
}

.bp-label {
  font-size: 11px;
  color: var(--fg-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.bp-store {
  font-size: 13px;
  color: var(--fg-secondary);
  margin-bottom: 12px;
}

.bp-price-row {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 10px;
}

.bp-original {
  font-size: 14px;
  color: var(--fg-muted);
  text-decoration: line-through;
}

.bp-current {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  color: var(--accent);
}

.btn-watch-large {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-secondary);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-watch-large:hover {
  border-color: rgba(240,192,64,0.4);
  color: var(--accent);
  background: rgba(240,192,64,0.05);
}

.btn-watch-large.watching {
  background: rgba(240,192,64,0.1);
  border-color: rgba(240,192,64,0.5);
  color: var(--accent);
}

/* PRICE TABLE */
.price-table-wrap { margin-bottom: 48px; }

.section-title-sm {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 16px;
  color: var(--fg-secondary);
}

.price-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.price-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--fg-muted);
  border-bottom: 1px solid var(--border);
}

.price-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--fg-secondary);
}

.price-table tr.row-on-sale td { background: rgba(240,192,64,0.03); }
.price-table tr:last-child td { border-bottom: none; }

.store-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--fg-primary);
  font-weight: 500;
}

.store-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.store-dot-steam { background: #1a9fff; }
.store-dot-epic { background: #9b59b6; }
.store-dot-gog { background: #d35400; }
.store-dot-humble { background: #2ecc71; }
.store-dot-psn { background: #0070d1; }

.price-cell { font-family: var(--font-display); font-size: 15px; }

.discount-tag {
  display: inline-block;
  background: rgba(78,205,196,0.1);
  border: 1px solid rgba(78,205,196,0.3);
  color: #4ecdc4;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
}

.discount-tag.sm { font-size: 11px; padding: 1px 6px; }

.status-on-sale {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--accent);
  border: 1px solid rgba(240,192,64,0.3);
  padding: 2px 8px;
}

.status-regular {
  font-size: 12px;
  color: var(--fg-muted);
}

.btn-visit {
  display: inline-block;
  padding: 4px 12px;
  border: 1px solid var(--border);
  color: var(--fg-secondary);
  font-size: 13px;
  text-decoration: none;
  transition: all 0.2s;
}

.btn-visit:hover {
  border-color: rgba(240,192,64,0.4);
  color: var(--accent);
}

.muted { color: var(--fg-muted); }

/* PRICE HISTORY */
.history-wrap { }

.loading-bar {
  padding: 24px;
  color: var(--fg-muted);
  font-size: 14px;
}

.history-list { display: flex; flex-direction: column; }

.history-row {
  display: grid;
  grid-template-columns: 140px 1fr 1fr;
  gap: 16px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

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

.history-store {
  font-weight: 500;
  color: var(--fg-primary);
}

.history-price {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 16px;
}

.history-date { color: var(--fg-muted); font-size: 13px; }

.history-empty { padding: 24px 16px; font-size: 14px; color: var(--fg-muted); }

/* WATCHLIST PAGE */
.watchlist-page { padding: 40px 24px 80px; }
.watchlist-inner { max-width: 1280px; margin: 0 auto; }

.watchlist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.watchlist-count {
  font-size: 14px;
  color: var(--fg-muted);
}

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

.watchlist-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: relative;
  transition: border-color 0.2s, transform 0.2s;
}

.watchlist-card:hover {
  border-color: rgba(240,192,64,0.25);
  transform: translateY(-2px);
}

.wl-card-link {
  flex: 1;
  text-decoration: none;
  color: inherit;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.wl-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  min-height: 28px;
}

.wl-card-body { flex: 1; }

.wl-card-footer {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.target-price {
  font-size: 12px;
  color: var(--fg-muted);
  margin-top: 6px;
}

.remove-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 24px;
  height: 24px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  padding: 0;
}

.remove-btn:hover {
  border-color: rgba(255,80,80,0.4);
  color: #ff5050;
  background: rgba(255,80,80,0.08);
}

.watchlist-empty { max-width: 400px; margin: 0 auto; }

/* ERROR PAGE */
.error-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}

.error-inner { max-width: 400px; }

.error-code {
  font-family: var(--font-display);
  font-size: 96px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 16px;
  opacity: 0.6;
}

.error-inner h1 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 12px;
}

.error-inner p { color: var(--fg-secondary); margin-bottom: 32px; }

/* RESPONSIVE */
@media (max-width: 768px) {
  .app-header-inner { padding: 0 16px; gap: 12px; }
  .app-header-search { display: none; }

  .stats-bar-inner {
    padding: 0;
    gap: 0;
    overflow-x: auto;
  }

  .stat-item { padding: 0 16px; flex-shrink: 0; }
  .stat-sep { display: none; }
  .stat-refresh { display: none; }

  .deals-section, .game-detail, .watchlist-page { padding: 24px 16px 60px; }

  .deals-header { flex-direction: column; }

  .game-detail-header { flex-direction: column; gap: 24px; }
  .game-actions { align-items: flex-start; }
  .best-price-box { text-align: left; }
  .bp-price-row { justify-content: flex-start; }

  .price-table { font-size: 13px; }
  .price-table th, .price-table td { padding: 10px; }

  .history-row { grid-template-columns: 1fr 1fr; }
  .history-date { display: none; }
}
