/* ================== RESET & BASE ================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family: 'Inter', system-ui,-apple-system,BlinkMacSystemFont,sans-serif;
  background: linear-gradient(180deg, #ffffff 0%, #e9f8f0 100%);
  color: #1a1a1a;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  opacity: 0;
  transition: opacity .5s ease, background .3s ease, color .3s ease;
}
body.loaded {
  opacity: 1;
}

/* Dark mode */
:root {
  --green-500: #27ae60;
  --green-600: #1f8f4e;
  --bg: #0f1419;
  --text: #d9e3f0;
  --muted: #8a99b0;
  --card-bg: #1f2430;
  --header-bg: #1f2430;
  --footer-bg: #0d111f;
  --footer-text: #d9e3f0;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.25);
}

body {
  background: var(--bg);
  color: var(--text);
}

/* Utility */
.hidden { display: none !important; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.rounded { border-radius: 12px; }
.shadow { box-shadow: var(--shadow); }
.transition { transition: all .25s ease; }
.btn { cursor: pointer; border: none; font-weight: 600; position: relative; }

/* ================== HEADER ================== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  padding: 14px 24px;
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(230,235,242,.8);
  flex-wrap: wrap;
}

.header h1 {
  font-family: 'Poppins', sans-serif;
  font-size: 1.65rem;
  margin: 0;
  display: flex;
  gap: 6px;
  align-items: center;
}

.header p {
  margin: 0;
  font-size: .75rem;
  color: var(--muted);
}

.nav-links {
  display: flex;
  gap: 18px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-links a {
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 10px;
  position: relative;
  font-size: .9rem;
}
.nav-links a:hover {
  background: rgba(39,174,96,0.1);
}

/* Hamburger for mobile */
.menu-toggle {
  background: none;
  border: none;
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 6px;
}
.menu-toggle span {
  width: 24px;
  height: 3px;
  background: var(--text);
  border-radius: 3px;
  display: block;
  transition: transform .3s ease, opacity .3s ease;
}

/* DARK MODE TOGGLE */
.mode-toggle {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 2000;
}
.mode-toggle button {
  background: rgba(255,255,255,0.9);
  border: none;
  padding: 8px 10px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.08);
  backdrop-filter: blur(8px);
  transition: transform .2s ease;
}
.mode-toggle button:hover {
  transform: scale(1.1);
}

/* ================== HERO ================== */
.hero-banner {
  margin-top: 8px;
}
.hero-img {
  width: 100%;
  aspect-ratio: 4 / 1.3; /* Atur rasio aspek */
  object-fit: cover;
  object-position: center top;
  border-radius: 14px;
  display: block;
  box-shadow: var(--shadow);
}

/* ================== GRID & PRODUCTS ================== */
.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 20px 100px;
}
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(220px,1fr));
  gap: 24px;
  margin-top: 6px;
}

.product-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 18px 16px 14px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
  transition: transform .3s ease, box-shadow .3s ease;
  box-shadow: var(--shadow);
  border: 1px solid rgba(0,0,0,0.03);
}
.product-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 22px 60px rgba(0,0,0,0.08);
}
.product-card img {
  width: 100%;
  height: 140px;
  object-fit: contain;
  border-radius: 8px;
  background: rgba(242,247,242,1);
  transition: transform .3s ease;
}
.product-card img:hover {
  transform: scale(1.05);
}
.product-card h3 {
  font-family: 'Poppins', sans-serif;
  font-size: 1.05rem;
  margin: 0;
}
.product-card .price {
  font-weight: 700;
  font-size: .95rem;
  margin-top: 2px;
}
.btn-group {
  margin-top: auto;
  display: flex;
  gap: 8px;
}

.btn-buy {
  flex: 1;
  background: linear-gradient(135deg,var(--green-500),var(--green-600));
  color: white;
  padding: 10px 14px;
  border-radius: 9px;
  font-size: .9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all .3s ease;
  box-shadow: 0 10px 30px rgba(39,174,96,0.2);
}
.btn-buy:hover {
  transform: scale(1.03);
}
.btn-cart {
  background: #f5f5f5;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  border: 1px solid #e6ebf2;
  transition: all .2s ease;
}
.btn-cart:hover {
  background: #e9f7ee;
}

