/* Keepa Clone Stylesheet */
:root {
  --keepa-orange: #ff9900;
  --keepa-dark: #1b2838;
  --keepa-header: #131921;
  --keepa-blue: #3366cc;
  --keepa-used: #444444;
  --keepa-bb: #e6007e;
  --keepa-bsr: #109618;
  --bg-light: #f3f4f6;
  --card-bg: #ffffff;
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --border-color: #e5e7eb;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-light);
  color: var(--text-main);
  line-height: 1.5;
}

/* Header & Nav */
.navbar {
  background-color: var(--keepa-header);
  color: #fff;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: #fff;
}

.brand-logo {
  background: linear-gradient(135deg, #ff9900, #e07a22);
  color: #fff;
  font-weight: 900;
  font-size: 1.25rem;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  letter-spacing: 1px;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.brand-sub {
  color: #ff9900;
  font-size: 0.8rem;
  margin-left: 4px;
}

.nav-links {
  display: flex;
  gap: 0.5rem;
}

.nav-btn {
  background: transparent;
  border: none;
  color: #d1d5db;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.nav-btn:hover, .nav-btn.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.nav-btn.active {
  border-bottom: 2px solid var(--keepa-orange);
  border-radius: 6px 6px 0 0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.market-select {
  background: #232f3e;
  color: #fff;
  border: 1px solid #374151;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
}

/* Main Container */
.container {
  max-width: 1320px;
  margin: 1.5rem auto;
  padding: 0 1rem;
}

/* Search Bar Section */
.search-card {
  background: #fff;
  border-radius: 10px;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-color);
}

.search-form {
  display: flex;
  gap: 0.5rem;
}

.search-input-wrap {
  position: relative;
  flex: 1;
}

.search-input {
  width: 100%;
  padding: 0.85rem 1rem 0.85rem 2.75rem;
  font-size: 1rem;
  border: 2px solid #d1d5db;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s;
}

.search-input:focus {
  border-color: var(--keepa-orange);
  box-shadow: 0 0 0 3px rgba(255, 153, 0, 0.15);
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  font-size: 1.1rem;
}

.btn-search {
  background: linear-gradient(180deg, #f7dfa5, #f0c14b);
  border: 1px solid #a88734;
  color: #111;
  padding: 0 1.75rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-search:hover {
  background: linear-gradient(180deg, #f5d78e, #eeb933);
}

/* Presets Bar */
.presets-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.85rem;
  overflow-x: auto;
  padding-bottom: 4px;
}

.preset-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.preset-chip {
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  padding: 0.3rem 0.65rem;
  border-radius: 20px;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  color: #374151;
}

.preset-chip:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
}

.preset-chip.active {
  background: #ffedd5;
  border-color: var(--keepa-orange);
  color: #9a3412;
  font-weight: 600;
}

/* Product Overview Card */
.product-hero {
  background: #fff;
  border-radius: 10px;
  padding: 1.5rem;
  border: 1px solid var(--border-color);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  margin-bottom: 1.5rem;
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.product-img-box {
  width: 170px;
  height: 170px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #f0f0f0;
  border-radius: 8px;
  padding: 0.5rem;
  background: #fff;
}

.product-img-box img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.product-info {
  flex: 1;
}

.product-cat {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.25rem;
}

.product-title {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 0.5rem;
  color: #111827;
}

.product-meta-row {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.rating-badge {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: #f59e0b;
  font-weight: 600;
  font-size: 0.95rem;
}

.reviews-cnt {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.asin-tag {
  background: #eef2f6;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.85rem;
  color: #4b5563;
}

.price-badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.price-pill {
  padding: 0.6rem 0.85rem;
  border-radius: 8px;
  background: #f9fafb;
  border: 1px solid var(--border-color);
}

.pill-lbl {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.pill-val {
  font-size: 1.25rem;
  font-weight: 700;
  margin-top: 0.15rem;
}

.pill-val.amz { color: var(--keepa-orange); }
.pill-val.bb { color: var(--keepa-bb); }
.pill-val.bsr { color: var(--keepa-bsr); font-size: 1.1rem; }

.product-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.btn-action {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
  transition: all 0.2s;
}

.btn-primary-action {
  background: #ff9900;
  color: #fff;
  border: 1px solid #e07a22;
}

.btn-primary-action:hover {
  background: #e68a00;
}

.btn-outline-action {
  background: #fff;
  color: #374151;
  border: 1px solid #d1d5db;
}

.btn-outline-action:hover {
  background: #f9fafb;
}

/* Keepa Interactive Chart Card */
.chart-card {
  background: #fff;
  border-radius: 10px;
  padding: 1.5rem;
  border: 1px solid var(--border-color);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  margin-bottom: 1.5rem;
}

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

.chart-title {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.range-selectors {
  display: flex;
  background: #f3f4f6;
  padding: 3px;
  border-radius: 8px;
}

.range-btn {
  background: transparent;
  border: none;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #4b5563;
  cursor: pointer;
  transition: all 0.15s;
}

.range-btn.active {
  background: #fff;
  color: #111827;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Keepa Interactive Layer Toggles */
.layers-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: #fafafa;
  border: 1px solid #eee;
  border-radius: 8px;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.layers-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #6b7280;
}

.layer-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.layer-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}

.dot-amazon { background: var(--keepa-orange); }
.dot-new { background: var(--keepa-blue); }
.dot-used { background: var(--keepa-used); }
.dot-bb { background: var(--keepa-bb); }
.dot-bsr { background: var(--keepa-bsr); }

.chart-wrapper {
  position: relative;
  width: 100%;
  height: 420px;
}

/* Keepa Stats Matrix Table */
.stats-card {
  background: #fff;
  border-radius: 10px;
  padding: 1.5rem;
  border: 1px solid var(--border-color);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  margin-bottom: 1.5rem;
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-top: 1rem;
}

.stats-table th, .stats-table td {
  padding: 0.75rem 1rem;
  text-align: right;
  border-bottom: 1px solid #f3f4f6;
}

.stats-table th:first-child, .stats-table td:first-child {
  text-align: left;
}

.stats-table th {
  background: #f9fafb;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
}

.stats-table tr:hover td {
  background-color: #fafafa;
}

/* Deals Section */
.deals-filter-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  align-items: center;
}

.filter-select {
  padding: 0.5rem 0.85rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  font-size: 0.9rem;
  outline: none;
}

.deals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.25rem;
}

.deal-card {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
}

.deal-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
}

.deal-badge {
  background: #ef4444;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  align-self: flex-start;
  margin-bottom: 0.75rem;
}

.deal-img-box {
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.deal-img-box img {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
}

.deal-title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 0.5rem;
  height: 2.7rem;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.deal-prices {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-top: auto;
  margin-bottom: 0.75rem;
}

.deal-curr {
  font-size: 1.35rem;
  font-weight: 700;
  color: #111827;
}

.deal-old {
  font-size: 0.95rem;
  color: #9ca3af;
  text-decoration: line-through;
}

.deal-btn {
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  padding: 0.5rem;
  text-align: center;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.85rem;
  color: #1f2937;
  cursor: pointer;
  transition: all 0.15s;
}

.deal-btn:hover {
  background: var(--keepa-orange);
  color: #fff;
  border-color: var(--keepa-orange);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-overlay.open {
  display: flex;
}

.modal-box {
  background: #fff;
  border-radius: 10px;
  width: 90%;
  max-width: 500px;
  padding: 1.5rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #9ca3af;
}

.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.form-control {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.95rem;
}

.btn-submit {
  width: 100%;
  background: var(--keepa-orange);
  color: #fff;
  border: none;
  padding: 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
}

.btn-submit:hover {
  background: #e68a00;
}

/* Responsive */
@media (max-width: 768px) {
  .product-hero {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .product-meta-row {
    justify-content: center;
  }
  .product-actions {
    justify-content: center;
  }
  .chart-wrapper {
    height: 300px;
  }
}
