/* ─── CA Handgun Roster — 2026 Edition ─── */

/* ─── DESIGN TOKENS ─────────────────────────────────────────────────────── */
:root {
  --navy:          #0b2545;
  --navy-mid:      #163960;
  --navy-light:    #1e4d7a;
  --gold:          #c89520;
  --gold-light:    #e8b93a;
  --gold-pale:     #fdf3d6;
  --bg:            #f2f4f8;
  --surface:       #ffffff;
  --surface-alt:   #f8fafc;
  --border:        #dde3ed;
  --border-light:  #eef1f7;
  --text:          #0f1d2e;
  --text-sec:      #4a5568;
  --text-muted:    #8896a8;
  --green:         #1a7f55;
  --green-bg:      #e6f4ef;
  --red:           #b91c1c;
  --red-bg:        #fde8e8;
  --shadow-xs:     0 1px 2px rgba(11,37,69,0.06);
  --shadow-sm:     0 2px 6px rgba(11,37,69,0.09);
  --shadow:        0 4px 16px rgba(11,37,69,0.12);
  --shadow-lg:     0 10px 32px rgba(11,37,69,0.16);
  --r-sm:          6px;
  --r:             10px;
  --r-lg:          16px;
  --r-xl:          24px;
  --sidebar-w:     280px;
  --header-h:      64px;
  --transition:    0.2s ease;
}

/* ─── RESET & BASE ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ─── SCROLLBAR ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--border-light); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── HEADER ─────────────────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--navy);
  border-bottom: 2px solid var(--gold);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
}

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

.header-seal {
  width: 40px;
  height: 40px;
  background: var(--gold);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.header-titles { display: flex; flex-direction: column; }
.header-titles h1 {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.03em;
  line-height: 1.2;
}
.header-titles span {
  font-size: 11px;
  color: var(--gold-light);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.header-divider {
  width: 1px;
  height: 32px;
  background: rgba(255,255,255,0.2);
  flex-shrink: 0;
}

.header-search {
  flex: 1;
  max-width: 440px;
  position: relative;
}

.header-search input {
  width: 100%;
  height: 38px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--r);
  padding: 0 12px 0 38px;
  color: #fff;
  font-size: 14px;
  outline: none;
  transition: var(--transition);
}
.header-search input::placeholder { color: rgba(255,255,255,0.45); }
.header-search input:focus {
  background: rgba(255,255,255,0.15);
  border-color: var(--gold);
}

.header-search .search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255,255,255,0.4);
  font-size: 15px;
  pointer-events: none;
}

.search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.15);
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  color: rgba(255,255,255,0.7);
  font-size: 12px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.search-clear:hover { background: rgba(255,255,255,0.3); }
.search-clear.visible { display: flex; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.header-stat {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--r);
  padding: 6px 12px;
  text-align: center;
}
.header-stat .stat-val {
  display: block;
  font-size: 16px;
  font-weight: 700;
  color: var(--gold-light);
  line-height: 1.1;
}
.header-stat .stat-lbl {
  display: block;
  font-size: 9px;
  color: rgba(255,255,255,0.45);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.menu-btn {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--r-sm);
  transition: var(--transition);
}
.menu-btn:hover { background: rgba(255,255,255,0.1); }

/* ─── HERO BANNER ────────────────────────────────────────────────────────── */
.hero-banner {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 60%, #1a5c9a 100%);
  color: #fff;
  padding: 28px 24px 24px;
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.hero-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 1;
}
.hero-content {
  max-width: 720px;
  position: relative;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--gold);
  color: var(--navy);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}
.hero-banner h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
  line-height: 1.2;
}
.hero-banner p {
  font-size: 13px;
  color: rgba(255,255,255,0.65);
  max-width: 580px;
}
.hero-banner a { color: var(--gold-light); text-decoration: none; }
.hero-banner a:hover { text-decoration: underline; }

.microstamp-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(200,149,32,0.15);
  border: 1px solid rgba(200,149,32,0.35);
  color: var(--gold-light);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: var(--r-sm);
  margin-top: 10px;
}

/* ─── LAYOUT ──────────────────────────────────────────────────────────────── */
.page-body {
  display: flex;
  gap: 0;
  max-width: 1440px;
  margin: 0 auto;
  min-height: calc(100vh - var(--header-h));
}

