:root {
  --bg-color: #050505;
  --header-bg: #0a0a0a;
  --primary-gradient: linear-gradient(to right, #22c55e, #3b82f6);
  --accent-cyan: cyan;
  --accent-red: #ff4444;
  --border-color: #222;
  --text-main: #fff;
  --text-dim: #999;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Base resets */
body {
  margin: 0;
  background: var(--bg-color);
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: var(--text-main);
  overflow-x: hidden;
  width: 100vw;
}

/* App Bar */
#app-bar {
  height: 50px;
  width: 100%;
  background: #000;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 15px;
  box-sizing: border-box;
  z-index: 1000;
  position: sticky;
  top: 0;
}

.app-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #ccc;
  transition: background 0.2s, color 0.2s;
}

.app-icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

#app-logo {
  font-weight: 900;
  font-size: 11px;
  letter-spacing: 2px;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  cursor: pointer;
}

#backend-status {
  font-size: 8px;
  color: #444;
  letter-spacing: 1px;
  font-weight: bold;
  text-transform: uppercase;
}

/* Utility for back button */
.back-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #ccc;
  cursor: pointer;
  transition: color 0.2s;
}

.back-btn:hover {
  color: #fff;
}

/* Animations */
@keyframes pulse {
  0% {
    opacity: 0.4;
  }

  50% {
    opacity: 1;
  }

  100% {
    opacity: 0.4;
  }
}

.loading-text {
  animation: pulse 1.5s infinite ease-in-out;
}

/* Market List View Styles */
.chip {
  padding: 8px 15px;
  background: #111;
  border: 1px solid #333;
  border-radius: 12px;
  font-size: 13px;
  color: #ccc;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 100px;
  text-align: center;
}

.chip:hover {
  background: #222;
  color: white;
  border-color: #555;
  transform: translateY(-2px);
}

.chip.active {
  background: #22c55e;
  border-color: #22c55e;
  color: black;
  font-weight: 700;
  box-shadow: 0 0 15px rgba(34, 197, 94, 0.3);
}

#histogram-wrapper {
  pointer-events: none;
  position: relative;
  width: 100%;
  height: 100px;
  z-index: 60;
  top: 115px;
}

#active-crop-card {
  width: 900px;
  min-width: 900px;
  /* Very wide for a premium feel */
  max-width: 98%;
  flex-shrink: 0;
  margin: 0;
  /* Ensure no shift */
}

@media (max-width: 768px) {
  #active-crop-card {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    border-radius: 0;
  }
}

@media (min-width: 768px) {
  #histogram-wrapper {
    top: 125px;
    height: 120px;
  }
}

.vol-cutoff-handle {
  pointer-events: auto !important;
  cursor: grab;
  z-index: 100;
  width: 14px;
  height: 24px;
  background: white !important;
  border-radius: 2px;
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
  display: block !important;
  transform: translateX(-50%);
  position: absolute;
  top: 50%;
}

.vol-cutoff-handle {
  pointer-events: auto !important;
  cursor: grab;
  z-index: 100;
  width: 14px;
  height: 24px;
  background: white !important;
  border-radius: 2px;
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
  display: block !important;
  transform: translateX(-50%);
}

.vol-cutoff-handle::after {
  content: attr(data-label);
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 8px;
  color: #fff;
  white-space: nowrap;
  background: rgba(0, 0, 0, 0.8);
  padding: 1px 4px;
  border-radius: 3px;
}

.market-list-row {
  display: flex;
  flex-direction: column;
  padding: 15px 15px;
  /* Increased padding */
  border-bottom: 1px solid #111;
  transition: background 0.2s;
  cursor: pointer;
}

/* Crop Selection Redesign */
.crop-nav-btn {
  width: 32px;
  height: 32px;
  background: rgba(0, 255, 255, 0.1);
  border: 1px solid rgba(0, 255, 255, 0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: cyan !important;
  font-size: 24px;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
  z-index: 10;
  backdrop-filter: blur(5px);
}

.crop-nav-btn:hover {
  background: rgba(0, 255, 255, 0.2);
  transform: scale(1.1);
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
}

/* Search Page Alphabetical UI */
.letter-divider {
  grid-column: 1 / -1;
  background: rgba(255, 255, 255, 0.05);
  padding: 5px 15px;
  color: cyan;
  font-size: 14px;
  font-weight: bold;
  border-left: 3px solid cyan;
  margin-top: 15px;
  border-radius: 4px;
  text-transform: uppercase;
  width: 100%;
  box-sizing: border-box;
}

.price-scale {
  width: 100%;
  height: 24px;
  position: relative;
  margin-top: 8px;
  /* Reduced from 12px for closer alignment */
  display: flex;
  align-items: center;
}

.price-scale-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: #222;
  z-index: 1;
}

