/* ===== RDR2 Western Theme ===== */

:root {
  --leather: #1c1410;
  --leather-dark: #120e0b;
  --leather-light: #2a1f18;
  --parchment: #d4c5a9;
  --parchment-bright: #e8dcc6;
  --gold: #c8a25c;
  --gold-dim: #a07d3a;
  --rustic-red: #8b2500;
  --rustic-red-light: #b33a00;
  --dark-wood: #3d2b1f;
  --aged-paper: #c4b28f;
  --ink: #1a1008;
  --danger: #a63030;
  --success: #4a7a3a;
  --info: #4a6a8a;
}

/* Tailwind custom colors */
.bg-leather { background-color: var(--leather); }
.bg-leather-dark { background-color: var(--leather-dark); }
.bg-leather-light { background-color: var(--leather-light); }
.text-parchment { color: var(--parchment); }
.text-gold { color: var(--gold); }
.border-gold { border-color: var(--gold); }

/* Base typography */
body {
  font-family: 'Lora', Georgia, 'Times New Roman', serif;
  background-color: var(--leather);
  color: var(--parchment);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(61, 43, 31, 0.3) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(139, 37, 0, 0.05) 0%, transparent 50%);
}

.font-heading {
  font-family: 'Cinzel', 'Times New Roman', serif;
}
.font-body {
  font-family: 'Lora', Georgia, serif;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--leather-dark);
}
::-webkit-scrollbar-thumb {
  background: var(--gold-dim);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--gold);
}
.scrollbar-hide::-webkit-scrollbar { display: none; }
.scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }

/* ===== Tab Navigation ===== */
.tab-btn {
  padding: 0.5rem 1rem;
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--parchment);
  opacity: 0.5;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: all 0.2s;
  background: none;
  cursor: pointer;
}
.tab-btn:hover {
  opacity: 0.8;
  color: var(--gold);
}
.tab-btn.active {
  opacity: 1;
  color: var(--gold);
  border-bottom-color: var(--gold);
}

/* Tab content visibility */
.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
}

/* ===== Cards ===== */
.card {
  background: linear-gradient(135deg, var(--leather-light) 0%, var(--leather) 100%);
  border: 1px solid rgba(200, 162, 92, 0.2);
  border-radius: 0.5rem;
  padding: 1.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(200, 162, 92, 0.05);
}

.item-card {
  background: linear-gradient(135deg, rgba(61, 43, 31, 0.6) 0%, rgba(28, 20, 16, 0.8) 100%);
  border: 1px solid rgba(200, 162, 92, 0.15);
  border-radius: 0.375rem;
  padding: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.item-card:hover {
  border-color: rgba(200, 162, 92, 0.4);
  box-shadow: 0 2px 8px rgba(200, 162, 92, 0.1);
}

/* ===== Section Titles ===== */
.section-title {
  font-family: 'Cinzel', serif;
  font-weight: 900;
  font-size: 1.5rem;
  color: var(--gold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid rgba(200, 162, 92, 0.2);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* ===== Filter Buttons ===== */
.filter-btn {
  padding: 0.35rem 0.75rem;
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--parchment);
  background: var(--leather-dark);
  border: 1px solid rgba(200, 162, 92, 0.2);
  border-radius: 0.25rem;
  cursor: pointer;
  transition: all 0.2s;
}
.filter-btn:hover {
  border-color: var(--gold);
  background: var(--dark-wood);
}
.filter-btn.active {
  background: var(--gold-dim);
  color: var(--ink);
  border-color: var(--gold);
}

/* ===== Stat Bars ===== */
.stat-bar-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.stat-bar-label {
  font-size: 0.7rem;
  font-family: 'Cinzel', serif;
  text-transform: uppercase;
  color: var(--parchment);
  opacity: 0.7;
  min-width: 5rem;
}
.stat-bar-track {
  flex: 1;
  height: 6px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 3px;
  overflow: hidden;
}
.stat-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}
.stat-bar-fill.gold { background: linear-gradient(90deg, var(--gold-dim), var(--gold)); }
.stat-bar-fill.red { background: linear-gradient(90deg, var(--rustic-red), var(--rustic-red-light)); }
.stat-bar-fill.green { background: linear-gradient(90deg, #3a6a2a, var(--success)); }
.stat-bar-fill.blue { background: linear-gradient(90deg, #3a5a7a, var(--info)); }

/* ===== Badges ===== */
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  font-size: 0.65rem;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-radius: 0.25rem;
  color: var(--parchment-bright);
}
.badge-gold {
  background: rgba(200, 162, 92, 0.2);
  border: 1px solid rgba(200, 162, 92, 0.4);
  color: var(--gold);
}
.badge-red {
  background: rgba(139, 37, 0, 0.2);
  border: 1px solid rgba(139, 37, 0, 0.4);
  color: var(--rustic-red-light);
}
.badge-green {
  background: rgba(74, 122, 58, 0.2);
  border: 1px solid rgba(74, 122, 58, 0.4);
  color: #6aaa4a;
}
.badge-blue {
  background: rgba(74, 106, 138, 0.2);
  border: 1px solid rgba(74, 106, 138, 0.4);
  color: #6a9aca;
}

/* Difficulty badges */
.diff-easy { background: rgba(74, 122, 58, 0.25); color: #7aba5a; border: 1px solid rgba(74, 122, 58, 0.4); }
.diff-medium { background: rgba(200, 162, 92, 0.2); color: var(--gold); border: 1px solid rgba(200, 162, 92, 0.4); }
.diff-hard { background: rgba(200, 100, 40, 0.2); color: #da7a3a; border: 1px solid rgba(200, 100, 40, 0.4); }
.diff-extreme { background: rgba(166, 48, 48, 0.25); color: #da4a4a; border: 1px solid rgba(166, 48, 48, 0.5); }

/* ===== Map Styling ===== */
#map-container {
  background: var(--leather-dark);
}
.leaflet-container {
  background: #1a1508 !important;
  font-family: 'Lora', serif;
}
.leaflet-control-zoom a {
  background: var(--leather-dark) !important;
  color: var(--gold) !important;
  border-color: rgba(200, 162, 92, 0.3) !important;
}
.leaflet-control-zoom a:hover {
  background: var(--dark-wood) !important;
}
.leaflet-popup-content-wrapper {
  background: var(--leather-dark) !important;
  color: var(--parchment) !important;
  border: 1px solid rgba(200, 162, 92, 0.3);
  border-radius: 0.375rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}
.leaflet-popup-tip {
  background: var(--leather-dark) !important;
}
.leaflet-popup-content {
  font-family: 'Lora', serif;
  font-size: 0.85rem;
  line-height: 1.4;
}
.leaflet-popup-content .popup-title {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  color: var(--gold);
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
}
.leaflet-popup-content .popup-category {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gold-dim);
  margin-bottom: 0.35rem;
}

/* ===== MarkerCluster Overrides ===== */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
  background: rgba(200, 162, 92, 0.2) !important;
}
.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
  background: rgba(200, 162, 92, 0.4) !important;
  color: var(--parchment) !important;
  font-family: 'Cinzel', serif;
  font-weight: 700;
}
.custom-cluster {
  background: transparent !important;
}

/* Region labels */
.region-label {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

/* ===== Search Results ===== */
#search-results .search-item {
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid rgba(200, 162, 92, 0.1);
  cursor: pointer;
  transition: background 0.15s;
}
#search-results .search-item:hover {
  background: rgba(200, 162, 92, 0.08);
}
#search-results .search-item:last-child {
  border-bottom: none;
}
#search-results .search-item .sr-name {
  color: var(--gold);
  font-weight: 700;
  font-size: 0.85rem;
}
#search-results .search-item .sr-type {
  font-size: 0.7rem;
  color: var(--parchment);
  opacity: 0.5;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