/* ─── SIDEBAR ────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  height: calc(100vh - var(--header-h));
  position: sticky;
  top: var(--header-h);
  overflow-y: auto;
  padding: 0 0 24px;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}
.sidebar-header h3 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.clear-all-btn {
  font-size: 12px;
  color: var(--gold);
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--r-sm);
  display: none;
  transition: var(--transition);
}
.clear-all-btn:hover { background: var(--gold-pale); }
.clear-all-btn.visible { display: block; }

/* Filter Section */
.filter-section {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border-light);
}

.filter-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  margin-bottom: 10px;
}
.filter-section-header h4 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-sec);
}
.filter-chevron {
  font-size: 11px;
  color: var(--text-muted);
  transition: transform var(--transition);
}
.filter-section.collapsed .filter-chevron { transform: rotate(-90deg); }
.filter-section.collapsed .filter-body { display: none; }

/* Status toggle */
.status-toggle {
  display: flex;
  gap: 6px;
}
.status-pill {
  flex: 1;
  padding: 6px 0;
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 600;
  border: 1.5px solid var(--border);
  background: none;
  color: var(--text-sec);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}
.status-pill:hover { border-color: var(--navy-light); color: var(--navy); }
.status-pill.active-pill {
  background: var(--green-bg);
  border-color: var(--green);
  color: var(--green);
}
.status-pill.all-pill.selected {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}
.status-pill.active-pill.selected {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

/* Checkbox list */
.filter-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 220px;
  overflow-y: auto;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}
.filter-option:hover { background: var(--surface-alt); }
.filter-option input[type="checkbox"] { display: none; }
.filter-option .check-box {
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  background: var(--surface);
}
.filter-option input:checked ~ .check-box {
  background: var(--navy);
  border-color: var(--navy);
}
.filter-option input:checked ~ .check-box::after {
  content: '✓';
  font-size: 10px;
  color: #fff;
  font-weight: 700;
}
.filter-option .option-label {
  font-size: 13px;
  color: var(--text-sec);
  flex: 1;
  line-height: 1.3;
}
.filter-option .option-count {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 600;
}

/* ─── MAIN CONTENT ───────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 20px 24px 40px;
}

/* Controls bar */
.controls-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.results-info {
  font-size: 13px;
  color: var(--text-muted);
  margin-right: auto;
}
.results-info strong { color: var(--text); font-weight: 700; }

.sort-select {
  height: 36px;
  padding: 0 30px 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: 13px;
  color: var(--text);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238896a8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
  outline: none;
  transition: var(--transition);
}
.sort-select:hover { border-color: var(--navy-light); }
.sort-select:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(11,37,69,0.08); }

.view-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--surface);
}
.view-btn {
  padding: 7px 11px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  color: var(--text-muted);
  transition: var(--transition);
}
.view-btn:hover { background: var(--bg); }
.view-btn.active { background: var(--navy); color: #fff; }

/* Active filter chips */
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--navy);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 8px 4px 10px;
  border-radius: 20px;
}
.chip-remove {
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}
.chip-remove:hover { background: rgba(255,255,255,0.4); }

/* ─── FIREARMS GRID ──────────────────────────────────────────────────────── */
.firearms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.firearms-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ─── FIREARM CARD ───────────────────────────────────────────────────────── */
.firearm-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  cursor: pointer;
  display: flex;
  flex-direction: column;
}
.firearm-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--navy-light);
}
.firearm-card:active { transform: translateY(0); }

.card-header {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
  padding: 14px 16px 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  position: relative;
  overflow: hidden;
  height: 100px;
  flex-shrink: 0;
  box-sizing: border-box;
}
.card-header::after {
  content: '';
  position: absolute;
  right: -20px;
  top: -20px;
  width: 80px;
  height: 80px;
  background: rgba(255,255,255,0.04);
  border-radius: 50%;
}

.card-make {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold-light);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-model {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin-top: 2px;
  line-height: 1.2;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.card-caliber {
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


.status-badge {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.status-active {
  background: rgba(26,127,85,0.2);
  color: #5de6a0;
  border: 1px solid rgba(93,230,160,0.3);
}
.status-expired {
  background: rgba(185,28,28,0.2);
  color: #fca5a5;
  border: 1px solid rgba(252,165,165,0.3);
}

/* Card image/icon area */
.card-img-row {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, var(--navy-mid) 0%, var(--navy) 100%);
  position: relative;
  height: 140px;
  overflow: hidden;
}
.card-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
  background: #fff;
}
.card-icon-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 16px;
}
.firearm-icon {
  width: 100px;
  height: 50px;
  opacity: 0.75;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}