.price-range-bar {
  position: absolute;
  height: 1px;
  background: rgba(0, 255, 255, 0.4);
  /* Cyan range bar */
  z-index: 2;
  box-shadow: 0 0 5px rgba(0, 255, 255, 0.2);
}

.price-dot {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  transform: translateX(-50%);
  z-index: 3;
}

.price-dot.min {
  background: #555;
}

.price-dot.max {
  background: #555;
}

.price-dot.modal {
  background: cyan;
  width: 5px;
  height: 5px;
  box-shadow: 0 0 8px cyan;
  z-index: 4;
}

.price-scale-tick {
  position: absolute;
  top: 14px;
  font-size: 8px;
  color: #444;
  /* Brighter tick labels */
  transform: translateX(-50%);
  font-family: monospace;
}

.price-scale-tick:last-child {
  transform: translateX(-100%);
}

.market-list-row:hover {
  background: rgba(255, 255, 255, 0.05);
}

.market-list-name {
  flex: 1;
  font-size: 13px;
  font-weight: bold;
}

.market-list-meta {
  font-size: 9px;
  color: #666;
  margin-top: 2px;
}

.market-list-stats {
  text-align: left;
  width: 120px;
}

.market-list-val {
  font-size: 12px;
  font-weight: 900;
  color: #fff;
}

.market-list-label {
  font-size: 8px;
  color: #555;
  text-transform: uppercase;
}

.market-list-diff {
  font-size: 8px;
  font-weight: bold;
}

.market-list-diff.pos {
  color: #22c55e;
}

.market-list-diff.neg {
  color: #ff4444;
}

.market-list-range {
  font-size: 9px;
  color: #666;
  font-family: monospace;
}

/* GPS Pulse */
#toggle-gps.active svg,
#list-gps-toggle.active svg {
  color: cyan;
  filter: drop-shadow(0 0 5px cyan);
  animation: gps-pulse 2s infinite;
}

@keyframes gps-pulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.1);
  }

  100% {
    transform: scale(1);
  }
}

/* Custom Scrollbar for List View */
#market-list-view::-webkit-scrollbar {
  width: 8px;
}

#market-list-view::-webkit-scrollbar-track {
  background: #050505;
}

#market-list-view::-webkit-scrollbar-thumb {
  background: #222;
  border-radius: 4px;
}

#market-list-view::-webkit-scrollbar-thumb:hover {
  background: #333;
}

/* Active Sort Column Glow */
.sort-column-active {
  color: cyan !important;
  text-shadow: 0 0 8px cyan, 0 0 12px cyan;
}

.sort-arrow-active {
  color: cyan !important;
  text-shadow: 0 0 8px cyan, 0 0 12px cyan;
  opacity: 1.0 !important;
}

/* Alphabet Divider for A-Z Sort */
.letter-divider {
  width: 100%;
  padding: 20px 0 10px;
  margin-top: 10px;
  font-size: 24px;
  font-weight: 900 !important;
  color: cyan !important;
  border-bottom: 1px solid rgba(0, 255, 255, 0.5);
  text-shadow: 0 0 15px rgba(0, 255, 255, 0.8), 0 0 30px cyan !important;
  letter-spacing: 2px;
  font-family: 'Inter', sans-serif;
  opacity: 1 !important;
}

