/* =========================================================
   CSS VARIABLES
========================================================= */

:root {
  --header-height: 64px;
  --primary: #FF7A45;
  --bg: #f5f5f5;
  --text: #333;
}

/* =========================================================
   BASE
========================================================= */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: 60px; /* ruang bottom nav */
}

footer {
  all: unset;
}

/* =========================================================
   HEADER (FIXED – SAFE)
========================================================= */

header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  z-index: 1000;
  background: var(--primary);
  color: #fff;
  padding: 10px 12px;
}

header,
.header-inner {
  overflow: visible;
}

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* =========================================================
   SEARCH
========================================================= */

.search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  padding: 4px;
  border-radius: 8px;
}

.search input {
  flex: 1;
  border: none;
  outline: none;
  padding: 8px 10px;
  font-size: 14px;
}

/* clear */
.search-clear {
  background: transparent;
  border: none;
  font-size: 14px;
  color: #999;
  cursor: pointer;
}

.search-clear:hover {
  color: #333;
}

/* search button */
.search-btn {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  border: none;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.search-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* spinner */
.btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* =========================================================
   CART
========================================================= */

.cart i {
  font-size: 20px;
  cursor: pointer;
  color: #fff;
}

.cart i:active {
  opacity: 0.8;
}

/* =========================================================
   MAIN (CONTENT OFFSET)
========================================================= */

main {
  padding:
    calc(var(--header-height) + 12px)
    12px
    calc(60px + 24px); /* tinggi bottom nav + extra space */
}


/* =========================================================
   PRODUCT GRID
========================================================= */

.product-wrapper {
  position: relative;
  min-height: 300px;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.product {
  background: #fff;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid #ddd;
}

/* =========================================================
   IMAGE SYSTEM (SHIMMER + BLUR + SPINNER)
========================================================= */

.img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

/* shimmer */
.img-shimmer {
  position: absolute;
  inset: 0;
  background: #eaeaea;
  z-index: 1;
}

.img-shimmer::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0) 0%,
    rgba(255,255,255,.7) 50%,
    rgba(255,255,255,0) 100%
  );
  animation: shimmer 1.3s infinite;
}

/* image */
.product-img {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
}

.product-img.blur {
  filter: blur(18px);
  transform: scale(1.05);
}

.product-img.blur.loaded {
  opacity: 1;
  filter: blur(0);
  transform: scale(1);
  transition:
    filter 0.6s ease,
    transform 0.6s ease,
    opacity 0.3s ease;
}

/* spinner */
.img-spinner {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
}

.img-spinner::after {
  content: "";
  width: 28px;
  height: 28px;
  border: 3px solid rgba(0,0,0,.15);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* =========================================================
   PRODUCT BODY
========================================================= */

.product-body {
  padding: 8px;
}

.product-title {
  font-size: 15px;
  line-height: 1.3;
  font-weight: bold;
  height: 34px;
  overflow: hidden;
}

.sold-out {
  display: inline-block;
  font-weight: bold;
  color: #e53935;
  font-size: 14px;
}


.product-subtitle {
  font-size: 13px;
  line-height: 1.3;
  height: 34px;
  overflow: hidden;
}

.price {
  margin: 4px 0;
  font-size: 14px;
  font-weight: bold;
  color: var(--primary);
}

/* =========================================================
   BUTTON
========================================================= */

.btn {
  width: 100%;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 6px;
  font-size: 13px;
  border-radius: 4px;
  cursor: pointer;
}

.btn:active {
  opacity: 0.9;
}

/* =========================================================
   GLOBAL SHIMMER (GRID LOADING)
========================================================= */

.product.shimmer {
  pointer-events: none;
}

.product.shimmer .img-wrap {
  background: #eee;
}

.shimmer-line,
.shimmer-btn {
  position: relative;
  overflow: hidden;
  background: #eee;
  border-radius: 6px;
}

.shimmer-line {
  height: 14px;
  margin: 8px 0;
}

.shimmer-line.w-80 { width: 80%; }
.shimmer-line.w-50 { width: 50%; }

.shimmer-btn {
  height: 36px;
  margin-top: 12px;
}

.shimmer-line::after,
.shimmer-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0) 0%,
    rgba(255,255,255,.6) 50%,
    rgba(255,255,255,0) 100%
  );
  animation: shimmer 1.4s infinite;
}

/* =========================================================
   EMPTY STATE
========================================================= */

.empty-state {
  text-align: center;
  padding: 60px 0;
  color: #777;
}

.empty-state i {
  display: block;
  font-size: 48px;
  margin-bottom: 10px;
}

/* =========================================================
   BOTTOM NAV
========================================================= */