.card-type-badge {
  position: absolute;
  bottom: 8px;
  right: 12px;
  font-size: 10px;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Card body */
.card-body {
  padding: 14px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-specs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.card-specs-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.spec-item {
  background: var(--bg);
  border-radius: var(--r-sm);
  padding: 7px 8px;
  text-align: center;
}
.spec-val {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}
.spec-lbl {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.card-tag {
  font-size: 11px;
  background: var(--gold-pale);
  color: #7a5c00;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 500;
  border: 1px solid rgba(200,149,32,0.2);
}
.card-tag.safety-tag {
  background: #e8f4ff;
  color: #1a4d8a;
  border-color: rgba(26,77,138,0.2);
}

.card-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--border-light);
  background: var(--surface-alt);
}

.card-price {
  display: flex;
  flex-direction: column;
}
.price-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}
.price-val {
  font-size: 17px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.1;
}

.card-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.roster-year {
  font-size: 10px;
  color: var(--text-muted);
}
.roster-year strong { color: var(--text-sec); }

.detail-btn {
  flex: 1;
  background: var(--navy);
  color: #fff;
  border: 2px solid transparent;
  border-radius: var(--r-sm);
  padding: 0 10px;
  height: 34px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  line-height: 1;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
}
.detail-btn:hover { background: var(--navy-light); }
.detail-btn svg { width: 13px; height: 13px; flex-shrink: 0; }

/* ─── LIST ROW ───────────────────────────────────────────────────────────── */
.list-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px 16px;
  display: grid;
  grid-template-columns: 2fr 2fr 1fr 1fr 80px;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: var(--transition);
}
.list-row:hover {
  border-color: var(--navy-light);
  background: var(--surface-alt);
  box-shadow: var(--shadow-sm);
}

.list-header {
  background: var(--navy);
  color: rgba(255,255,255,0.6);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  padding: 10px 16px;
  border-radius: var(--r);
  display: grid;
  grid-template-columns: 2fr 2fr 1fr 1fr 80px;
  gap: 10px;
  margin-bottom: 4px;
}

.list-make { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.07em; }
.list-model { font-size: 14px; font-weight: 700; color: var(--text); }
.list-field { font-size: 13px; color: var(--text-sec); }
.list-num { font-size: 13px; font-weight: 600; color: var(--text); text-align: center; }
.list-price { font-size: 14px; font-weight: 700; color: var(--navy); }
.list-status .status-badge { font-size: 10px; }

