/* ===== CSS VARIABLES ===== */
:root {
  --primary: #059669;
  --primary-dark: #047857;
  --primary-light: #10b981;
  --primary-bg: #ecfdf5;
  --secondary: #0284c7;
  --accent: #f59e0b;
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
  --dark: #0f172a;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
}

/* ===== RESET ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ===== NAVBAR ===== */
.navbar {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0 1.5rem;
}

.navbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--primary);
}

.navbar-brand svg {
  width: 28px;
  height: 28px;
}

.navbar-menu {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
}

.navbar-menu a {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--gray-600);
  transition: all 0.2s;
}

.navbar-menu a:hover, .navbar-menu a.active {
  background: var(--primary-bg);
  color: var(--primary);
}

.navbar-menu a.active {
  font-weight: 600;
}

.navbar-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--gray-700);
}

/* ===== HERO ===== */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, #065f46 100%);
  color: white;
  padding: 3rem 1.5rem;
  text-align: center;
}

.hero-inner {
  max-width: 800px;
  margin: 0 auto;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

.hero p {
  font-size: 1.1rem;
  opacity: 0.9;
  margin-bottom: 2rem;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.hero-stat {
  text-align: center;
}

.hero-stat-value {
  font-size: 1.75rem;
  font-weight: 700;
}

.hero-stat-label {
  font-size: 0.85rem;
  opacity: 0.8;
}

/* ===== CONTAINER ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  flex: 1;
}

.container-narrow {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ===== SECTION TITLE ===== */
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.section-title h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-900);
}

.section-title .badge {
  background: var(--primary-bg);
  color: var(--primary);
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

/* ===== CARDS GRID ===== */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.grid-5 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

/* ===== PRICE CARD ===== */
.price-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: all 0.2s;
  cursor: default;
}

.price-card:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.price-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.price-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--primary-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.price-card-category {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-400);
  background: var(--gray-100);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}

.price-card-name {
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 0.25rem;
}

.price-card-satuan {
  font-size: 0.8rem;
  color: var(--gray-500);
}

.price-card-amount {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0.5rem 0;
}

.price-card-change {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}

.price-card-change.naik {
  color: var(--danger);
  background: #fef2f2;
}

.price-card-change.turun {
  color: var(--success);
  background: #f0fdf4;
}

.price-card-change.tetap {
  color: var(--gray-500);
  background: var(--gray-100);
}

.price-card-date {
  font-size: 0.75rem;
  color: var(--gray-400);
  margin-top: 0.5rem;
}

/* ===== PRODUCT CARD ===== */
.product-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
}

.product-card-image {
  position: relative;
  aspect-ratio: 1;
  background: var(--gray-100);
  overflow: hidden;
}

.product-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.product-card:hover .product-card-image img {
  transform: scale(1.05);
}

.product-card-label {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  background: var(--primary);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  text-transform: uppercase;
}

.product-card-platform {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(255,255,255,0.95);
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  box-shadow: var(--shadow-sm);
}

