/* ── PAGE HEADER ── */
.market-header-bg {
  background: linear-gradient(135deg, #e65100 0%, #f57c00 60%, #ffb74d 100%);
}

.page-header {
  padding-top: 64px;
  padding-bottom: 48px;
  text-align: center;
  color: white;
  position: relative;
  overflow: hidden;
}

.page-header::before {
  content: '📈';
  position: absolute;
  font-size: 180px;
  opacity: 0.06;
  top: -20px;
  right: 60px;
  pointer-events: none;
}

.page-header::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0; right: 0;
  height: 50px;
  background: var(--cream);
  clip-path: ellipse(55% 100% at 50% 100%);
}

.page-header-content { position: relative; z-index: 2; }
.page-icon { font-size: 48px; margin-bottom: 12px; }

.page-header h1 {
  font-family: 'Baloo 2', cursive;
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 8px;
}

.page-header p { font-size: 16px; opacity: 0.85; }

/* ── MARKET MAIN ── */
.market-main { padding: 40px 0 80px; }

/* ── FILTER BAR ── */
.filter-bar {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
  margin-bottom: 28px;
  border: 1px solid var(--border);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 160px;
}

.filter-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 5px;
}

.filter-group label i { color: #f57c00; }

.filter-select {
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--white);
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}

.filter-select:focus { border-color: #f57c00; }

.btn-fetch {
  background: #f57c00;
  color: white;
  border: none;
  border-radius: 10px;
  padding: 10px 22px;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
  white-space: nowrap;
  align-self: flex-end;
}

.btn-fetch:hover {
  background: #e65100;
  transform: translateY(-1px);
}

.btn-refresh {
  background: var(--green-pale);
  color: var(--green);
  border: 1.5px solid var(--green-light);
  border-radius: 10px;
  padding: 9px 18px;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
  white-space: nowrap;
  align-self: flex-end;
}

.btn-refresh:hover { background: #c8e6c9; }

/* ── SUMMARY CARDS ── */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.summary-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: transform 0.2s;
}

.summary-card:hover { transform: translateY(-2px); }

.summary-icon { font-size: 28px; }

.summary-info strong {
  display: block;
  font-family: 'Baloo 2', cursive;
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 2px;
}

.summary-info span {
  font-size: 12px;
  color: var(--text-light);
}

.summary-card.green  strong { color: var(--green); }
.summary-card.blue   strong { color: #0288d1; }
.summary-card.yellow strong { color: #f9a825; }
.summary-card.orange strong { color: #f57c00; }

/* ── LOADING & ERROR ── */
.loading-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}

.spinner {
  width: 48px; height: 48px;
  border: 4px solid var(--border);
  border-top-color: #f57c00;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.error-state {
  text-align: center;
  padding: 60px 20px;
  color: #e53935;
}

.error-state i { font-size: 40px; margin-bottom: 12px; display: block; }

/* ── WELCOME STATE ── */
.welcome-state {
  text-align: center;
  padding: 60px 20px;
}

.welcome-icon { font-size: 64px; margin-bottom: 16px; }

.welcome-state h2 {
  font-family: 'Baloo 2', cursive;
  font-size: 26px;
  color: var(--brown);
  margin-bottom: 10px;
}

.welcome-state p {
  font-size: 15px;
  color: var(--text-light);
  max-width: 480px;
  margin: 0 auto 28px;
  line-height: 1.7;
}

.popular-searches p {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 12px;
}

.popular-chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.popular-chip {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 8px 18px;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
}

.popular-chip:hover {
  background: #fff3e0;
  border-color: #f57c00;
  color: #e65100;
}

/* ── RESULTS SECTION ── */
.results-section { margin-top: 8px; }

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.results-header h2 {
  font-family: 'Baloo 2', cursive;
  font-size: 22px;
  color: var(--brown);
}

.results-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.search-input {
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  outline: none;
  width: 220px;
  transition: border-color 0.2s;
}

.search-input:focus { border-color: #f57c00; }

.btn-download {
  background: var(--green);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-download:hover { background: var(--green-light); }

/* ── PRICE TABLE ── */
.table-wrapper {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow-x: auto;
  margin-bottom: 20px;
}

.price-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.price-table thead tr {
  background: linear-gradient(90deg, #e65100, #f57c00);
  color: white;
}

.price-table th {
  padding: 13px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}

.price-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f5f5f5;
  color: var(--text);
  vertical-align: middle;
}

.price-table tbody tr:hover { background: #fff8f3; }
.price-table tbody tr:last-child td { border-bottom: none; }

.commodity-name {
  font-weight: 600;
  color: var(--brown);
  display: flex;
  align-items: center;
  gap: 6px;
}

.price-modal {
  font-weight: 700;
  color: var(--green);
  font-size: 15px;
}

.price-min { color: #e53935; font-weight: 500; }
.price-max { color: #0288d1; font-weight: 500; }

.trend-up   { color: var(--green); font-weight: 600; }
.trend-down { color: #e53935; font-weight: 600; }
.trend-stable { color: var(--text-light); font-weight: 500; }

.badge-fresh {
  background: #e8f5e9;
  color: var(--green);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

/* ── PAGINATION ── */
.pagination {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 16px;
}

.page-btn {
  width: 36px; height: 36px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-btn:hover { background: #fff3e0; border-color: #f57c00; }
.page-btn.active { background: #f57c00; color: white; border-color: #f57c00; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .summary-cards { grid-template-columns: repeat(2, 1fr); }
  .filter-bar    { flex-direction: column; }
  .filter-group  { width: 100%; }
  .btn-fetch, .btn-refresh { width: 100%; justify-content: center; }
  .results-header { flex-direction: column; align-items: flex-start; }
  .search-input   { width: 100%; }
}

@media (max-width: 480px) {
  .summary-cards { grid-template-columns: 1fr; }
}