/* ═══════════════════════════════════════════════════
   Gun & Ammo Matcher — Premium Tactical Dark Theme
   ═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  /* ── Palette: Gunmetal Tactical ── */
  --bg:           #1A1C23;  /* Gunmetal */
  --bg-elevated:  #22242B;  /* Slightly lighter gunmetal */
  --bg-card:      #252830;  /* Card surface */
  --bg-input:     #16181E;  /* Darker input bg */
  --bg-hover:     #2D3038;  /* Hover state */

  --text-primary:   #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted:     #64748B;

  --accent:         #D97706;
  --accent-hover:   #F59E0B;
  --accent-glow:    rgba(217, 119, 6, 0.15);
  --accent-border:  rgba(217, 119, 6, 0.3);

  --success:        #34D399;
  --warning:        #FBBF24;
  --danger:         #F87171;

  --border:         #2E3138;  /* Gunmetal border */
  --border-light:   #3A3D45;  /* Lighter border */

  --shadow-sm:  0 1px 2px rgba(0,0,0,0.3);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg:  0 8px 30px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 20px rgba(217, 119, 6, 0.08);

  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-hover); }

/* ══════════════════════════════════════
   LAYOUT — Single Column
   ══════════════════════════════════════ */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.5rem;
  width: 100%;
}

.main-content {
  max-width: 960px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  width: 100%;
}

/* ══════════════════════════════════════
   NAVBAR
   ══════════════════════════════════════ */
.navbar {
  background: rgba(26, 28, 35, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.nav-brand {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.nav-brand:hover { color: var(--accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.nav-links a {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}
.nav-links a:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: var(--accent);
  color: #000;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 700;
  margin-left: 4px;
}

/* ══════════════════════════════════════
   HERO
   ══════════════════════════════════════ */
.hero {
  text-align: center;
  margin-bottom: 3rem;
  padding: 2.5rem 0 1rem;
}
.hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}
.subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
  font-weight: 400;
}

.stats-bar {
  display: flex;
  justify-content: center;
  gap: 3rem;
  margin-top: 2rem;
}
.stat { text-align: center; }
.stat strong {
  display: block;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.02em;
}
.stat span {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* ══════════════════════════════════════
   SEARCH GRID — The Core Feature
   ══════════════════════════════════════ */
.search-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.search-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  transition: box-shadow 0.3s, border-color 0.3s;
  position: relative;
  overflow: hidden;
}
.search-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}
.search-box:hover {
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  border-color: var(--border-light);
}
.search-box:hover::before { opacity: 1; }

.search-box h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
  letter-spacing: -0.01em;
}
.search-box p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
}

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

.search-input-wrap input {
  width: 100%;
  padding: 0.85rem 1.1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: all 0.25s;
}
.search-input-wrap input::placeholder { color: var(--text-muted); }
.search-input-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--bg-elevated);
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  max-height: 320px;
  overflow-y: auto;
  z-index: 50;
  display: none;
  box-shadow: var(--shadow-lg);
}
.search-results.active { display: block; }

.search-result-item {
  padding: 0.7rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.15s;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--bg-hover); }
.search-result-name { font-weight: 500; font-size: 0.9rem; }
.search-result-meta { font-size: 0.8rem; color: var(--text-muted); }
.search-result-type {
  font-size: 0.65rem;
  padding: 0.15rem 0.5rem;
  background: var(--bg-hover);
  border-radius: 4px;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ══════════════════════════════════════
   BROWSE SECTION
   ══════════════════════════════════════ */
.browse-section { margin-bottom: 2.5rem; }
.browse-section h2 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1rem;
}
.category-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem 0.75rem;
  text-align: center;
  transition: all 0.25s;
  display: block;
  color: var(--text-primary);
}
.category-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: var(--shadow-md), var(--shadow-glow);
  color: var(--text-primary);
}

.cat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--accent), #B45309);
  color: #fff;
  border-radius: 50%;
  font-weight: 800;
  font-size: 1rem;
  margin-bottom: 0.6rem;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.25);
}
.cat-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ══════════════════════════════════════
   SUPPORT SECTION
   ══════════════════════════════════════ */