.app-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  height: 60px;
  background: #fff;
  display: flex;
  border-top: 1px solid #e5e5e5;
}

.app-bottom-nav a {
  flex: 1;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #777;
}

.app-bottom-nav a.active {
  color: var(--primary);
}

.app-bottom-nav .bi {
  font-size: 24px;
}

/* =========================================================
   ANIMATIONS
========================================================= */

@keyframes shimmer {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.load-more {
  padding: 28px 0 16px;
  display: flex;
  justify-content: center;
}

.load-more-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #777;
}

/* spinner bulat */
.circle-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(0,0,0,.15);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.detail-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 48px;
  background: #fff;
  display: flex;
  align-items: center;
  padding: 0 12px;
  z-index: 10;
}

.detail-page {
  padding-top: 48px; /* tinggi header detail */
}


.back-btn {
  font-size: 20px;
  background: none;
  border: none;
}

.detail-image {
  margin-top: 0;
  position: relative;
}

.detail-page main {
  padding-top: 48px;   /* pas setinggi detail-header */
}

.detail-image img {
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: cover;
}

.image-actions {
  position: absolute;
  bottom: 12px;
  right: 12px;
  display: flex;
  gap: 8px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  background: rgba(0,0,0,.6);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:active {
  transform: scale(0.95);
}

.detail-img {
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: cover;
}

.detail-body {
  padding: 12px;
}

.detail-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  padding: 10px;
  border-top: 1px solid #eee;
}

.btn-primary {
  width: 100%;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 12px;
  border-radius: 6px;
}


/* =========================================================
   RESPONSIVE GRID
========================================================= */

/* Tablet */
@media (min-width: 768px) {
  .product-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Desktop */
@media (min-width: 1200px) {
  .product-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
  }
}

/* =========================================================
   DETAIL LAYOUT (RESPONSIVE)
========================================================= */

.detail-container {
  display: block;
}

/* tombol cart biasa */
.btn-cart {
  margin-top: 16px;
}

/* DESKTOP MODE */
@media (min-width: 1024px) {
  .detail-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px;
    align-items: start;
  }

  .detail-left {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
}




/* =========================================================
   IMAGE ACTION BUTTONS (BIG BUTTON)
========================================================= */

.image-action-buttons {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

/* tombol besar */
.btn-outline {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  height: 44px;                 /* sama feel dengan btn-primary */
  font-size: 14px;
  font-weight: 600;

  border-radius: 8px;
  background: #fff;
  border: 1.5px solid #ddd;
  color: #333;

  cursor: pointer;
  transition: background .2s ease, transform .15s ease;
}

.btn-outline i {
  font-size: 18px;
}

/* hover desktop */
.btn-outline:hover {
  background: #f7f7f7;
}

/* tap mobile */
.btn-outline:active {
  transform: scale(0.97);
}

/* desktop spacing */

/* =========================================================
   TOAST NOTIFIER
========================================================= */

.toast {
  position: fixed;
  top: calc(var(--header-height) + 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;

  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;

  color: #fff;
  background: #333;
  box-shadow: 0 6px 16px rgba(0,0,0,.15);
  pointer-events: none;
}

/* success */
.toast.success {
  background: #43a047;
}

/* error */
.toast.error {
  background: #e53935;
}


/* =========================================================
   CONFIRM DIALOG
========================================================= */

.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 3000;

  display: flex;
  align-items: center;
  justify-content: center;
}

.confirm-box {
  width: 90%;
  max-width: 320px;
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}

.confirm-title {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 8px;
}

.confirm-message {
  font-size: 14px;
  color: #555;
  margin-bottom: 16px;
}

.confirm-actions {
  display: flex;
  gap: 10px;
}

/* tombol hapus */
.btn-danger {
  flex: 1;
  background: var( --primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  height: 40px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn-danger:active {
  opacity: 0.9;
}

/* =========================================================
   CONTACT PAGE
========================================================= */

.contact-card {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 6px 16px rgba(0,0,0,.08);
}

.contact-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.contact-header i {
  font-size: 28px;
  color: var(--primary);
}

.contact-header h2 {
  margin: 0;
  font-size: 18px;
}

.contact-item {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
  font-size: 14px;
  line-height: 1.4;
}

.contact-item i {
  font-size: 18px;
  color: var(--primary);
  min-width: 20px;
}

.contact-item a {
  color: var(--primary);
  text-decoration: none;
  font-weight: bold;
}

.contact-item a:active {
  opacity: 0.8;
}

.category-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 12px;
}

.cat-btn {
  white-space: nowrap;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid #ddd;
  background: #fff;
  font-size: 13px;
  cursor: pointer;
}

.cat-btn.active {
  background: var( --primary);
  color: #fff;
  border-color: #fff;
}