/* ================== MARKET DETAIL PAGE (market.html) ================== */
.market-hero {
  background: linear-gradient(135deg, #050505 0%, #0a0a0a 100%);
  padding: 60px 20px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.market-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -20%;
  width: 140%;
  height: 140%;
  background: radial-gradient(circle, rgba(0, 255, 255, 0.03) 0%, transparent 70%);
  pointer-events: none;
}

.market-hero h1 {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: -1px;
  margin-bottom: 8px;
  background: linear-gradient(to bottom, #fff 50%, #888 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-transform: uppercase;
  margin-top: 0;
}

.market-hero p {
  color: cyan;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  opacity: 0.9;
  margin-bottom: 25px;
}

.market-stats-overview {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin: 30px auto 0;
  max-width: 600px;
}

.market-stat-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  padding: 15px 25px;
  border-radius: 16px;
  min-width: 150px;
  backdrop-filter: blur(10px);
}

.market-stat-card .label {
  font-size: 10px;
  text-transform: uppercase;
  color: #666;
  letter-spacing: 1.5px;
  margin-bottom: 5px;
}

.market-stat-card .value {
  font-size: 20px;
  font-weight: 900;
  color: #fff;
}

.market-stat-card .value span {
  font-size: 11px;
  color: #444;
  margin-left: 4px;
}

.commodity-container {
  padding: 30px 20px;
  max-width: 1000px;
  margin: 0 auto;
}

/* Crop Selector Rail - Removed/Disabled to prevent conflict with Index Page */
/* 
#crop-selector-container { ... } 
*/

.rail-item {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  opacity: 0.6;
  transition: all 0.3s ease;
  min-width: 60px;
}

.rail-item.active,
.rail-item:hover {
  opacity: 1;
  transform: scale(1.05);
}

body {
  background-color: #000;
  color: #fff;
  font-family: 'Inter', sans-serif;
  margin: 0;
  padding-bottom: 80px;
  /* Fix clipping on Mobile */
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

.rail-img-wrap {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid transparent;
  margin-bottom: 5px;
  background: #111;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rail-item.active .rail-img-wrap {
  border-color: cyan;
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.4);
}

.rail-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rail-days {
  font-size: 9px;
  color: #888;
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 8px;
}

.rail-item.active .rail-days {
  color: #fff;
  background: rgba(0, 255, 255, 0.2);
}

/* Crop List Styles */
.comm-item-new {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 12px 12px 12px 8px;
  /* Adjusted: Less on left, standard on right */
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 10px;
}

.comm-item-new:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(34, 211, 238, 0.3);
  transform: translateX(3px);
}

.comm-img-new {
  width: 70px;
  height: 70px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.comm-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.comm-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.comm-name-new {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 10px;
}

.comm-variety-new {
  font-size: 11px;
  color: #666;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.comm-stats-row {
  display: flex;
  gap: 20px;
  align-items: center;
}

.comm-data-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
}

.comm-data-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.comm-data-col.price-highlight {
  text-align: right;
}

.data-label {
  font-size: 9px;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.data-value {
  font-size: 13px;
  color: #aaa;
  font-weight: 600;
}

.data-value.modal {
  color: cyan;
  font-size: 16px;
  font-weight: 700;
}

.comm-stat-box {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.comm-stat-box .label {
  font-size: 9px;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.comm-stat-box .val {
  font-size: 13px;
  color: #aaa;
  font-weight: 600;
}

.comm-stat-box .val.cyan {
  color: cyan;
  font-size: 16px;
  font-weight: 700;
}

.price-trend {
  font-size: 10px;
  font-weight: bold;
  margin-left: 5px;
}

.price-trend.up {
  color: #22c55e;
}

.price-trend.down {
  color: #ff4444;
}

/* Circular Visualization Styles */
/* Intel Section */
.intel-viz-section {
  padding: 10px 20px 20px 20px;
  background: radial-gradient(circle at center, rgba(34, 211, 238, 0.05) 0%, transparent 70%);
  display: flex;
  flex-direction: column;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Year Filter Chips */
#year-filter-container {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 30px;
  z-index: 10;
}

.year-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #888;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.year-chip:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ccc;
}

.year-chip.active {
  background: rgba(0, 255, 255, 0.1);
  border-color: rgba(0, 255, 255, 0.4);
  color: #fff;
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.2);
}

.intel-viz-container {
  position: relative;
  width: 320px;
  height: 320px;
  margin: 0 auto;
}

#circular-intel-canvas {
  width: 100%;
  height: 100%;
}

.intel-center-info {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}

.intel-center-info .month-label {
  font-size: 10px;
  text-transform: uppercase;
  color: #444;
  letter-spacing: 2px;
}

.intel-center-info .volume-label {
  font-size: 16px;
  font-weight: 900;
  color: #fff;
  letter-spacing: 1px;
  text-transform: uppercase;
}