#search-results .search-item .sr-desc {
  font-size: 0.75rem;
  color: var(--parchment);
  opacity: 0.7;
  margin-top: 0.15rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== Treasure Chain Styling ===== */
.treasure-chain {
  border-left: 3px solid var(--gold-dim);
  padding-left: 1rem;
}
.treasure-step {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}
.treasure-step::before {
  content: attr(data-step);
  position: absolute;
  left: 0;
  top: 0;
  width: 1.2rem;
  height: 1.2rem;
  background: var(--gold-dim);
  color: var(--ink);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cinzel', serif;
  font-size: 0.65rem;
  font-weight: 900;
}

/* ===== Challenge Rank ===== */
.challenge-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  background: var(--gold-dim);
  color: var(--ink);
  border-radius: 50%;
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  font-weight: 900;
  flex-shrink: 0;
}

/* ===== Support Button ===== */
.support-btn {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink);
  background: linear-gradient(135deg, var(--gold), var(--gold-dim));
  border: 1px solid var(--gold);
  border-radius: 0.375rem;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  transition: all 0.2s;
}
.support-btn:hover {
  background: linear-gradient(135deg, var(--gold-dim), var(--gold));
  box-shadow: 0 6px 16px rgba(200, 162, 92, 0.3);
  transform: translateY(-1px);
}

/* ===== Ad Footer ===== */
.ad-footer {
  max-width: 80rem;
  margin: 2rem auto 0;
  padding: 0 1rem;
}

/* ===== Responsive Grid ===== */
@media (min-width: 640px) {
  .grid { grid-template-columns: repeat(1, 1fr); }
}
@media (min-width: 768px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  #weapons-list.grid,
  #horses-list.grid,
  #crafting-list.grid,
  #compendium-list.grid,
  #camp-list.grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ===== Loading State ===== */
.loading {
  text-align: center;
  padding: 2rem;
  color: var(--parchment);
  opacity: 0.5;
  font-style: italic;
}

/* ===== Accordion ===== */
.accordion-header {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--leather-dark);
  border: 1px solid rgba(200, 162, 92, 0.15);
  border-radius: 0.375rem;
  transition: background 0.2s;
}
.accordion-header:hover {
  background: var(--dark-wood);
}
.accordion-header .arrow {
  transition: transform 0.2s;
  color: var(--gold-dim);
}
.accordion-header.open .arrow {
  transform: rotate(90deg);
}
.accordion-body {
  display: none;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(200, 162, 92, 0.1);
  border-top: none;
  border-radius: 0 0 0.375rem 0.375rem;
  background: rgba(28, 20, 16, 0.5);
}
.accordion-body.open {
  display: block;
}