/* ─── EMPTY STATE ────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--text-muted);
}
.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}
.empty-state h3 {
  font-size: 18px;
  color: var(--text-sec);
  margin-bottom: 8px;
}
.empty-state p { font-size: 14px; max-width: 360px; margin: 0 auto 20px; }
.empty-clear-btn {
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: var(--r);
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.empty-clear-btn:hover { background: var(--navy-light); }

/* ─── MODAL ──────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--surface);
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95) translateY(8px);
  transition: transform var(--transition);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }

.modal-header {
  background: linear-gradient(135deg, var(--navy), var(--navy-light));
  padding: 24px 24px 20px;
  position: relative;
  overflow: hidden;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
}
.modal-header::before {
  content: '';
  position: absolute;
  right: -30px;
  top: -30px;
  width: 150px;
  height: 150px;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  z-index: 1;
}
.modal-close:hover { background: rgba(255,255,255,0.2); }

.modal-make {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold-light);
  margin-bottom: 4px;
}
.modal-model-name {
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 6px;
  line-height: 1.1;
}
.modal-subtitle {
  font-size: 14px;
  color: rgba(255,255,255,0.55);
  display: flex;
  align-items: center;
  gap: 12px;
}
.modal-subtitle span { display: flex; align-items: center; gap: 4px; }

.modal-body { padding: 24px; }

.modal-section { margin-bottom: 24px; }
.modal-section:last-child { margin-bottom: 0; }
.modal-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.modal-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-light);
}

.specs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}
.spec-card {
  background: var(--bg);
  border-radius: var(--r);
  padding: 12px;
  text-align: center;
}
.spec-card .spec-val {
  font-size: 18px;
  font-weight: 800;
  color: var(--navy);
  display: block;
  line-height: 1.1;
}
.spec-card .spec-lbl {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  display: block;
  margin-top: 3px;
}

.modal-description {
  font-size: 14px;
  color: var(--text-sec);
  line-height: 1.7;
  background: var(--bg);
  border-radius: var(--r);
  padding: 14px;
  border-left: 3px solid var(--gold);
}

.features-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.feature-tag {
  font-size: 12px;
  background: var(--gold-pale);
  color: #5a4000;
  padding: 5px 12px;
  border-radius: 20px;
  font-weight: 500;
  border: 1px solid rgba(200,149,32,0.25);
  display: flex;
  align-items: center;
  gap: 5px;
}
.safety-feature-tag {
  font-size: 12px;
  background: #e8f1fa;
  color: #0b3a6e;
  padding: 5px 12px;
  border-radius: 20px;
  font-weight: 500;
  border: 1px solid rgba(11,58,110,0.15);
  display: flex;
  align-items: center;
  gap: 5px;
}

.modal-roster-info {
  background: var(--navy);
  border-radius: var(--r);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.roster-info-item { text-align: center; }
.roster-info-val {
  display: block;
  font-size: 18px;
  font-weight: 800;
  color: var(--gold-light);
}
.roster-info-lbl {
  display: block;
  font-size: 10px;
  color: rgba(255,255,255,0.45);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-top: 2px;
}

/* ─── FOOTER ──────────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--navy);
  color: rgba(255,255,255,0.5);
  font-size: 12px;
  padding: 20px 24px;
  border-top: 2px solid var(--gold);
  line-height: 1.6;
}
.footer-content {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
.footer-icon {
  font-size: 20px;
  flex-shrink: 0;
  opacity: 0.6;
}
.site-footer strong { color: rgba(255,255,255,0.8); }
.site-footer a { color: var(--gold-light); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

/* ─── MOBILE OVERLAY BACKDROP ────────────────────────────────────────────── */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 49;
}

/* ─── RESPONSIVE ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .site-header { padding: 0 16px; gap: 10px; }
  .header-stat { display: none; }
  .menu-btn { display: flex; }

  .sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    height: calc(100vh - var(--header-h));
    z-index: 50;
    transform: translateX(-100%);
    transition: transform var(--transition);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.visible { display: block; }

  .page-body { display: block; }
  .main-content { padding: 16px; }

  .firearms-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  }
  .list-row, .list-header {
    grid-template-columns: 2fr 2fr 1fr;
  }
  .list-row > *:nth-child(n+4),
  .list-header > *:nth-child(n+4) {
    display: none;
  }
}

@media (max-width: 600px) {
  .hero-banner { padding: 20px 16px 18px; }
  .hero-banner h2 { font-size: 17px; }
  .firearms-grid { grid-template-columns: 1fr; }
  .controls-bar { gap: 8px; }
  .header-search { max-width: 200px; }
  .modal { max-height: 95vh; }
  .specs-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ─── LOADING SKELETON ───────────────────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -800px 0; }
  100% { background-position: 800px 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--border-light) 25%, var(--border) 50%, var(--border-light) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.6s infinite;
  border-radius: var(--r-sm);
}

/* ─── SCROLL TO TOP ──────────────────────────────────────────────────────── */
.scroll-top-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 40px;
  height: 40px;
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition), transform var(--transition);
  z-index: 90;
}
.scroll-top-btn.visible {
  opacity: 1;
  pointer-events: all;
}
.scroll-top-btn:hover { transform: translateY(-2px); background: var(--navy-light); }

/* ─── UTILITY ────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ─── CARD ACTIONS & BUY BUTTON ─────────────────────────────────────────── */
.card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.buy-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 10px;
  height: 34px;
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.01em;
  color: var(--gold);
  background: transparent;
  border: 2px solid var(--gold);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.buy-btn:hover {
  background: var(--gold);
  color: var(--navy);
}
.buy-btn svg { width: 13px; height: 13px; flex-shrink: 0; }