.support-section {
  padding: 3rem 1.5rem;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.support-card {
  max-width: 700px;
  margin: 0 auto;
  text-align: center;
}
.support-card h3 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}
.support-slogan {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}
.support-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.btn-donation {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 500;
  transition: all 0.2s;
  display: inline-block;
}
.btn-donation:hover {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.25);
}

/* ══════════════════════════════════════
   DEALS CAROUSEL
   ══════════════════════════════════════ */
.deals-carousel-section {
  padding: 3rem 0;
  position: relative;
}
.deals-carousel-section h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  text-align: center;
}

.deals-carousel {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 0.75rem;
  -webkit-overflow-scrolling: touch;
}
.deals-carousel::-webkit-scrollbar { height: 5px; }
.deals-carousel::-webkit-scrollbar-track { background: var(--bg-card); border-radius: 3px; }
.deals-carousel::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }

.deal-card {
  min-width: 220px;
  max-width: 220px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  scroll-snap-align: start;
  transition: all 0.25s;
  flex-shrink: 0;
}
.deal-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: var(--shadow-md), var(--shadow-glow);
}

.deal-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}
.deal-discount {
  background: var(--accent);
  color: #000;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-weight: 800;
  font-size: 0.72rem;
}
.deal-retailer { font-size: 0.7rem; color: var(--text-muted); }
.deal-card-name {
  font-weight: 600;
  font-size: 0.88rem;
  margin-bottom: 0.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}
.deal-card-prices {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.price-original {
  text-decoration: line-through;
  color: var(--text-muted);
  font-size: 0.8rem;
}
.price-sale {
  color: var(--success);
  font-weight: 800;
  font-size: 1.1rem;
}
.deal-card .btn {
  width: 100%;
  text-align: center;
  padding: 0.5rem;
  font-size: 0.82rem;
}

.carousel-nav {
  position: absolute;
  top: 55%;
  transform: translateY(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  font-size: 1.1rem;
  color: var(--text-secondary);
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}
.carousel-nav:hover {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}
.carousel-prev { left: -18px; }
.carousel-next { right: -18px; }

/* ══════════════════════════════════════
   DETAIL PAGES
   ══════════════════════════════════════ */
.breadcrumb {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}
.breadcrumb a { color: var(--accent); }

.detail-header { margin-bottom: 2rem; }
.detail-header h1 {
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.6rem;
}
.detail-meta { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* Badges */
.badge-type {
  display: inline-block;
  padding: 0.3rem 0.85rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--accent);
  color: #000;
}
.badge-mfr {
  display: inline-block;
  padding: 0.3rem 0.85rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 500;
  background: var(--bg-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.badge-alt {
  display: inline-block;
  padding: 0.25rem 0.7rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 500;
  background: var(--bg-hover);
  color: var(--warning);
  border: 1px solid var(--border);
}
.badge-type-sm {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 600;
  background: var(--bg-hover);
  color: var(--text-secondary);
  text-transform: uppercase;
}

.detail-section { margin-bottom: 2rem; }
.detail-section h2 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

/* ══════════════════════════════════════
   CALIBER / GUN CARDS (Grid)
   ══════════════════════════════════════ */
.caliber-grid, .gun-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.caliber-card, .gun-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  transition: all 0.25s;
  display: block;
  color: var(--text-primary);
}
.caliber-card:hover, .gun-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  color: var(--text-primary);
}

.caliber-name, .gun-name {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
}
.caliber-type, .gun-mfr {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}
.caliber-spec { font-size: 0.78rem; color: var(--text-muted); }
.caliber-aliases {
  font-size: 0.72rem;
  color: var(--warning);
  margin-top: 0.4rem;
  font-style: italic;
}

/* ══════════════════════════════════════
   SPEC TABLE
   ══════════════════════════════════════ */
.spec-table {
  width: 100%;
  border-collapse: collapse;
  max-width: 500px;
}
.spec-table td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.spec-table td:first-child { color: var(--text-muted); width: 45%; }
.spec-table td:last-child { font-weight: 500; }

/* ══════════════════════════════════════
   BROWSE PAGE
   ══════════════════════════════════════ */
.filter-bar { margin-bottom: 1.5rem; }
.filter-form {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
}
.filter-group { display: flex; flex-direction: column; gap: 0.35rem; }
.filter-group label {
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.filter-group select,
.filter-group input[type="text"] {
  padding: 0.55rem 0.8rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
  min-width: 150px;
  cursor: pointer;
  transition: border-color 0.2s;
  font-family: inherit;
}
.filter-group select:focus,
.filter-group input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.count {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.5em;
  vertical-align: middle;
}

.gun-meta {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.3rem;
  flex-wrap: wrap;
}
.gun-year { font-size: 0.72rem; color: var(--text-muted); }

/* ══════════════════════════════════════
   PAGINATION
   ══════════════════════════════════════ */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.3rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}
.page-link {
  padding: 0.4rem 0.85rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.82rem;
  transition: all 0.2s;
}
.page-link:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}
.page-link.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
  font-weight: 700;
}
.page-ellipsis { padding: 0.4rem 0.5rem; color: var(--text-muted); }