/* ================== CART SIDEBAR ================== */
.cart-sidebar {
  position: fixed;
  right: 0;
  top: 0;
  width: 340px;
  max-width: 100%;
  height: 100%;
  background: var(--card-bg);
  border-left: 1px solid rgba(230,235,242,.8);
  padding: 24px 18px 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  z-index: 1500;
  transform: translateX(110%);
  transition: transform .35s ease;
}
.cart-sidebar.open {
  transform: translateX(0);
}
.cart-sidebar h3 {
  margin: 0 0 6px;
  font-size: 1.25rem;
}
.cart-close {
  background: none;
  border: none;
  font-size: 22px;
  position: absolute;
  top: 14px;
  right: 14px;
  cursor: pointer;
  color: #555;
}
.cart-items {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
}
.cart-items li {
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 6px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(240,243,248,.8);
  font-size: .9rem;
}
.cart-total {
  font-weight: 700;
  font-size: 1.1rem;
  margin: 6px 0;
}
.btn-checkout {
  background: var(--green-500);
  color: white;
  padding: 12px 16px;
  width: 100%;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: filter .2s ease;
}
.btn-checkout:hover {
  filter: brightness(1.1);
}

/* ================== POPUP ================== */
.popup {
  position: fixed;
  z-index: 9999;
  top: 0; 
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;   /* Vertikal tengah */
  justify-content: center; /* Horizontal tengah */
}

.popup-content {
  background: var(--card-bg);
  padding: 32px 28px;
  border-radius: 18px;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 24px 60px -12px rgba(39,174,96,0.3);
  animation: popupFade .3s ease-out;
  position: relative;
}
@keyframes popupFade {
  0% { transform: scale(0.95); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.popup-content h2 {
  font-family: 'Poppins', sans-serif;
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 1.5rem;
  color: var(--text);
}
.popup-product {
  display: flex;
  gap: 16px;
  margin-bottom: 18px;
  align-items: center;
}
.popup-product-img {
  width: 90px;
  height: 90px;
  border-radius: 12px;
  object-fit: cover;
  background: #f0f4f8;
  box-shadow: 0 6px 16px rgba(0,0,0,0.06);
}
.popup-product-info h3 {
  margin: 0 0 4px;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
}
.popup-product-info p {
  margin: 6px 0;
  font-size: .9rem;
  color: var(--muted);
}
.popup .badge {
  margin-top: 4px;
}
.payment-note {
  font-size: .85rem;
  margin: 16px 0 20px;
  color: var(--muted);
}
.btn-confirm {
  background: linear-gradient(135deg,var(--green-500),var(--green-600));
  color: #fff;
  border: none;
  padding: 12px 16px;
  width: 100%;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(39,174,96,0.25);
  transition: transform 0.2s ease;
}
.btn-confirm:hover {
  transform: scale(1.03);
}
.popup .close {
  position: absolute;
  top: 14px;
  right: 18px;
  font-size: 22px;
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
}
.popup .close:hover {
  color: #555;
}

/* ================== FOOTER ================== */
.footer {
  background: var(--footer-bg);
  color: var(--footer-text);
  text-align: center;
  padding: 18px 12px;
  border-radius: 14px 14px 0 0;
  margin-top: 60px;
  font-size: .85rem;
}

/* ================== MICRO INTERACTIONS ================== */
.badge {
  background: rgba(39,174,96,0.1);
  color: var(--green-600);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  display: inline-block;
}

/* SMALL RESPONSIVE TWEAKS */
@media (max-width: 1000px) {
  .product-grid {
    grid-template-columns: repeat(auto-fit,minmax(180px,1fr));
  }
}
@media (max-width: 800px) {
  .nav-links { display: none; }
  .menu-toggle { display: flex; }
  .header { gap:8px; }
  .product-card { padding: 14px 12px; }
}

/* ================== SIDEBAR MENU ================== */
.sidebar-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 24px;
  background: var(--card-bg);
  border: 1px solid rgba(230,235,242,.8);
  border-radius: 10px;
  box-shadow: 0 20px 60px -10px rgba(0,0,0,0.08);
  padding: 14px;
  z-index: 1000;
}
.sidebar-menu.open {
  display: block;
}
.sidebar-menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.sidebar-menu li {
  margin-bottom: 10px;
}
.sidebar-menu a {
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
}
.sidebar-menu a:hover {
  color: var(--green-600);
}

/* ================== CART ICON ANIMATION ================== */
.cart-toggle.animate {
  animation: cart-bounce 0.5s;
}
@keyframes cart-bounce {
  0% { transform: scale(1); }
  30% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.mode-toggle { display: none; }