/* ─── MODAL IMAGE ────────────────────────────────────────────────────────── */
.modal-img-wrap {
  background: #fff;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 24px;
  max-height: 220px;
  overflow: hidden;
}
.modal-img {
  max-height: 188px;
  max-width: 100%;
  object-fit: contain;
}

/* ─── WHERE TO BUY / RETAILER GRID ──────────────────────────────────────── */
.retailer-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}
@media (max-width: 420px) { .retailer-grid { grid-template-columns: 1fr; } }

.retailer-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 14px;
  border-radius: var(--r);
  border: 1.5px solid var(--border);
  background: var(--surface);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
  position: relative;
}
.retailer-card:hover {
  border-color: var(--gold);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.retailer-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.retailer-desc {
  font-size: 12px;
  color: var(--text-sec);
}
.retailer-arrow {
  font-size: 11px;
  font-weight: 600;
  color: var(--gold);
  margin-top: 4px;
}
.affiliate-note {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: 4px;
  margin-bottom: 0;
}

/* Retailer price tags */
.retailer-price {
  display: inline-block;
  margin-top: 6px;
  font-size: 16px;
  font-weight: 700;
  color: var(--green);
}
.retailer-price-na {
  display: inline-block;
  margin-top: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--gold);
}
.retailer-card.has-price {
  border-color: var(--green);
  background: var(--green-bg);
}
.retailer-card.has-price .retailer-name { color: var(--green); }
.retailer-card.has-price:hover {
  border-color: var(--green);
  box-shadow: 0 2px 8px rgba(26,127,85,0.15);
}

/* ─── AD UNITS ───────────────────────────────────────────────────────────── */

/* Leaderboard ad (below hero, above page body) */
.leaderboard-ad-wrap {
  background: var(--surface);
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  overflow: hidden;
  /* Collapses to nothing when AdSense hasn't filled it */
}
.leaderboard-ad-wrap .adsbygoogle:not([data-ad-status="filled"]) {
  display: none !important;
}
.leaderboard-ad {
  width: 100%;
  max-width: 728px;
}

/* Sidebar ad (300×250 rectangle) */
.sidebar-ad-wrap {
  padding: 16px 16px 8px;
  border-top: 1px solid var(--border-light);
  margin-top: 8px;
  overflow: hidden;
}
.sidebar-ad-wrap .adsbygoogle:not([data-ad-status="filled"]) {
  display: none !important;
}
.sidebar-ad {
  width: 100%;
}

/* In-feed ad (spans full grid width) */
.infeed-ad-slot {
  grid-column: 1 / -1;
  overflow: hidden;
}
.infeed-ad-slot .adsbygoogle:not([data-ad-status="filled"]) {
  display: none !important;
}
.infeed-ad {
  width: 100%;
}

/* ─── PAGINATION ─────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 36px;
  flex-wrap: wrap;
}
.page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sec);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.page-btn:hover:not(:disabled) {
  border-color: var(--navy-light);
  color: var(--navy);
  background: var(--bg);
}
.page-btn.active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}
.page-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.page-sep {
  color: var(--text-muted);
  font-size: 14px;
  padding: 0 2px;
  user-select: none;
  line-height: 36px;
}

/* ─── MODAL PRICE BANNER ─────────────────────────────────────────────────── */
.ref-price-banner {
  background: var(--navy);
  border-radius: var(--r);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.ref-price-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.5);
  flex-shrink: 0;
}
.ref-price-val {
  font-size: 24px;
  font-weight: 800;
  color: var(--gold-light);
  line-height: 1;
}
.ref-price-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--gold);
  text-decoration: none;
  margin-left: auto;
  white-space: nowrap;
}
.ref-price-link:hover { text-decoration: underline; }
.ref-price-date {
  font-size: 11px;
  color: rgba(255,255,255,0.3);
  width: 100%;
  margin-top: -6px;
}

/* ─── KEYBOARD FOCUS ─────────────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* ─── TOUCH TARGETS ──────────────────────────────────────────────────────── */
@media (pointer: coarse) {
  .search-clear {
    width: 32px;
    height: 32px;
    right: 6px;
  }
  .chip-remove {
    width: 22px;
    height: 22px;
    font-size: 12px;
  }
  .menu-btn {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* ─── REDUCED MOTION ─────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
