/* Premium Glassmorphism & Clean Typography */
:root {
  --bpph-primary: #1F2937;
  --bpph-accent: #3B82F6;
  --bpph-bg: #F9FAFB;
  --bpph-surface: rgba(255, 255, 255, 0.9);
  --bpph-border: #E5E7EB;
  --bpph-text: #111827;
  --bpph-text-light: #6B7280;
  --bpph-up: #EF4444; /* Red for price increase */
  --bpph-up-bg: #FEE2E2;
  --bpph-down: #10B981; /* Green for price decrease */
  --bpph-down-bg: #D1FAE5;
  --bpph-neutral: #9CA3AF;
  --bpph-neutral-bg: #F3F4F6;
  --bpph-radius: 12px;
  --bpph-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --bpph-shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.05);
}

.bpph-container {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bpph-bg);
  color: var(--bpph-text);
  padding: 24px;
  border-radius: var(--bpph-radius);
  box-shadow: var(--bpph-shadow-lg);
  max-width: 1200px;
  margin: 20px auto;
  box-sizing: border-box;
  overflow: hidden;
}

.bpph-container * {
  box-sizing: border-box;
}

.bpph-header {
  margin-bottom: 24px;
}

.bpph-header h2 {
  margin: 0 0 8px 0 !important;
  font-size: 24px;
  font-weight: 700;
  color: var(--bpph-primary);
}

.bpph-subtitle {
  margin: 0 !important;
  color: var(--bpph-text-light);
  font-size: 14px;
}

.bpph-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}

.bpph-filter-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  flex: 1;
}

.bpph-filter-group input, 
.bpph-filter-group select {
  padding: 10px 14px;
  border: 1px solid var(--bpph-border);
  border-radius: 8px;
  background: #fff;
  font-family: inherit;
  font-size: 14px;
  color: var(--bpph-text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.bpph-filter-group input:focus, 
.bpph-filter-group select:focus {
  border-color: var(--bpph-accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.bpph-layout-tabs {
  display: flex;
  background: #E5E7EB;
  border-radius: 8px;
  padding: 4px;
}

.bpph-btn-icon {
  background: transparent;
  border: none;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--bpph-text-light);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.bpph-btn-icon:hover {
  color: var(--bpph-text);
}

.bpph-btn-icon.active {
  background: #fff;
  color: var(--bpph-accent);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Loading & Error */
.bpph-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 0;
  color: var(--bpph-text-light);
}

.bpph-spinner {
  border: 4px solid var(--bpph-border);
  border-top: 4px solid var(--bpph-accent);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  animation: bpph-spin 1s linear infinite;
  margin-bottom: 16px;
}

@keyframes bpph-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.bpph-error {
  background: var(--bpph-up-bg);
  color: var(--bpph-up);
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 24px;
}

/* Table View */
.bpph-view-table {
  overflow-x: auto;
  border-radius: var(--bpph-radius);
  border: 1px solid var(--bpph-border);
  background: #fff;
}

.bpph-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  margin: 0 !important;
}

.bpph-table th {
  background: var(--bpph-bg);
  padding: 12px 16px;
  font-weight: 600;
  font-size: 13px;
  color: var(--bpph-text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--bpph-border);
}

.bpph-table td {
  padding: 16px;
  border-bottom: 1px solid var(--bpph-border);
  font-size: 14px;
}

.bpph-table tr:last-child td {
  border-bottom: none;
}

.bpph-table tr {
  transition: background-color 0.2s;
}

.bpph-table tr:hover {
  background-color: var(--bpph-bg);
}

.bpph-commodity {
  font-weight: 600;
  color: var(--bpph-text);
  display: block;
}

.bpph-cat-badge {
  display: inline-block;
  padding: 4px 8px;
  background: var(--bpph-neutral-bg);
  color: var(--bpph-text-light);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  margin-top: 4px;
}

.bpph-price {
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.bpph-change {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.bpph-change.up {
  background: var(--bpph-up-bg);
  color: var(--bpph-up);
}

.bpph-change.down {
  background: var(--bpph-down-bg);
  color: var(--bpph-down);
}

.bpph-change.neutral {
  background: var(--bpph-neutral-bg);
  color: var(--bpph-neutral);
}

/* Card View */
.bpph-view-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.bpph-card {
  background: #fff;
  border: 1px solid var(--bpph-border);
  border-radius: var(--bpph-radius);
  padding: 20px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.bpph-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--bpph-shadow);
}

.bpph-card-header {
  margin-bottom: 16px;
}

.bpph-card-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 8px 0;
  color: var(--bpph-text);
}

.bpph-card-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.bpph-stat {
  display: flex;
  flex-direction: column;
}

.bpph-stat-label {
  font-size: 12px;
  color: var(--bpph-text-light);
  margin-bottom: 4px;
}

.bpph-stat-value {
  font-size: 16px;
  font-weight: 600;
  color: var(--bpph-text);
}

.bpph-footer {
  margin-top: 24px;
  text-align: right;
  font-size: 12px;
  color: var(--bpph-text-light);
}

.bpph-footer a {
  color: var(--bpph-accent);
  text-decoration: none;
}
.bpph-footer a:hover {
  text-decoration: underline;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .bpph-controls {
    flex-direction: column;
    align-items: stretch;
  }
}
