/* ============================================================
       RESET & BASE
    ============================================================ */
    *, *::before, *::after { box-sizing: border-box; }
    html, body { height: 100%; margin: 0; }

    body {
      font-family: 'Plus Jakarta Sans', sans-serif;
      background: linear-gradient(180deg, #f0f7ff 0%, #e6f3ff 100%);
    }

    /* ============================================================
       SCROLLBAR HIDE
    ============================================================ */
    .scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }
    .scrollbar-hide::-webkit-scrollbar { display: none; }

    /* ============================================================
       SCROLL WRAPPER
    ============================================================ */
    .scroll-wrapper { overflow-y: auto; height: 100%; }

    /* ============================================================
       HEADER
    ============================================================ */
    .store-header {
      background: linear-gradient(180deg, #001f3f 0%, #0066cc 100%);
      border-bottom: 1px solid rgba(0, 180, 255, 0.2);
      box-shadow: 0 2px 8px rgba(0, 102, 204, 0.2);
    }

    /* ============================================================
       PROMO BANNER
    ============================================================ */
    .promo-banner {
      background: linear-gradient(135deg, #001f3f 0%, #0066cc 50%, #00b4ff 100%);
      background-size: 200% 200%;
      animation: shimmer 5s ease infinite;
      position: relative;
      overflow: hidden;
      aspect-ratio: 2 / 1;
      min-height: 180px;
    }
    @keyframes shimmer {
      0%, 100% { background-position: 0% 50%; }
      50%       { background-position: 100% 50%; }
    }
    .promo-banner::before {
      content: '';
      position: absolute;
      inset: 0;
      background: radial-gradient(circle at 20% 50%, rgba(255,255,255,0.1) 0%, transparent 50%);
    }

    /* ============================================================
       CATEGORY PILLS
    ============================================================ */
    .category-pill {
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      border: 2px solid transparent;
    }
    .category-pill.active {
      background: linear-gradient(135deg, var(--primary, #0066cc), var(--secondary, #00b4ff));
      color: white;
      box-shadow: 0 8px 16px rgba(0, 102, 204, 0.3);
      border-color: var(--primary, #0066cc);
    }
    .category-pill:not(.active):hover {
      background: #f0f7ff;
      border-color: var(--primary, #0066cc);
      color: var(--primary, #0066cc);
    }

    /* ============================================================
       PRODUCT CARDS
    ============================================================ */
    .product-card {
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      border: 1px solid rgba(0, 102, 204, 0.1);
      background: white;
    }
    @media (hover: hover) and (pointer: fine) {
      .product-card:hover {
        transform: translateY(-8px);
        box-shadow: 0 12px 32px rgba(0, 102, 204, 0.15);
        border-color: rgba(0, 102, 204, 0.3);
      }
    }

    .product-img {
      position: relative;
      overflow: hidden;
    }
    .product-img::after {
      content: '';
      position: absolute;
      inset: 0;
      background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 60%);
    }
    .asset-img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }
    .store-logo-img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
      border-radius: 9999px;
    }
    .promo-bg-img {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      object-fit: cover;
      z-index: 0;
      opacity: 1;
    }
    .promo-bg-img.is-switching {
      animation: promoSlideIn 0.45s ease;
    }
    @keyframes promoSlideIn {
      from { opacity: 0; transform: translateX(18px) scale(1.02); }
      to   { opacity: 1; transform: translateX(0) scale(1); }
    }
    .promo-banner.has-image {
      background: #001f3f;
    }
    .promo-banner.has-image::before {
      display: none;
    }
    .promo-dot {
      width: 8px;
      height: 8px;
      border-radius: 9999px;
      background: rgba(255,255,255,0.5);
      border: 1px solid rgba(255,255,255,0.65);
      transition: all 0.2s ease;
    }
    .promo-dot.active {
      width: 22px;
      background: white;
    }
    .product-img.has-image::after,
    #modal-img.has-image::after {
      background: linear-gradient(180deg, rgba(0,0,0,0.02) 0%, rgba(0,0,0,0.12) 100%);
    }
    .product-placeholder {
      position: relative;
      z-index: 10;
      max-width: 80%;
      text-align: center;
      color: rgba(255,255,255,0.9);
      font-size: 11px;
      font-weight: 800;
      line-height: 1.35;
    }
    #modal-img {
      position: relative;
      overflow: hidden;
    }
    #modal-img .asset-img {
      object-fit: contain;
      background: #f8fafc;
    }
    .product-description {
      color: #334155;
      font-size: 12px;
      font-weight: 500;
      line-height: 1.7;
    }
    .product-description p + p,
    .product-description p + ul,
    .product-description p + ol,
    .product-description ul + p,
    .product-description ol + p {
      margin-top: 0.6rem;
    }
    .product-description ul {
      list-style: disc;
      padding-left: 1rem;
      margin: 0.45rem 0 0;
    }
    .product-description ol {
      list-style: decimal;
      padding-left: 1rem;
      margin: 0.45rem 0 0;
    }
    .product-description li + li {
      margin-top: 0.25rem;
    }
    .product-description .desc-lead {
      font-weight: 800;
      color: #0f172a;
    }

    /* ============================================================
       BADGES
    ============================================================ */
    .badge-hot {
      background: linear-gradient(135deg, #ff4444, #ff6666);
      animation: pulse-badge 2s ease infinite;
    }
    @keyframes pulse-badge {
      0%, 100% { opacity: 1; transform: scale(1); }
      50%       { opacity: 0.85; transform: scale(1.05); }
    }

    /* ============================================================
       SECTION TITLE GRADIENT
    ============================================================ */
    .section-title {
      background: linear-gradient(90deg, #001f3f, var(--primary, #0066cc));
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
    }

    /* ============================================================
       MODAL — FIX: gunakan display:none/flex lewat class .open
       (tidak pakai class 'hidden' + 'flex' bersamaan di Tailwind)
    ============================================================ */
    #product-modal {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,0.5);
      z-index: 999;
      align-items: center;
      justify-content: center;
      padding: 1rem;
    }
    #product-modal.open {
      display: flex;
    }

    /* ============================================================
       WISHLIST
    ============================================================ */
    .wishlist-toggle { transition: all 0.2s ease; }
    .wishlist-toggle.active i { color: #ff1744; }

    /* ============================================================
       MODAL NAV (prev / next)
    ============================================================ */
    .modal-nav-btn {
      transition: all 0.2s ease;
      border: 1.5px solid rgba(0,102,204,0.2);
    }
    .modal-nav-btn:hover:not(:disabled) {
      background: var(--primary, #0066cc);
      color: white;
      border-color: var(--primary, #0066cc);
    }
    .modal-nav-btn:disabled {
      opacity: 0.3;
      cursor: not-allowed;
    }

    /* ============================================================
       SHARE SECTION
    ============================================================ */
    .share-btn {
      transition: all 0.2s ease;
      border: 1.5px solid transparent;
    }
    .share-btn:hover {
      transform: translateY(-2px);
      box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    }
    .share-btn.copied {
      background: #10b981 !important;
      color: white !important;
    }

    /* ============================================================
       TOAST NOTIFICATIONS
    ============================================================ */
    .toast { animation: slideDownIn 0.3s ease; }
    @keyframes slideDownIn {
      from { transform: translateY(-100px); opacity: 0; }
      to   { transform: translateY(0);      opacity: 1; }
    }
    @keyframes slideDownOut {
      from { transform: translateY(0);      opacity: 1; }
      to   { transform: translateY(-100px); opacity: 0; }
    }
    .toast.removing { animation: slideDownOut 0.3s ease; }

    /* ============================================================
       STAR RATING
    ============================================================ */
    .stars        { display: flex; gap: 2px; }
    .star         { color: #fbbf24; font-size: 12px; }
    .star.empty   { color: #cbd5e1; }

    /* ============================================================
       SKELETON LOADING
    ============================================================ */
    .skeleton {
      background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
      background-size: 200% 100%;
      animation: skeleton-wave 1.5s infinite;
      border-radius: 8px;
    }
    @keyframes skeleton-wave {
      0%   { background-position: 200% 0; }
      100% { background-position: -200% 0; }
    }

    /* ============================================================
       LAZY IMAGE PLACEHOLDER
       Gambar yang belum di-load tampil sebagai skeleton shimmer.
       Saat Intersection Observer trigger, src di-swap dan fade-in.
    ============================================================ */
    img.img-lazy {
      background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
      background-size: 200% 100%;
      animation: skeleton-wave 1.5s infinite;
    }

    /* ============================================================
       LOADING OVERLAY
    ============================================================ */
    #loading-overlay {
      position: fixed;
      inset: 0;
      background: rgba(240,247,255,0.85);
      z-index: 9999;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 16px;
      transition: opacity 0.4s ease;
    }
    #loading-overlay.fade-out { opacity: 0; pointer-events: none; }
    .spinner {
      width: 48px; height: 48px;
      border: 4px solid rgba(0,102,204,0.15);
      border-top-color: #0066cc;
      border-radius: 50%;
      animation: spin 0.8s linear infinite;
    }
    @keyframes spin { to { transform: rotate(360deg); } }

    /* ============================================================
       FOOTER — hidden by default, fade-in saat scroll ke bawah
    ============================================================ */
    #main-footer {
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.5s ease;
    }
    #main-footer.footer-visible {
      opacity: 1;
      pointer-events: auto;
    }

    /* ============================================================
       CSS VARIABLES (diupdate dinamis dari config Sheets)
    ============================================================ */
    :root {
      --primary:   #0066cc;
      --secondary: #00b4ff;
      --bg:        #f0f7ff;
      --surface:   #ffffff;
      --txt:       #001f3f;
    }

    /* ============================================================
       MOBILE / ANDROID RESPONSIVE POLISH
    ============================================================ */
    @media (max-width: 760px), (hover: none) and (pointer: coarse) {
      html, body {
        height: 100dvh;
      }

      .scroll-wrapper {
        height: 100dvh;
        -webkit-overflow-scrolling: touch;
      }

      .store-header > div:first-child {
        padding: 0.75rem 0.875rem;
      }

      #header-logo {
        width: 46px !important;
        height: 46px !important;
      }

      #header-logo i {
        width: 22px;
        height: 22px;
      }

      #header-name {
        font-size: 1.2rem;
        max-width: 52vw;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      #header-desc {
        max-width: 52vw;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      #search-toggle,
      #cart-toggle {
        width: 38px;
        height: 38px;
      }

      #search-bar {
        padding-left: 0.875rem;
        padding-right: 0.875rem;
        padding-bottom: 0.75rem;
      }

      #search-input {
        padding-top: 0.72rem;
        padding-bottom: 0.72rem;
      }

      #promo-section {
        margin-top: 0.85rem;
        padding-left: 0.875rem;
        padding-right: 0.875rem;
      }

      .promo-banner {
        min-height: 0;
        border-radius: 18px;
      }

      #promo-dots {
        right: 0.85rem;
        bottom: 0.75rem;
        gap: 0.35rem;
      }

      .promo-dot {
        width: 7px;
        height: 7px;
      }

      .promo-dot.active {
        width: 18px;
      }

      #category-list {
        gap: 0.5rem;
      }

      #category-list .category-pill {
        padding: 0.55rem 0.9rem;
        font-size: 0.72rem;
        border-width: 1px;
      }

      section.max-w-5xl {
        padding-left: 0.875rem;
        padding-right: 0.875rem;
      }

      section.max-w-5xl.mt-8 {
        margin-top: 1.15rem;
      }

      #product-grid {
        gap: 0.75rem;
      }

      .product-card {
        border-radius: 14px;
      }

      .product-card > div:last-child {
        padding: 0.7rem;
      }

      .product-card h3 {
        font-size: 0.72rem;
        min-height: 2.05rem;
      }

      .product-card .star {
        font-size: 10px;
      }

      .product-card:hover {
        transform: none;
      }

      #product-modal {
        align-items: flex-end;
        justify-content: center;
        padding: 0;
      }

      #product-modal > div {
        width: 100%;
        max-width: none;
        max-height: 94dvh;
        border-radius: 22px 22px 0 0;
        overflow: hidden;
      }

      #product-modal > div > .sticky {
        padding: 0.85rem 1rem;
        border-radius: 22px 22px 0 0;
      }

      #product-modal > div > .p-5 {
        padding: 1rem;
      }

      #modal-img {
        aspect-ratio: 4 / 3;
        margin-bottom: 0.95rem;
        border-radius: 16px;
      }

      #modal-name {
        font-size: 1rem;
        line-height: 1.35;
      }

      #modal-rating {
        margin-bottom: 0.75rem;
      }

      #modal-price {
        font-size: 1.45rem;
        margin-bottom: 0.9rem;
      }

      #modal-desc {
        font-size: 0.76rem;
        line-height: 1.65;
      }

      #modal-add-cart,
      #modal-whatsapp,
      #modal-wishlist,
      #cart-checkout {
        padding-top: 0.78rem;
        padding-bottom: 0.78rem;
      }

      #cart-sidebar {
        width: min(100vw, 360px) !important;
      }

      #main-footer {
        padding-top: 0;
        padding-bottom: 0;
      }

      #main-footer p {
        font-size: 0.68rem;
      }
    }

    @media (max-width: 360px) {
      #product-grid {
        gap: 0.6rem;
      }

      .product-card > div:last-child {
        padding: 0.6rem;
      }

      .product-card h3 {
        font-size: 0.68rem;
      }
    }

    html.is-mobile-device,
    html.is-mobile-device body {
      height: 100dvh;
    }
    html.is-mobile-device .scroll-wrapper {
      height: 100dvh;
      -webkit-overflow-scrolling: touch;
    }
    html.is-mobile-device .store-header > div:first-child {
      padding: 0.75rem 0.875rem;
    }

    /* ============================================================
       QUICK ADD BUTTON (tombol + di kartu produk)
    ============================================================ */
    .quick-add-btn {
      position: absolute;
      bottom: 0;
      right: 0;
      width: 36px;
      height: 36px;
      border-radius: 12px 0 0 0;
      background: linear-gradient(135deg, var(--primary, #0066cc), var(--secondary, #00b4ff));
      color: white;
      display: flex;
      align-items: center;
      justify-content: center;
      opacity: 0;
      transform: scale(0.7) translate(4px, 4px);
      transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
      z-index: 25;
      border: none;
      cursor: pointer;
      box-shadow: -2px -2px 8px rgba(0,102,204,0.2);
    }
    .product-card:hover .quick-add-btn,
    html.is-mobile-device .quick-add-btn {
      opacity: 1;
      transform: scale(1) translate(0, 0);
    }
    html.is-mobile-device .quick-add-btn {
      width: 34px;
      height: 34px;
    }
    .quick-add-btn:active {
      transform: scale(0.9) !important;
      background: linear-gradient(135deg, #004ea8, #0099dd) !important;
    }
    .quick-add-btn.added {
      background: linear-gradient(135deg, #059669, #34d399) !important;
    }

    /* ============================================================
       SORT / FILTER BAR
    ============================================================ */
    #sort-filter-bar {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      overflow-x: auto;
      -ms-overflow-style: none;
      scrollbar-width: none;
    }
    #sort-filter-bar::-webkit-scrollbar { display: none; }
    .sort-chip {
      flex-shrink: 0;
      padding: 0.4rem 0.85rem;
      border-radius: 9999px;
      font-size: 0.7rem;
      font-weight: 700;
      border: 1.5px solid rgba(0,102,204,0.18);
      background: white;
      color: #475569;
      cursor: pointer;
      transition: all 0.2s ease;
      white-space: nowrap;
    }
    .sort-chip:hover {
      border-color: var(--primary, #0066cc);
      color: var(--primary, #0066cc);
    }
    .sort-chip.active {
      background: linear-gradient(135deg, var(--primary, #0066cc), var(--secondary, #00b4ff));
      color: white;
      border-color: transparent;
      box-shadow: 0 4px 10px rgba(0,102,204,0.25);
    }
    .sort-divider {
      width: 1px;
      height: 20px;
      background: rgba(0,102,204,0.12);
      flex-shrink: 0;
    }

    /* ============================================================
       WISHLIST PANEL
    ============================================================ */
    #wishlist-panel {
      position: fixed;
      top: 0;
      right: 0;
      height: 100%;
      width: min(100vw, 360px);
      background: white;
      z-index: 998;
      transform: translateX(100%);
      transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      box-shadow: -4px 0 24px rgba(0,0,0,0.12);
      display: flex;
      flex-direction: column;
      border-left: 1px solid rgba(0,102,204,0.1);
    }
    #wishlist-panel.open {
      transform: translateX(0);
    }
    .wishlist-item {
      display: flex;
      align-items: center;
      gap: 0.75rem;
      padding: 0.75rem;
      border-radius: 12px;
      background: #f8faff;
      border: 1px solid rgba(0,102,204,0.08);
      transition: all 0.2s ease;
    }
    .wishlist-item:hover {
      border-color: rgba(0,102,204,0.25);
      box-shadow: 0 2px 8px rgba(0,102,204,0.08);
    }
    .wishlist-item-img {
      width: 52px;
      height: 52px;
      border-radius: 10px;
      object-fit: cover;
      flex-shrink: 0;
      background: linear-gradient(135deg, #0066cc, #00b4ff);
    }
    #wishlist-count-badge {
      position: absolute;
      top: -4px;
      right: -4px;
      background: #ff1744;
      color: white;
      font-size: 9px;
      font-weight: 900;
      width: 18px;
      height: 18px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    /* ============================================================
       SEARCH UX IMPROVEMENTS
    ============================================================ */
    #search-bar {
      transition: all 0.3s ease;
    }
    #search-input {
      transition: all 0.25s ease;
    }
    #search-clear {
      position: absolute;
      right: 42px;
      top: 50%;
      transform: translateY(-50%);
      width: 20px;
      height: 20px;
      background: rgba(0,102,204,0.12);
      border-radius: 50%;
      display: none;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      color: #0066cc;
      font-size: 11px;
      font-weight: 900;
      border: none;
    }
    #search-clear.visible {
      display: flex;
    }
    #search-suggestion {
      padding: 0.5rem 0.75rem 0;
      font-size: 0.68rem;
      color: #64748b;
      font-weight: 600;
    }

    /* ============================================================
       SWIPE HINT INDICATOR
    ============================================================ */
    .swipe-hint {
      position: absolute;
      bottom: 12px;
      left: 50%;
      transform: translateX(-50%);
      font-size: 9px;
      color: rgba(255,255,255,0.6);
      font-weight: 600;
      display: flex;
      align-items: center;
      gap: 4px;
      pointer-events: none;
      animation: swipe-fade 2.5s ease 1.5s forwards;
      opacity: 0;
    }
    @keyframes swipe-fade {
      0% { opacity: 0; transform: translateX(-50%) translateY(4px); }
      20% { opacity: 1; transform: translateX(-50%) translateY(0); }
      80% { opacity: 1; }
      100% { opacity: 0; }
    }
    html.is-mobile-device #header-logo {
      width: 46px !important;
      height: 46px !important;
    }
    html.is-mobile-device #header-name {
      font-size: 1.2rem;
      max-width: 52vw;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    html.is-mobile-device #header-desc {
      max-width: 52vw;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    html.is-mobile-device #search-toggle,
    html.is-mobile-device #cart-toggle {
      width: 38px;
      height: 38px;
    }
    html.is-mobile-device #promo-section,
    html.is-mobile-device section.max-w-5xl {
      padding-left: 0.875rem;
      padding-right: 0.875rem;
    }
    html.is-mobile-device #promo-section {
      margin-top: 0.85rem;
    }
    html.is-mobile-device .promo-banner {
      min-height: 0;
      border-radius: 18px;
    }
    html.is-mobile-device section.max-w-5xl.mt-8 {
      margin-top: 1.15rem;
    }
    html.is-mobile-device #category-list {
      gap: 0.5rem;
    }
    html.is-mobile-device #category-list .category-pill {
      padding: 0.55rem 0.9rem;
      font-size: 0.72rem;
      border-width: 1px;
    }
    html.is-mobile-device #product-grid {
      gap: 0.75rem;
    }
    html.is-mobile-device .product-card {
      border-radius: 14px;
    }
    html.is-mobile-device .product-card > div:last-child {
      padding: 0.7rem;
    }
    html.is-mobile-device .product-card h3 {
      font-size: 0.72rem;
      min-height: 2.05rem;
    }
    html.is-mobile-device .product-card:hover {
      transform: none;
    }
    html.is-mobile-device #product-modal {
      align-items: flex-end;
      justify-content: center;
      padding: 0;
    }
    html.is-mobile-device #product-modal > div {
      width: 100%;
      max-width: none;
      max-height: 94dvh;
      border-radius: 22px 22px 0 0;
      overflow: hidden;
    }
    html.is-mobile-device #product-modal > div > .sticky {
      padding: 0.85rem 1rem;
      border-radius: 22px 22px 0 0;
    }
    html.is-mobile-device #product-modal > div > .p-5 {
      padding: 1rem;
    }
    html.is-mobile-device #modal-img {
      aspect-ratio: 4 / 3;
      margin-bottom: 0.95rem;
      border-radius: 16px;
    }
    html.is-mobile-device #cart-sidebar {
      width: min(100vw, 360px) !important;
    }
    html.is-mobile-device #main-footer {
      padding-top: 0;
      padding-bottom: 0;
    }