.monthly-legend {
  display: flex;
  gap: 15px;
  margin-top: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.month-tag {
  font-size: 10px;
  color: #666;
  background: rgba(255, 255, 255, 0.03);
  padding: 4px 10px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Price Scale Styles for Crop Cards */
.price-scale {
  position: relative;
  width: 100%;
  height: 30px;
  margin-top: 15px;
}

.price-scale-line {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-50%);
}

.price-range-bar {
  position: absolute;
  top: 50%;
  height: 4px;
  background: rgba(34, 211, 238, 0.3);
  transform: translateY(-50%);
  border-radius: 2px;
}

.price-dot {
  position: absolute;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  border: 2px solid #050505;
}

.price-dot.min {
  background: #818cf8;
}

.price-dot.max {
  background: #34d399;
}

.price-dot.modal {
  background: cyan;
  width: 12px;
  height: 12px;
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.price-scale-tick {
  position: absolute;
  font-size: 9px;
  color: #666;
  transform: translateX(-50%);
  white-space: nowrap;
  top: 100%;
  margin-top: 3px;
}

.price-scale-label {
  position: absolute;
  font-size: 8px;
  color: #444;
  transform: translateX(-50%);
  white-space: nowrap;
  font-weight: 600;
  letter-spacing: 0.5px;
}

@media (max-width: 650px) {
  .market-stats-overview {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    width: 100%;
    padding: 0 5px;
    box-sizing: border-box;
    margin-top: 15px;
    /* Pull it up slightly */
  }

  .market-stat-card {
    min-width: 0;
    padding: 6px 2px;
    /* Much tighter padding */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    /* Slightly smaller radius */
  }

  .market-stat-card .label {
    font-size: 7px;
    /* Smaller label */
    letter-spacing: 0.5px;
    text-align: center;
    margin-bottom: 2px;
  }

  .market-stat-card .value {
    font-size: 13px;
    /* Slightly smaller value */
    text-align: center;
  }

  .comm-item-new {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }

  .comm-stats-row {
    width: 100%;
    justify-content: space-between;
    gap: 10px;
  }
}

/* ================== SKELETON LOADING (SEQUENTIAL) ================== */
.skeleton {
  position: relative;
  overflow: hidden;
  background: #111;
}

.skeleton::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  transform: translateX(-100%);
  background-image: linear-gradient(90deg,
      rgba(255, 255, 255, 0) 0,
      rgba(255, 255, 255, 0.05) 20%,
      rgba(255, 255, 255, 0.1) 60%,
      rgba(255, 255, 255, 0));
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

#map-container.skeleton {
  background: #080808;
}

#controls-container.skeleton {
  background: #080808;
  border-top: 1px solid #222;
}

.skeleton>* {
  opacity: 0;
  transition: opacity 0.5s ease;
}

.skeleton-revealed>* {
  opacity: 1;
}

/* Debug Status Pill (Bottom Left) */
#debug-status-pill {
  position: fixed;
  bottom: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid #333;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 10px;
  color: #666;
  z-index: 9000;
  font-family: monospace;
  pointer-events: none;
  display: flex;
  gap: 8px;
  align-items: center;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #333;
}

.status-dot.ok {
  background: #00ff00;
  box-shadow: 0 0 5px #00ff00;
}

.status-dot.warn {
  background: #ff9f43;
}

.status-dot.error {
  background: #ff4444;
  box-shadow: 0 0 5px #ff4444;
}

/* Global Scrollbar Customization */
::-webkit-scrollbar {
  width: 6px;
  background-color: #000;
}

::-webkit-scrollbar-thumb {
  background-color: #333;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background-color: #444;
}


/* ================== AUTH PROMPT OVERLAY ================== */
#auth-prompt-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 200000;
  display: none;
  /* Changed from dynamic hide to explicit hide */
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

#auth-prompt-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.auth-modal {
  background: #0a0a0a;
  border: 1px solid #333;
  padding: 40px;
  border-radius: 24px;
  max-width: 420px;
  width: 90%;
  text-align: center;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.8);
  transform: scale(0.95) translateY(10px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

#auth-prompt-overlay.visible .auth-modal {
  transform: scale(1) translateY(0);
}

.auth-modal::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #22c55e, cyan);
}

.auth-icon-circle {
  width: 60px;
  height: 60px;
  background: rgba(34, 197, 94, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  color: #22c55e;
}

.btn-auth-primary {
  display: block;
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  text-decoration: none;
  border-radius: 12px;
  font-weight: 700;
  font-size: 15px;
  transition: all 0.2s;
  border: none;
  cursor: pointer;
}

.btn-auth-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(34, 197, 94, 0.4);
}

