:root {
  color-scheme: light;

  /* Light-blue theme */
  /* Closer to the mobile app's turquoise background */
  --bg: #0098e0;
  --fg: #0b1b2b;
  --muted: #4b5b6a;
  --border: #cfe1f5;
  --border2: #e1efff;
  --surface: #ffffff;
  --surface2: #eef6ff;
  /* Green action accent (app-like) */
  --primary: #2e7d32;
  --primaryText: #ffffff;
  
  /* Space theme colors */
  --space-black: #000000;
  --space-deep: #0a0a1a;
  --star-white: #ffffff;
  --star-blue: #4da8da;
  --star-yellow: #ffd700;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
}

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--fg);
}

/* Split Screen Layout */
.split-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
}

/* Left & Right Panels - Space Theme */
.space-panel {
  position: relative;
  width: 12%;
  min-width: 150px;
  background: linear-gradient(180deg, var(--space-black) 0%, var(--space-deep) 100%);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 40px 20px;
}

.space-panel:first-child {
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
}

.space-panel-right {
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.5);
}

.stars-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.space-logo-top,
.space-logo-bottom {
  position: relative;
  z-index: 10;
  width: 140px;
  height: auto;
  filter: 
    drop-shadow(0 0 20px rgba(77, 184, 166, 0.8))
    drop-shadow(0 0 40px rgba(77, 184, 166, 0.4))
    brightness(1.2);
  animation: float 6s ease-in-out infinite;
}

.space-logo-bottom {
  animation-delay: 3s;
}

/* Ad Container for Left Side Panel */
.ad-container-left {
  margin-top: auto;
  padding: 12px;
  background: rgba(248, 248, 249, 0.05);
  border-radius: 8px;
  width: 100%;
  box-sizing: border-box;
  position: relative;
  z-index: 5;
}

/* Ad Container for Right Side Panel */
.ad-container-right {
  margin-top: auto;
  padding: 12px;
  background: rgba(248, 248, 249, 0.05);
  border-radius: 8px;
  width: 100%;
  box-sizing: border-box;
  position: relative;
  z-index: 5;
}

.ad-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ad-close-btn {
  position: absolute;
  top: -8px;
  right: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  padding: 4px;
  cursor: pointer;
  z-index: 10;
  transition: background 0.2s;
}

.ad-close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-20px); }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Right Panel - Content Area */
.content-panel {
  flex: 1;
  background: var(--bg);
  overflow-y: auto;
  position: relative;
}

.container {
  max-width: 100%;
  padding: 16px 12px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
  overflow-x: hidden;
  box-sizing: border-box;
}

/* Responsive behavior */
@media (max-width: 1024px) {
  .space-panel {
    width: 8%;
    min-width: 60px;
    padding: 30px 8px;
  }
  
  .space-logo-top,
  .space-logo-bottom {
    width: 80px;
  }
}

@media (max-width: 768px) {
  .split-layout {
    flex-direction: column;
  }
  
  .space-panel {
    width: 100%;
    min-height: 150px;
    flex-direction: row;
    padding: 20px;
  }
  
  .ad-container-left,
  .ad-container-right {
    display: none;
  }
  
  .space-panel-right {
    order: 3;
  }
  
  .content-panel {
    order: 2;
    min-height: calc(100vh - 300px);
  }
  
  .space-logo-top {
    margin-right: auto;
  }
  
  .space-logo-bottom {
    margin-left: auto;
  }
}

.topbar {
  position: relative;
  background: var(--bg);
  color: var(--primaryText);
  padding: 8px 0 12px;
  border-bottom: 1px solid var(--border2);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-left: -8px;
}

.header-logo {
  width: 110px;
  height: auto;
  filter: 
    drop-shadow(0 0 12px rgba(255, 255, 255, 0.9))
    drop-shadow(0 0 6px rgba(255, 255, 255, 0.7))
    drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3))
    contrast(1.4) saturate(1.25);
}

.brand {
  font-size: 20px;
  margin: 0;
  color: inherit;
  flex: 1;
  font-family: 'Georgia', 'Times New Roman', serif;
  font-weight: bold;
  font-style: italic;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  letter-spacing: 0.5px;
}

/* Social Media Links */
.social-links {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* Donate Link */
.donate-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  font-size: 0.82rem;
  color: #f7931a;
  text-decoration: none;
  opacity: 0.85;
  transition: opacity 0.2s, color 0.2s;
  cursor: pointer;
}
.donate-link:hover {
  opacity: 1;
  color: #ffb347;
  text-decoration: underline;
}
.btc-icon {
  width: 14px !important;
  height: 14px !important;
  max-width: 14px;
  max-height: 14px;
  flex-shrink: 0;
  vertical-align: middle;
}