/* ══════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════ */
.btn {
  display: inline-block;
  padding: 0.65rem 1.5rem;
  background: var(--accent);
  color: #000;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.88rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.btn:hover {
  background: var(--accent-hover);
  color: #000;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
}
.btn:active { transform: translateY(0); }

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--border);
  color: var(--text-primary);
  box-shadow: none;
}
.btn-sm { padding: 0.45rem 1rem; font-size: 0.82rem; }
.btn-block { display: block; text-align: center; margin-top: 0.75rem; }
.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0;
  font-family: inherit;
}
.btn-link:hover { text-decoration: underline; box-shadow: none; transform: none; }
.btn-xs { font-size: 0.72rem; }

/* ══════════════════════════════════════
   AD SLOTS
   ══════════════════════════════════════ */
.ad-slot {
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 auto;
}
.ad-leaderboard {
  max-width: 728px;
  width: 100%;
  height: 90px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}
.ad-placeholder { opacity: 0.4; }

/* ══════════════════════════════════════
   FOOTER
   ══════════════════════════════════════ */
.footer {
  text-align: center;
  padding: 2rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

/* ══════════════════════════════════════
   MISSING CALIBERS / SUGGESTIONS
   ══════════════════════════════════════ */
.suggestion-section { margin-top: 0.5rem; }
.suggestion-form { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; }
.suggest-input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
  font-family: inherit;
}
.suggest-input::placeholder { color: var(--text-muted); }

.suggestion-status { font-size: 0.8rem; margin-bottom: 0.5rem; min-height: 1.2em; }
.suggestion-status .success { color: var(--success); }
.suggestion-status .error { color: var(--danger); }

.suggestion-count { font-size: 0.8rem; color: var(--text-muted); display: flex; align-items: center; gap: 0.5rem; }

.suggestion-list {
  margin-top: 0.5rem;
  padding: 0.75rem;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}
.suggestion-item { padding: 0.4rem 0; border-bottom: 1px solid var(--border); }
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item .time { color: var(--text-muted); font-size: 0.7rem; }

/* ══════════════════════════════════════
   EMPTY STATE
   ══════════════════════════════════════ */
.empty-state {
  color: var(--text-muted);
  font-style: italic;
  padding: 1.5rem 0;
  text-align: center;
}
.empty-state h2 { font-size: 1.4rem; margin-bottom: 0.5rem; }

/* ══════════════════════════════════════
   FOOTER
   ══════════════════════════════════════ */
.footer {
  text-align: center;
  padding: 2rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

/* ══════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════ */
@media (max-width: 768px) {
  .main-content { padding: 1.5rem 1rem; }
  .search-grid { grid-template-columns: 1fr; }
  .category-grid { grid-template-columns: repeat(3, 1fr); }
  .hero h1 { font-size: 1.7rem; }
  .stats-bar { gap: 1.5rem; }
  .stat strong { font-size: 1.3rem; }
  .navbar { padding: 0.6rem 0; }
  .nav-inner { padding: 0 1rem; }
  .nav-links a { margin-left: 0.5rem; font-size: 0.78rem; padding: 0.3rem 0.5rem; }
  .caliber-grid, .gun-grid { grid-template-columns: 1fr; }
  .deal-card { min-width: 180px; }
  .filter-form { flex-direction: column; align-items: stretch; }
  .filter-group select { width: 100%; }
  .carousel-prev { left: -10px; }
  .carousel-next { right: -10px; }
  .support-buttons { flex-direction: column; align-items: center; }
}