.btn-auth-secondary {
  width: 100%;
  padding: 12px;
  background: transparent;
  color: #666;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 13px;
  cursor: pointer;
  transition: color 0.2s;
}

.btn-auth-secondary:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

/* ================== CATEGORY BAR CHART ================== */
.category-analysis-container {
  margin-bottom: 25px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 20px;
}

.analysis-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.header-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.analysis-header h3 {
  margin: 0;
  font-size: 14px;
  letter-spacing: 1px;
  color: var(--text-dim);
  text-transform: uppercase;
}

.analysis-stats-summary {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  opacity: 0.8;
}

.analysis-stats-summary span {
  color: var(--accent-cyan);
}

#analysis-date-note {
  font-size: 11px;
  color: var(--accent-cyan);
  background: rgba(0, 255, 255, 0.1);
  padding: 4px 8px;
  border-radius: 4px;
}

.bar-chart-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 180px;
  padding-top: 20px;
  justify-content: space-between;
}

.category-bar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  min-width: 0;
}

.bar-visual {
  width: 14px;
  border-radius: 4px 4px 0 0;
  position: relative;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-height: 4px;
  cursor: pointer;
}

.bar-visual:hover {
  filter: brightness(1.2);
  transform: scaleY(1.05);
}

.bar-val-vertical {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%) rotate(-90deg);
  transform-origin: center center;
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
  color: rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

.bar-label {
  display: none;
}

/* Category Specific Colors */
.cat-color-1 {
  background: #3b82f6;
}

/* Cereals - Blue */
.cat-color-12 {
  background: #8b5cf6;
}

/* Pulses - Purple */
.cat-color-14 {
  background: #22c55e;
}

/* Vegetables - Green */
.cat-color-7 {
  background: #ef4444;
}

/* Fruits - Red */
.cat-color-13 {
  background: #f59e0b;
}

/* Spices - Amber */
.cat-color-9 {
  background: #06b6d4;
}

/* Oilseeds - Cyan */
.cat-color-3 {
  background: #ec4899;
}

/* Dry Fruits - Pink */
.cat-color-4 {
  background: #6366f1;
}

/* Fibre Crops - Indigo */
.cat-color-2 {
  background: #a16207;
}

/* Drug & Narcotics - Brown */
.cat-color-6 {
  background: #059669;
}

/* Forest Products - Emerald */
.cat-other {
  background: #64748b;
}

/* Other - Slate */

/* Chips color overrides */
.chip.cat-color-1.active {
  background: #3b82f6 !important;
  border-color: #3b82f6;
  color: white;
}

.chip.cat-color-12.active {
  background: #8b5cf6 !important;
  border-color: #8b5cf6;
  color: white;
}

.chip.cat-color-14.active {
  background: #22c55e !important;
  border-color: #22c55e;
  color: white;
}

.chip.cat-color-7.active {
  background: #ef4444 !important;
  border-color: #ef4444;
  color: white;
}

.chip.cat-color-13.active {
  background: #f59e0b !important;
  border-color: #f59e0b;
  color: white;
}

.chip.cat-color-9.active {
  background: #06b6d4 !important;
  border-color: #06b6d4;
  color: white;
}

.chip.cat-color-3.active {
  background: #ec4899 !important;
  border-color: #ec4899;
  color: white;
}

.chip.cat-color-4.active {
  background: #6366f1 !important;
  border-color: #6366f1;
  color: white;
}

.chip.cat-color-2.active {
  background: #a16207 !important;
  border-color: #a16207;
  color: white;
}

.chip.cat-color-6.active {
  background: #059669 !important;
  border-color: #059669;
  color: white;
}

.chip .chip-name {
  font-size: 12px;
  font-weight: 700;
}

.chip .chip-stats {
  font-size: 9px;
  opacity: 0.7;
  font-weight: 500;
}

/* Restored Sort Chip Styles (Glassy Look) */
.sort-chip {
  padding: 4px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #888;
  font-size: 10px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  backdrop-filter: blur(4px);
}

.sort-chip:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}

.sort-chip.active {
  background: rgba(0, 255, 255, 0.15);
  border-color: cyan;
  color: cyan;
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.2);
}

.sort-chip.disabled {
  opacity: 0.3;
  pointer-events: none;
  border-color: transparent;
  background: transparent;
}

/* Globally Hide Debug Status Elements */
#backend-status,
#debug-overlay {
  display: none !important;
}