/* Donate Modal */
.donate-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}
.donate-modal-content {
  position: relative;
  background: #1a1a2e;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 32px 28px;
  max-width: 380px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.donate-modal-close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: none;
  border: none;
  color: #aaa;
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
}
.donate-modal-close:hover { color: #fff; }
.donate-modal-title {
  margin: 0 0 18px;
  font-size: 1.3rem;
  color: #f7931a;
}
.donate-qr {
  width: 260px;
  height: 260px;
  border-radius: 12px;
  margin-bottom: 14px;
}
.donate-address {
  font-family: monospace;
  font-size: 0.82rem;
  color: #ccc;
  word-break: break-all;
  margin: 0 0 12px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  user-select: all;
}
.donate-copy-btn {
  background: #f7931a;
  color: #000;
  border: none;
  border-radius: 8px;
  padding: 8px 24px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s;
  margin-bottom: 14px;
}
.donate-copy-btn:hover { background: #ffb347; }
.donate-warning {
  font-size: 0.72rem;
  color: #e57373;
  margin: 0;
  line-height: 1.4;
  opacity: 0.9;
}

.social-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  text-decoration: none;
  transition: all 0.3s ease;
  border: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  color: white;
  position: relative;
  overflow: hidden;
}

.social-btn:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.social-btn svg {
  width: 24px;
  height: 24px;
}

/* Google Play */
.google-play-btn {
  background: linear-gradient(135deg, #00D4FF 0%, #00C853 33%, #FFD600 66%, #FF5722 100%);
}

.google-play-btn:hover {
  background: linear-gradient(135deg, #00BFE5 0%, #00AC4F 33%, #FFC800 66%, #E64A19 100%);
}

/* Facebook */
.facebook-btn {
  background: #1877f2;
}

.facebook-btn:hover {
  background: #165ec7;
}

/* Instagram */
.instagram-btn {
  background: radial-gradient(circle at 35% 110%, #FFD521 0%, #F7951D 5%, #F15245 45%, #D92E7F 60%, #9B36B7 90%, #515BD4 100%);
}

.instagram-btn:hover {
  background: radial-gradient(circle at 35% 110%, #FFC107 0%, #FF7043 15%, #E91E63 45%, #9C27B0 70%, #673AB7 100%);
}

h2 {
  font-size: 16px;
  margin: 0 0 12px;
}

.card {
  /* Earth theme inside the rectangles */
  --fg: #2b2418;
  --muted: #6b5b45;
  --border: #d8c7a0;
  --border2: #eadfc9;
  --surface: #fbf7ef;
  --surface2: #e9f0dc;
  --primary: #3f6b3a;

  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
  background: var(--surface);
  color: var(--fg);
}

.row {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
}

/* AI Model Dropdown Styling */
select {
  font-family: inherit;
  cursor: pointer;
}

select:hover {
  border-color: #ffd700 !important;
}

select:focus {
  outline: none;
  border-color: #ffd700 !important;
  box-shadow: 0 0 4px rgba(255, 215, 0, 0.3);
}

/* Layout for Min/Max/Speed in 2 columns side-by-side */
.row.price-map-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: start;
  min-width: 360px;
}

.col-stack {
  display: grid;
  grid-template-rows: auto;
  gap: 8px;
}

@media (max-width: 980px) {
  .row.price-map-row {
    grid-template-columns: 1fr; /* stack all on small screens */
  }
}

.form {
  display: grid;
  gap: 6px;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
  flex: 1 1 150px;
}

.field.grow {
  flex: 1;
}

.label {
  font-size: 12px;
  color: var(--muted);
}

input,
select {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: var(--surface);
  color: var(--fg);
}

button {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  cursor: pointer;
  color: var(--fg);
}

button.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--primaryText);
  font-weight: 600;
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

button.secondary {
  background: var(--surface);
}

button:hover {
  filter: brightness(1.02);
}

input:focus,
select:focus,
button:focus {
  outline: 2px solid rgba(46, 125, 50, 0.25);
  outline-offset: 2px;
}

@supports (color: color-mix(in srgb, red, transparent)) {
  input:focus,
  select:focus,
  button:focus {
    outline-color: color-mix(in srgb, var(--primary) 35%, transparent);
  }
}

input:focus,
select:focus {
  border-color: var(--primary);
}

input[type="checkbox"] {
  accent-color: var(--primary);
}

.icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
}

.icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.status {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}

.muted {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.list {
  margin-top: 10px;
  display: grid;
  gap: 10px;
}

.item {
  border: 1px solid var(--border2);
  border-radius: 10px;
  padding: 10px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
}

.item-content-wrapper {
  display: flex;
  gap: 12px;
  flex-grow: 1;
}

.item-image-container {
  flex-shrink: 0;
  width: 120px;
  height: 120px;
  overflow: hidden;
  border-radius: 6px;
  background: linear-gradient(135deg, #f0f4f8 0%, #e1e8ed 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border: 1px solid var(--border);
}

.image-placeholder {
  position: absolute;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

/* Placeholder icon when no image or image fails to load */
.item-image-container::before {
  content: '📦';
  font-size: 48px;
  opacity: 0.3;
  position: absolute;
  pointer-events: none;
}

/* Hide placeholder when image loads successfully */
.item-image-container.has-image::before {
  display: none;
}

.item-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: relative;
  z-index: 1;
  background: transparent;
}

.item-right-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.item h3 {
  margin: 0 0 6px;
  font-size: 14px;
}

.meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.meta-details {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
  font-style: italic;
}

/* AI Intelligence Badges */
.ai-badges-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 6px;
}

.ai-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  width: fit-content;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Deal badge - Green for good deals */
.deal-badge {
  background: linear-gradient(135deg, #4caf50 0%, #2e7d32 100%);
  color: white;
  border-left: 3px solid #1b5e20;
}

/* Price trend badge - Purple/Gray for trend info */
.price-trend {
  background: linear-gradient(135deg, #7c4dff 0%, #651fff 100%);
  color: white;
  border-left: 3px solid #4527a0;
}

/* Value trend badge - Teal for long-term appreciation/depreciation */
.value-trend {
  background: linear-gradient(135deg, #00897b 0%, #004d40 100%);
  color: white;
  border-left: 3px solid #00695c;
  font-weight: 500;
}

/* Fraud warning - Red/Orange for suspicious items */
.fraud-warning {
  background: linear-gradient(135deg, #ff6f00 0%, #e65100 100%);
  color: white;
  border-left: 3px solid #bf360c;
}

/* Condition rating - Blue for condition info */
.condition-rating {
  background: linear-gradient(135deg, #2196f3 0%, #1565c0 100%);
  color: white;
  border-left: 3px solid #0d47a1;
}

/* Prutpris badge - Gold/Orange for negotiation opportunity */
.prutpris-badge {
  background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
  color: #e65100;
  border-left: 3px solid #ff6f00;
  font-weight: 600;
}

/* Under average price badge - Green, already a good deal */
.under-avg-badge {
  background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
  color: white;
  border-left: 3px solid #2e7d32;
  font-weight: bold;
}

/* Cross-country arbitrage badge - Gold/Globe for international price opportunity */
.arbitrage-badge {
  background: linear-gradient(135deg, #ffd54f 0%, #ffb300 100%);
  color: #3e2723;
  border-left: 3px solid #ff8f00;
  font-weight: 600;
}

/* Savings vs retail badge - Green for cheaper than buying new */
.savings-badge {
  background: linear-gradient(135deg, #43a047 0%, #1b5e20 100%);
  color: #fff;
  border-left: 3px solid #00c853;
  font-weight: 600;
}

/* Negotiable price badge */
.negotiable-badge {
  background: linear-gradient(135deg, #00897b 0%, #00695c 100%);
  color: #fff;
  border-left: 3px solid #00bcd4;
  font-weight: 600;
}

/* Quick filter pill buttons */
.quick-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 0 4px;
  overflow-x: auto;
}
.quick-filter-btn {
  padding: 5px 14px;
  border: 1px solid #c8e6c9;
  background: #f1f8e9;
  color: #2e7d32;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.quick-filter-btn:hover { background: #dcedc8; }
.quick-filter-btn.active {
  background: #4CAF50;
  color: white;
  border-color: #4CAF50;
}

/* Category-specific filters */
.category-filters {
  padding: 8px 0;
  margin-top: 4px;
}

/* Price distribution histogram */
.price-histogram {
  padding: 4px 0 8px;
}
.price-histogram-label {
  font-size: 11px;
  color: #888;
  margin-bottom: 2px;
}

/* Per-listing sparkline */
.listing-sparkline {
  height: 28px;
  margin: 4px 0;
}
.sparkline-svg {
  display: block;
}

.charity-badge {
  display: inline-block;
  background: linear-gradient(135deg, #4caf50 0%, #2e7d32 100%);
  color: white;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 6px;
  width: fit-content;
}

/* Multi-site availability indicator */
.multi-site-indicator {
  color: #00695c;
  font-size: 12px;
  font-weight: 500;
  background: rgba(0, 137, 123, 0.1);
  padding: 4px 8px;
  border-radius: 3px;
  border-left: 3px solid #00897b;
  margin: 4px 0;
}

.actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* AI Analysis button in listing cards */
.ai-analysis-btn {
  background: linear-gradient(135deg, rgba(76, 175, 80, 0.15), rgba(33, 150, 243, 0.15));
  color: #4CAF50;
  border: 1px solid rgba(76, 175, 80, 0.4);
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.ai-analysis-btn:hover {
  background: linear-gradient(135deg, rgba(76, 175, 80, 0.3), rgba(33, 150, 243, 0.3));
  border-color: rgba(76, 175, 80, 0.7);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(76, 175, 80, 0.25);
}

/* Share / Copy Link button in listing cards */
.share-link-btn {
  background: linear-gradient(135deg, rgba(33, 150, 243, 0.15), rgba(156, 39, 176, 0.15));
  color: #2196F3;
  border: 1px solid rgba(33, 150, 243, 0.4);
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.share-link-btn:hover {
  background: linear-gradient(135deg, rgba(33, 150, 243, 0.3), rgba(156, 39, 176, 0.3));
  border-color: rgba(33, 150, 243, 0.7);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(33, 150, 243, 0.25);
}

a {
  color: inherit;
}

.footer {
  margin-top: 16px;
  font-size: 12px;
  color: var(--muted);
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--fg);
}

/* Speed & Region Dialog */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  border-radius: 12px;
  padding: 24px;
  max-width: 600px;
  width: calc(100% - 32px);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.modal-content h2 {
  margin: 0 0 20px;
  font-size: 20px;
  color: #1a1a1a;
}

.speed-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.speed-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.2s;
}

.speed-option:hover {
  background: #f5f5f5;
}

.speed-option input[type="radio"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.speed-option span {
  font-size: 14px;
  color: #333;
}

.world-map-section {
  background: #0d1f2e;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
}

#worldMapCanvas {
  display: block;
  width: 100%;
  height: auto;
  cursor: pointer;
  border-radius: 4px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.btn-cancel,
.btn-ok {
  padding: 10px 24px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-cancel {
  background: transparent;
  color: #2e7d32;
}

.btn-cancel:hover {
  background: #f0f0f0;
}

.btn-ok {
  background: #2e7d32;
  color: white;
}

.btn-ok:hover {
  background: #246128;
}

@media (max-width: 600px) {
  .modal-content {
    padding: 16px;
    max-height: 95vh;
  }
  
  .modal-content h2 {
    font-size: 18px;
  }
}

/* Main page speed & region section */
.compact-controls {
  margin-top: 4px;
  margin-bottom: 4px;
}

.compact-controls .field {
  flex: 1 1 150px;
}

.compact-controls select {
  width: 100%;
}

.world-map-main {
  position: relative;
  max-width: 450px;
  margin: 0 auto;
}

.world-map-main img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
}

#worldMapMainCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  z-index: 2;
  pointer-events: auto;
}

/* Compact World Map (next to price inputs) */
.world-map-compact {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 200px;
  margin: 0 auto;
  justify-self: center;
  align-self: start;
  flex-shrink: 0;
}

.world-map-compact .label {
  font-size: 13px;
  font-weight: 500;
  color: var(--fg);
}

.world-map-small {
  position: relative;
  width: 200px;
  height: 200px;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  border: 2px solid var(--border);
  transition: border-color 0.2s;
}

.world-map-small:hover {
  border-color: var(--primary);
}

.world-map-small img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.world-map-small canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  z-index: 2;
  pointer-events: auto;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.loading-content {
  text-align: center;
  max-width: 400px;
  padding: 40px;
}

.spinning-globe {
  width: 200px;
  height: 200px;
  animation: spin 3s linear infinite;
  margin-bottom: 30px;
  filter: drop-shadow(0 0 20px rgba(77, 184, 166, 0.6));
  border-radius: 50%;
  clip-path: circle(50%);
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.progress-container {
  margin-bottom: 25px;
}

.progress-bar {
  width: 100%;
  height: 25px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 10px;
  border: 2px solid rgba(77, 184, 166, 0.3);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4db8a6, #66d4c0);
  width: 0%;
  transition: width 0.3s ease;
  box-shadow: 0 0 15px rgba(77, 184, 166, 0.8);
}

.progress-text {
  color: white;
  font-size: 18px;
  font-weight: bold;
  text-shadow: 0 0 10px rgba(77, 184, 166, 0.8);
}

.loading-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.btn-show-results, .btn-cancel-search {
  padding: 12px 24px;
  border-radius: 8px;
  border: none;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-show-results {
  background: #4db8a6;
  color: white;
}

.btn-show-results:hover {
  background: #66d4c0;
  transform: scale(1.05);
}

.btn-cancel-search {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.btn-cancel-search:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
}

/* Sort Container */
.sort-container {
  margin: 16px 0;
  padding: 12px;
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.sort-container .field {
  margin: 0;
}

.sort-container select {
  width: 100%;
  max-width: 300px;
  padding: 10px;
  font-size: 14px;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: white;
  cursor: pointer;
  transition: border-color 0.2s;
}

.sort-container select:hover {
  border-color: var(--primary);
}

/* AI Controls Styling */
.ai-controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  margin-top: 8px;
  position: relative;
  z-index: 10;
}

.ai-controls button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(240, 247, 255, 0.95));
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  position: relative;
  z-index: 10;
}

.ai-controls button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-color: var(--primary);
}

.ai-controls button:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.ai-controls button .icon {
  /* Override global .icon { width/height: 18px } so text icons like "IMG" don't overlap */
  width: auto;
  height: auto;
  min-width: 2.6em;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.5px;
  flex: 0 0 auto;
}

.ai-controls button .text {
  font-size: 14px;
  font-weight: 500;
}

/* Voice Button */
.voice-btn {
  border-color: #10b981 !important;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(5, 150, 105, 0.15)) !important;
}

.voice-btn:hover {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(5, 150, 105, 0.25)) !important;
  border-color: #059669 !important;
}

.voice-btn.listening {
  animation: pulse-green 1.5s ease-in-out infinite;
  border-color: #059669 !important;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.3), rgba(5, 150, 105, 0.35)) !important;
}

@keyframes pulse-green {
  0%, 100% { 
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  50% { 
    box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
  }
}

/* Image Button */
.image-btn {
  border-color: #8b5cf6 !important;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(124, 58, 237, 0.15)) !important;
}

.image-btn:hover {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(124, 58, 237, 0.25)) !important;
  border-color: #7c3aed !important;
}

/* Smart Search Button */
.ai-btn {
  border-color: #f59e0b !important;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(217, 119, 6, 0.15)) !important;
}

.ai-btn:hover {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.25)) !important;
  border-color: #d97706 !important;
}

/* Image Preview Container */
.image-preview {
  margin-top: 16px;
  padding: 16px;
  border: 2px dashed var(--border);
  border-radius: 12px;
  background: rgba(247, 250, 252, 0.8);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.04);
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.preview-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.clear-btn {
  padding: 4px 12px;
  font-size: 13px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 6px;
  color: #dc2626;
  cursor: pointer;
  transition: all 0.2s;
}

.clear-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: #dc2626;
}

.image-preview img {
  max-width: 100%;
  max-height: 300px;
  border-radius: 8px;
  display: block;
  margin: 0 auto 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.image-analysis {
  padding: 12px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-secondary);
  border-left: 3px solid var(--primary);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .ai-controls {
    justify-content: center;
  }
  
  .ai-controls button {
    flex: 1 1 calc(50% - 6px);
    min-width: 120px;
    justify-content: center;
  }
  
  .image-preview img {
    max-height: 200px;
  }
}

@media (max-width: 480px) {
  .ai-controls button {
    flex: 1 1 100%;
  }
  
  /* Responsive listing cards for mobile */
  .item-content-wrapper {
    flex-direction: column;
    gap: 8px;
  }
  
  .item-image-container {
    width: 100%;
    height: 180px;
  }
  
  .item-image-container::before {
    font-size: 64px;
  }
  
  .item h3 {
    font-size: 13px;
  }
  
  .meta {
    font-size: 11px;
  }
  
  .meta-details {
    font-size: 10px;
  }
  
  .charity-badge {
    font-size: 10px;
    padding: 2px 6px;
  }
}

/* Globe + region selection: base layout */
.globe-region-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 20px 0;
  flex-wrap: wrap;
}

.globe-col {
  flex: 0 0 200px;
  max-width: 200px;
}

.region-col {
  flex: 1;
  min-width: 0;
  max-width: 1200px;
}

#regionMapGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  width: 100%;
}

.region-card {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.2);
  transition: all 0.2s ease;
  background: transparent;
  min-height: 200px;
}

.region-card.overflow-visible {
  overflow: visible;
}

.region-map-bg {
  display: block;
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0.80;
}

.region-canvas {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.region-header {
  position: relative;
  padding: 20px 16px;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: white;
  z-index: 3;
  cursor: pointer;
  background: transparent;
  transition: background 0.2s ease;
}

.region-header:hover {
  background: transparent;
}

.region-countries {
  position: relative;
  display: none;
  padding: 8px 16px 16px;
  color: white;
  z-index: 3;
  background: transparent;
}

.region-countries.expanded {
  display: block !important;
  max-height: none !important;
  opacity: 1 !important;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .region-countries,
  .country-item,
  .region-card,
  .region-header {
    transition: none !important;
    animation: none !important;
  }
  
  .country-item {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* Mobile and touch device optimizations */
@media (max-width: 768px) {
  .region-card {
    min-width: 100%;
    margin-bottom: 12px;
  }
  
  .region-header {
    padding: 16px;
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  
  .region-header > div {
    font-size: 14px;
  }
  
  .country-item {
    padding: 12px;
    min-height: 44px;
    display: flex;
    align-items: center;
    margin-bottom: 8px;
  }
  
  .region-quick-actions {
    flex-direction: column;
    gap: 6px;
  }
  
  .region-action-btn {
    width: 100%;
    padding: 10px 12px !important;
  }
  
  #countryFilter {
    padding: 12px 14px !important;
    font-size: 14px !important;
  }
  
  .region-count {
    font-size: 11px !important;
    padding: 3px 6px !important;
  }
}

/* Prevent double-tap zoom on touch devices */
button, .country-item, .region-header {
  touch-action: manipulation;
}

.country-item {
  margin-bottom: 10px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  opacity: 0;
  transform: translateY(-10px);
  animation: fadeInSlide 0.3s ease forwards;
}

/* Staggered animation for country items */
.region-countries.expanded .country-item:nth-child(1) { animation-delay: 0.05s; }
.region-countries.expanded .country-item:nth-child(2) { animation-delay: 0.1s; }
.region-countries.expanded .country-item:nth-child(3) { animation-delay: 0.15s; }
.region-countries.expanded .country-item:nth-child(4) { animation-delay: 0.2s; }
.region-countries.expanded .country-item:nth-child(5) { animation-delay: 0.25s; }
.region-countries.expanded .country-item:nth-child(6) { animation-delay: 0.3s; }
.region-countries.expanded .country-item:nth-child(7) { animation-delay: 0.35s; }
.region-countries.expanded .country-item:nth-child(8) { animation-delay: 0.4s; }
.region-countries.expanded .country-item:nth-child(9) { animation-delay: 0.45s; }
.region-countries.expanded .country-item:nth-child(10) { animation-delay: 0.5s; }
.region-countries.expanded .country-item:nth-child(n+11) { animation-delay: 0.55s; }

@keyframes fadeInSlide {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.country-item:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateX(2px);
}

.country-item.selected {
  background: rgba(255, 255, 255, 0.3);
  border-left: 3px solid rgba(255, 255, 255, 0.8);
  font-weight: 600;
}

/* Region card selected state */
.region-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

/* Region header title - larger and bolder */
.region-header > div:first-child {
  font-size: 18px !important;
  font-weight: 700 !important;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.region-card.selected {
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 16px rgba(76, 175, 80, 0.4);
}

.region-header:hover {
  filter: brightness(1.1);
}

/* Keyboard focus indicators */
.region-header:focus,
.region-header:focus-visible {
  outline: 3px solid #ffd700;
  outline-offset: 2px;
  filter: brightness(1.2);
}

.country-item:focus,
.country-item:focus-visible {
  outline: 2px solid #ffd700;
  outline-offset: 1px;
  background: rgba(255, 255, 255, 0.25);
}

/* Loading Spinner */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-overlay.active {
  display: flex;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid #2e7d32;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-message {
  color: white;
  margin-left: 16px;
  font-size: 16px;
  font-weight: 600;
}

/* Globe + region selection: tablet/mobile layout */
@media (max-width: 900px) {
  .globe-region-row {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
  }

  .globe-col {
    flex: 0 0 auto !important;
    max-width: none !important;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .globe-col .world-map-small {
    order: 1;
  }

  .globe-col .quick-region-caption {
    order: 2;
    margin-top: 10px;
    margin-bottom: 0 !important;
  }

  .region-col {
    max-width: none !important;
    width: 100%;
  }

  #regionMapGrid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .region-header {
    padding: 16px !important;
  }

  .region-countries {
    padding: 0 16px 16px !important;
  }
}

@media (max-width: 480px) {
  .globe-col .world-map-small {
    width: 180px;
    height: 180px;
  }
}

/* Modal styles for Saved Searches */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: white;
  border-radius: 12px;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #e0e0e0;
}

.modal-header h2 {
  margin: 0;
  font-size: 18px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
}

.modal-close:hover {
  color: #000;
}

.modal-body {
  padding: 20px;
}

.saved-search-item {
  padding: 12px;
  margin: 10px 0;
  background: #f5f5f5;
  border-left: 4px solid #0098e0;
  border-radius: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.saved-search-item-content {
  flex-grow: 1;
}

.saved-search-item-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.saved-search-item-meta {
  font-size: 12px;
  color: #666;
}

.saved-search-item-actions {
  display: flex;
  gap: 8px;
}

.saved-search-item-actions button {
  padding: 6px 12px;
  font-size: 12px;
}

/* Search Stats Banner */
.search-stats-banner {
  background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
  border: 1px solid #90caf9;
  border-radius: 8px;
  padding: 12px 16px;
  margin: 16px 0;
  box-shadow: 0 2px 8px rgba(33, 150, 243, 0.15);
}

.stats-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.stats-icon {
  font-size: 20px;
}

.stats-text {
  font-size: 14px;
  color: #1976d2;
}

.stats-text strong {
  color: #0d47a1;
  font-weight: 600;
}

.stats-toggle {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid #90caf9;
  border-radius: 4px;
  padding: 4px 12px;
  font-size: 13px;
  color: #1565c0;
  cursor: pointer;
  transition: all 0.2s;
}

.stats-toggle:hover {
  background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.failed-adapters {
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 4px;
  font-size: 13px;
  color: #d32f2f;
}

.failed-adapters.hidden {
  display: none;
}

/* Repeat Last Search Button */
.repeat-search-btn {
  display: inline-block;
  margin-left: 10px;
  padding: 10px 16px;
  background: linear-gradient(135deg, #4fc3f7 0%, #29b6f6 100%);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(41, 182, 246, 0.3);
  transition: all 0.2s;
}

.repeat-search-btn:hover {
  background: linear-gradient(135deg, #29b6f6 0%, #039be5 100%);
  box-shadow: 0 4px 12px rgba(41, 182, 246, 0.5);
  transform: translateY(-1px);
}

.repeat-search-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(41, 182, 246, 0.3);
}

/* ===== ANALYSIS MODAL TABS ===== */
.analysis-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #e0e0e0;
  margin: -8px -4px 16px -4px;
}
.analysis-tab-btn {
  flex: 1;
  padding: 10px 16px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: #888;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
}
.analysis-tab-btn:hover { color: #333; background: #f5f5f5; }
.analysis-tab-btn.active {
  color: #2e7d32;
  border-bottom-color: #4CAF50;
}
.analysis-tab-content { display: none; }
.analysis-tab-content.active { display: block; }

/* Analysis cards */
.analysis-card {
  background: #f8f9fa;
  border: 1px solid #e8e8e8;
  border-radius: 10px;
  padding: 0;
  margin-bottom: 12px;
  overflow: hidden;
}
.analysis-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.analysis-card-header:hover {
  background: rgba(0,0,0,.03);
}
.analysis-card-header h4 {
  margin: 0;
  font-size: 13px;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex: 1;
}
.analysis-card-chevron {
  font-size: 14px;
  color: #999;
  transition: transform 0.25s ease;
  margin-left: 8px;
  flex-shrink: 0;
}
.analysis-card.expanded .analysis-card-chevron {
  transform: rotate(90deg);
}
.analysis-card-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, padding 0.25s ease;
  padding: 0 16px;
}
.analysis-card.expanded .analysis-card-body {
  max-height: 800px;
  padding: 0 16px 14px 16px;
}
/* Info text explaining data sources */
.analysis-card-info {
  margin-top: 10px;
  padding: 8px 10px;
  background: rgba(0,0,0,0.03);
  border-left: 2px solid #e0e0e0;
  border-radius: 0 6px 6px 0;
  font-size: 11px;
  line-height: 1.5;
  color: #999;
}
.analysis-card-info-icon {
  font-size: 10px;
  margin-right: 2px;
}

/* Legacy compatibility: cards without header/body structure */
.analysis-card > h4:first-child {
  margin: 0 0 10px 0;
  font-size: 13px;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Gauge bar (condition, confidence) */
.gauge-bar {
  height: 8px;
  background: #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
  margin: 6px 0;
}
.gauge-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
}

/* Vehicle info grid */
.vehicle-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}
.vehicle-info-item {
  text-align: center;
  padding: 10px;
  background: white;
  border-radius: 8px;
  border: 1px solid #eee;
}
.vehicle-info-item .label {
  font-size: 11px;
  color: #888;
  margin-bottom: 4px;
}
.vehicle-info-item .value {
  font-size: 18px;
  font-weight: 700;
  color: #333;
}

/* Bargain range visual */
.bargain-range {
  position: relative;
  height: 32px;
  background: linear-gradient(90deg, #e8f5e9, #fff9c4, #ffebee);
  border-radius: 6px;
  margin: 10px 0;
}
.bargain-marker {
  position: absolute;
  top: -4px;
  width: 3px;
  height: 40px;
  background: #333;
  border-radius: 2px;
}
.bargain-marker::after {
  content: attr(data-label);
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

/* Chart container */
.analysis-chart-container {
  position: relative;
  width: 100%;
  height: 280px;
  margin: 12px 0;
}
.analysis-chart-container canvas {
  width: 100% !important;
  height: 100% !important;
}

/* Fraud risk meter */
.fraud-meter {
  display: flex;
  align-items: center;
  gap: 10px;
}
.fraud-level {
  font-size: 14px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 12px;
}
.fraud-low { background: #e8f5e9; color: #2e7d32; }
.fraud-medium { background: #fff3e0; color: #e65100; }
.fraud-high { background: #ffebee; color: #c62828; }

/* Loading spinner for analysis tab */
.analysis-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: #888;
}
.analysis-spinner {
  width: 36px; height: 36px;
  border: 3px solid #e0e0e0;
  border-top-color: #4CAF50;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Widen quick-view modal for tabs */
#quickViewModal .modal-content {
  max-width: 960px;
}

/* ── Skip-to-content ── */
.skip-nav{position:absolute;top:-100%;left:50%;transform:translateX(-50%);background:#60a5fa;color:#0f172a;padding:10px 22px;border-radius:0 0 8px 8px;font-weight:700;font-size:14px;z-index:100000;text-decoration:none;transition:top .2s}
.skip-nav:focus{top:0}

/* ── Global keyboard focus ring (only on Tab, not click) ── */
*:focus-visible{outline:2px solid #60a5fa;outline-offset:2px}

/* ── Site footer (all pages) ── */
.site-footer{padding:28px 16px;border-top:1px solid #1f2a3b;text-align:center;color:#9ca3af;font-size:.82em;margin-top:40px}
.site-footer-links{display:flex;justify-content:center;gap:18px;flex-wrap:wrap;margin-bottom:10px}
.site-footer-links a{color:#60a5fa;text-decoration:none;font-size:13px}
.site-footer-links a:hover{text-decoration:underline}
.site-footer-copy{color:#6b7280;font-size:12px}

/* ── Homepage tools-nav chips: ensure 44 px tap targets on all screens ── */
.tools-nav a {
  min-height: 44px !important;
  display: inline-flex !important;
  align-items: center !important;
  box-sizing: border-box;
}

/* Scroll-arrow wrapper */
.tools-nav-wrap {
  position: relative;
  width: 100%;
}
.tools-nav-arrow {
  display: none; /* hidden on desktop */
}

/* Mobile: horizontal scroll strip – all chips on one row, swipe to see more */
@media (max-width: 768px) {
  .tools-nav {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    justify-content: flex-start !important;
    padding-bottom: 6px !important;
    padding-left: 36px !important;
    padding-right: 36px !important;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    scrollbar-width: none;
  }
  .tools-nav::-webkit-scrollbar { display: none; }
  .tools-nav a {
    flex-shrink: 0 !important;
    font-size: 13px !important;
    padding: 10px 14px !important;
  }
  /* Arrow buttons */
  .tools-nav-arrow {
    display: flex;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.18);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 50%;
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    z-index: 3;
    padding: 0;
    transition: opacity 0.25s, transform 0.25s;
    margin-top: 5px;
  }
  .tools-nav-arrow:active { background: rgba(255,255,255,0.35); }
  .tools-nav-arrow-left  { left: 0; }
  .tools-nav-arrow-right { right: 0; }
  /* Edge fade-out gradients */
  .tools-nav-wrap::before,
  .tools-nav-wrap::after {
    content: '';
    position: absolute;
    top: 10px;
    bottom: 0;
    width: 36px;
    pointer-events: none;
    z-index: 2;
  }
  .tools-nav-wrap::before {
    left: 0;
    background: linear-gradient(to right, rgba(0,28,60,0.85), transparent);
  }
  .tools-nav-wrap::after {
    right: 0;
    background: linear-gradient(to left, rgba(0,28,60,0.85), transparent);
  }
  /* Hide arrows when nothing to scroll */
  .tools-nav-arrow.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%) scale(0.7);
  }
}