.product-card-platform .shopee { color: #ee4d2d; }
.product-card-platform .tiktok { color: #000; }
.product-card-platform .tokopedia { color: #42b549; }

.product-card-body {
  padding: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-card-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--gray-900);
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card-price {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.product-card-price-current {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--danger);
}

.product-card-price-original {
  font-size: 0.8rem;
  color: var(--gray-400);
  text-decoration: line-through;
}

.product-card-rating {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: var(--gray-500);
  margin-bottom: 0.75rem;
}

.product-card-rating .star {
  color: var(--accent);
}

.product-card-footer {
  margin-top: auto;
}

.btn-affiliate {
  display: block;
  width: 100%;
  padding: 0.75rem;
  text-align: center;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--primary);
  color: white;
}

.btn-affiliate:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.btn-affiliate.shopee {
  background: #ee4d2d;
}

.btn-affiliate.shopee:hover {
  background: #d63d1e;
}

.btn-affiliate.tiktok {
  background: #111;
}

.btn-affiliate.tiktok:hover {
  background: #2a2a2a;
}

.btn-affiliate.tokopedia {
  background: #42b549;
}

.btn-affiliate.tokopedia:hover {
  background: #37963f;
}

/* ===== TABLE ===== */
.table-wrapper {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
}

.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: var(--gray-50);
}

th {
  text-align: left;
  padding: 0.85rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

td {
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--gray-100);
}

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

tr:hover td {
  background: var(--gray-50);
}

.table-icon {
  font-size: 1.25rem;
  margin-right: 0.5rem;
}

.table-price {
  font-weight: 700;
  color: var(--gray-900);
}

.table-change {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-weight: 600;
  font-size: 0.85rem;
}

.table-change.naik { color: var(--danger); }
.table-change.turun { color: var(--success); }
.table-change.tetap { color: var(--gray-400); }

/* ===== FILTERS ===== */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  align-items: center;
}

.search-input {
  flex: 1;
  min-width: 200px;
  padding: 0.7rem 1rem 0.7rem 2.5rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") 0.75rem center no-repeat;
  transition: border-color 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.filter-select {
  padding: 0.7rem 2rem 0.7rem 1rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  background: white;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  transition: border-color 0.2s;
}

.filter-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.filter-btn-group {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 0.5rem 1rem;
  border: 1px solid var(--gray-200);
  background: white;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--gray-600);
}

.filter-btn:hover {
  border-color: var(--primary-light);
  color: var(--primary);
}

.filter-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* ===== STATS CARD ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
}

.stat-card-icon {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.stat-card-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-900);
}

.stat-card-label {
  font-size: 0.8rem;
  color: var(--gray-500);
}

/* ===== ALERT ===== */
.alert-info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  padding: 1rem;
  color: #1e40af;
  font-size: 0.9rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.alert-info svg {
  flex-shrink: 0;
  margin-top: 1px;
}

/* ===== FOOTER ===== */
.footer {
  background: white;
  border-top: 1px solid var(--gray-200);
  padding: 2rem 1.5rem;
  margin-top: auto;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--gray-500);
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-links a {
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--primary);
}

/* ===== NEW BADGE ===== */
.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}

.badge-pill.green { background: var(--primary-bg); color: var(--primary); }
.badge-pill.red { background: #fef2f2; color: var(--danger); }
.badge-pill.yellow { background: #fffbeb; color: var(--warning); }
.badge-pill.blue { background: #eff6ff; color: var(--secondary); }

/* ===== LOADING ===== */
.loading {
  text-align: center;
  padding: 3rem;
  color: var(--gray-400);
}

.loading .spinner {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-bottom: 0.5rem;
}

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

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .navbar-toggle {
    display: block;
  }

  .navbar-menu {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: white;
    flex-direction: column;
    padding: 1rem;
    border-bottom: 1px solid var(--gray-200);
    box-shadow: var(--shadow-lg);
  }

  .navbar-menu.open {
    display: flex;
  }

  .navbar-menu a {
    width: 100%;
    padding: 0.75rem 1rem;
  }

  .hero h1 {
    font-size: 1.75rem;
  }

  .hero-stats {
    gap: 1rem;
  }

  .hero-stat-value {
    font-size: 1.25rem;
  }

  .grid-3, .grid-4, .grid-5 {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }

  .section-title {
    flex-direction: column;
    align-items: flex-start;
  }

  .filter-bar {
    flex-direction: column;
  }

  .search-input {
    min-width: unset;
    width: 100%;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 1rem;
  }

  .grid-3, .grid-4, .grid-5 {
    grid-template-columns: 1fr 1fr;
  }

  .hero {
    padding: 2rem 1rem;
  }

  .price-card {
    padding: 1rem;
  }

  .price-card-amount {
    font-size: 1.25rem;
  }
}
