/* Azadel Theme Engine — Single Product v2.2 */
*, *::before, *::after { box-sizing: border-box; }

/* ─── Wrapper ─────────────────────────────────────────────────────────── */
.ate-product {
    font-family: 'Poppins', -apple-system, sans-serif;
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    background: #f5f5f5;
    min-height: 100vh;
}
.ate-product a { text-decoration: none; }

/* ─── Main image wrap — ikut saiz semula jadi gambar ──────────────────── */
.ate-main-img-wrap {
    position: relative;
    width: 100%;
    background: #fff;
    /* Tiada aspect-ratio tetap — ikut tinggi gambar sebenar */
    overflow: hidden;
    display: block;
    line-height: 0; /* elak gap bawah img */
}
.ate-main-img {
    width: 100%;
    height: auto;      /* auto height — gambar tak terpotong, tak ada ruang putih */
    display: block;
    cursor: zoom-in;
    object-fit: unset; /* biar gambar tunjuk saiz penuh */
}

/* ─── Type badge — putih, icon hitam ─────────────────────────────────── */
.ate-type-badge-wrap {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 5;
    display: inline-flex;
    align-items: center;
}
.ate-type-badge {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
    color: #333;
    padding: 0;
    transition: box-shadow .15s;
}
.ate-type-badge:hover { box-shadow: 0 3px 12px rgba(0,0,0,.2); }

.ate-type-tooltip {
    display: none;
    position: absolute;
    top: 50%;
    left: calc(100% + 8px);
    transform: translateY(-50%);
    background: rgba(0,0,0,.82);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    padding: 5px 10px;
    border-radius: 6px;
    pointer-events: none;
    z-index: 10;
}
.ate-type-tooltip::before {
    content: '';
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-right-color: rgba(0,0,0,.82);
}

/* ─── Share button ────────────────────────────────────────────────────── */
.ate-share-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
    color: #444;
    transition: box-shadow .15s;
}
.ate-share-btn:hover { box-shadow: 0 3px 12px rgba(0,0,0,.2); }

/* Hijau — kalau ada affiliate/komisyen */
.ate-share-btn--aff {
    background: #d1fae5;
    color: #065f46;
}
.ate-share-btn--aff:hover { background: #a7f3d0; }

/* ─── Gallery thumbnail — overlay sticky bawah main image ─────────────── */
.ate-thumbs-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 4;
    display: flex;
    gap: 6px;
    padding: 8px 10px;
    background: linear-gradient(to top, rgba(0,0,0,.45) 0%, transparent 100%);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.ate-thumbs-overlay::-webkit-scrollbar { display: none; }

.ate-thumb {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,.5);
    border-radius: 6px;
    overflow: hidden;
    padding: 0;
    background: rgba(255,255,255,.15);
    cursor: pointer;
    transition: border-color .15s;
}
.ate-thumb.active,
.ate-thumb:hover { border-color: #fff; }
.ate-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ─── Dots indicator — tengah bawah gambar ──────────────────────────────── */
.ate-img-dots {
    position: absolute;
    bottom: 68px; /* atas thumbnail bar */
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 5px;
    pointer-events: none; /* dots hanya visual, click ke main image */
}
/* Kalau tiada thumbnail (1 gambar), dots duduk lebih bawah */
.ate-main-img-wrap:not(:has(.ate-thumbs-overlay)) .ate-img-dots {
    bottom: 12px;
}
.ate-img-dot-nav {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,.5);
    display: block;
    transition: all .2s;
    pointer-events: none;
}
.ate-img-dot-nav.active {
    width: 18px;
    border-radius: 3px;
    background: #fff;
}

/* ─── Zoom hint — gambar tunggal ─────────────────────────────────────────── */
.ate-img-zoom-hint {
    position: absolute;
    bottom: 10px;
    right: 10px;
    z-index: 5;
    background: rgba(0,0,0,.4);
    backdrop-filter: blur(3px);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    padding: 4px 8px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 4px;
    pointer-events: none;
}

/* ─── Info block ──────────────────────────────────────────────────────── */
.ate-info {
    background: #fff;
    padding: 16px;
    margin-top: 6px;
}

/* ─── Price ──────────────────────────────────────────────────────────── */
.ate-price-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.ate-price-main { font-size: 26px; font-weight: 800; color: #0095d3; }
.ate-price-sale { font-size: 26px; font-weight: 800; color: #ef4444; }
.ate-price-orig { font-size: 14px; color: #999; text-decoration: line-through; }
.ate-disc-badge { background: #ef4444; color: #fff; font-size: 12px; font-weight: 800; padding: 3px 8px; border-radius: 5px; }

/* ─── Title ──────────────────────────────────────────────────────────── */
.ate-title { font-size: 15px; font-weight: 600; color: #111; line-height: 1.5; margin: 0 0 10px; }

/* ─── Meta ───────────────────────────────────────────────────────────── */
.ate-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.ate-rating { font-size: 13px; font-weight: 700; color: #111; }
.ate-sold { font-size: 12px; color: #888; }

/* ─── Vendor ─────────────────────────────────────────────────────────── */
.ate-vendor { display: flex; align-items: center; gap: 10px; background: #f8f8f8; border: 1px solid #eee; border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
.ate-vendor:hover { background: #f0faff; }
.ate-vendor-av { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; border: 2px solid #e2e8f0; }
.ate-vendor-name { font-size: 13px; font-weight: 700; color: #111; display: block; margin-bottom: 1px; }
.ate-vendor-lbl { font-size: 11px; color: #0095d3; font-weight: 600; }

/* ─── Type row ───────────────────────────────────────────────────────── */
.ate-type-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #555; background: #f0faff; border-radius: 8px; padding: 8px 12px; border-left: 3px solid #0095d3; margin-bottom: 14px; }
.ate-type-row svg { flex-shrink: 0; color: #0095d3; }

/* ─── Description ────────────────────────────────────────────────────── */
.ate-desc-wrap { border-top: 1px solid #f0f0f0; padding-top: 14px; }
.ate-desc-label { font-size: 11px; font-weight: 800; color: #888; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.ate-desc { font-size: 13px; line-height: 1.7; color: #333; max-height: 120px; overflow: hidden; transition: max-height .3s ease; }
.ate-desc p { margin: 0 0 8px; }
.ate-desc-toggle { background: none; border: none; color: #0095d3; font-size: 13px; font-weight: 700; cursor: pointer; padding: 8px 0; font-family: inherit; }

/* ═══════════════════════════════════════════════════════════════════════
   STICKY BAR
   [ shop ] [ chat ] [ bag ]  |  [− qty +]  [ Beli Sekarang ]
═══════════════════════════════════════════════════════════════════════ */
.ate-bar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 680px;
    background: #fff;
    border-top: 1px solid #ebebeb;
    padding: 8px 14px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
    display: flex;
    align-items: center;
    gap: 0;
    z-index: 9999;
    box-shadow: 0 -2px 16px rgba(0,0,0,.08);
}

/* Icon group kiri */
.ate-bar-icons {
    display: flex;
    align-items: center;
    gap: 0;
    flex-shrink: 0;
}

/* Divider */
.ate-bar-divider {
    width: 1px;
    height: 28px;
    background: #e8e8e8;
    margin: 0 12px;
    flex-shrink: 0;
}

/* Setiap icon */
.ate-bar-icon {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    color: #555;
    cursor: pointer;
    text-decoration: none;
    transition: color .15s;
    padding: 0;
    position: relative;
    border-radius: 8px;
    flex-shrink: 0;
}
.ate-bar-icon:hover { color: #0095d3; background: #f0faff; }

/* WA chat icon */
.ate-bar-wa { color: #333; }
.ate-bar-wa:hover { color: #0095d3; }

/* Cart icon state */
.ate-bar-cart.loading { opacity: .5; pointer-events: none; }
.ate-bar-cart.done { color: #ef4444; } /* merah bila dah add */

/* Badge merah bulat tunjuk kuantiti */
.ate-cart-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    background: #ef4444;
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    font-family: 'Poppins', sans-serif;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    line-height: 1;
    border: 1.5px solid #fff;
}

/* Actions kanan */
.ate-bar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

/* Quantity */
.ate-bar-qty {
    display: flex;
    align-items: center;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    height: 42px;
    align-self: center;
}
.ate-qty-btn {
    background: #f8f8f8;
    border: none;
    padding: 0 9px;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    color: #444;
    line-height: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .1s;
}
.ate-qty-btn:hover { background: #ebebeb; }
.ate-qty-input {
    width: 28px;
    border: none;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    padding: 0;
    height: 42px;
    line-height: 42px;
    font-family: inherit;
    -moz-appearance: textfield;
    background: #fff;
    color: #111;
    display: flex;
    align-items: center;
    justify-content: center;
}
}
.ate-qty-input::-webkit-outer-spin-button,
.ate-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; }

/* Beli Sekarang */
.ate-bar-buy {
    flex: 1;
    height: 42px;
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 0 16px;
    font-size: 14px;
    font-weight: 800;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 3px 10px rgba(239,68,68,.3);
    transition: opacity .15s;
}
.ate-bar-buy:hover { opacity: .9; }
.ate-bar-buy:disabled { opacity: .6; cursor: not-allowed; }

/* ─── Image Modal ───────────────────────────────────────────────────── */
.ate-img-modal { position: fixed; inset: 0; z-index: 99998; display: flex; align-items: center; justify-content: center; }
.ate-img-modal__bg { position: absolute; inset: 0; background: rgba(0,0,0,.92); }
.ate-img-modal__wrap { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; padding: 50px 40px; }
.ate-img-modal__img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; border-radius: 4px; }
.ate-img-modal__close { position: absolute; top: 12px; right: 12px; background: rgba(255,255,255,.15); border: none; color: #fff; font-size: 20px; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.ate-img-modal__prev,
.ate-img-modal__next { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,.15); border: none; color: #fff; font-size: 28px; width: 44px; height: 44px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.ate-img-modal__prev { left: 8px; }
.ate-img-modal__next { right: 8px; }
.ate-img-modal__dots { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; }
.ate-img-modal__dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.4); cursor: pointer; transition: all .2s; }
.ate-img-modal__dot.active { width: 20px; border-radius: 4px; background: #fff; }

/* ─── Share Modal ───────────────────────────────────────────────────── */
.ate-share-modal { position: fixed; inset: 0; z-index: 99997; display: flex; align-items: flex-end; justify-content: center; }
.ate-share-modal__bg { position: absolute; inset: 0; background: rgba(0,0,0,.5); }
.ate-share-modal__box { position: relative; z-index: 1; background: #fff; border-radius: 20px 20px 0 0; width: 100%; max-width: 680px; max-height: 88vh; overflow-y: auto; padding-bottom: env(safe-area-inset-bottom); }
.ate-share-modal__hdr { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 12px; border-bottom: 1px solid #f0f0f0; font-size: 15px; font-weight: 800; }
.ate-share-modal__hdr button { background: none; border: none; font-size: 18px; color: #888; cursor: pointer; }
.ate-share-modal__body { padding: 16px 20px; }

/* Komisyen block */
.ate-sc-aff { background: #f0fdf4; border: 1.5px solid #86efac; border-radius: 12px; padding: 14px; margin-bottom: 14px; }
.ate-sc-title { font-size: 13px; font-weight: 800; color: #14532d; margin-bottom: 10px; }
.ate-sc-grid { display: flex; flex-direction: column; gap: 0; }
.ate-sc-row { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-bottom: 1px dashed #bbf7d0; }
.ate-sc-row:last-child { border-bottom: none; }
.ate-sc-lbl { font-size: 12px; color: #444; }
.ate-sc-val { font-size: 12px; font-weight: 700; color: #333; }
.ate-sc-hi { color: #16a34a; font-size: 14px; }
.ate-sc-note { font-size: 10px; color: #6b7280; margin: 8px 0 0; }

/* Ref link */
.ate-sc-link-block { margin-bottom: 14px; }
.ate-sc-link-lbl { font-size: 11px; font-weight: 700; color: #888; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; display: block; }
.ate-sc-link-row { display: flex; gap: 8px; }
.ate-sc-input { flex: 1; border: 1.5px solid #e2e8f0; border-radius: 8px; padding: 8px 10px; font-size: 12px; color: #555; font-family: monospace; background: #f8fafc; min-width: 0; }
.ate-sc-copy { background: #0095d3; color: #fff; border: none; border-radius: 8px; padding: 8px 14px; font-size: 12px; font-weight: 700; cursor: pointer; font-family: inherit; white-space: nowrap; }

/* Share pills */
.ate-sc-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.ate-sc-pill {
    flex: 1;
    min-width: 80px;
    padding: 10px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    color: #fff;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.ate-sc-wa { background: #25D366; }
.ate-sc-tg { background: #0088CC; }
.ate-sc-fb { background: #1877F2; }
.ate-sc-cp { background: #6b7280; }

/* ─── Desktop grid ──────────────────────────────────────────────────── */
@media (min-width: 768px) {
    .ate-product {
        max-width: 1080px;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0;
        align-items: start;
    }
    .ate-main-img-wrap {
        grid-column: 1;
        grid-row: 1;
        aspect-ratio: 1 / 1;
    }
    .ate-info {
        grid-column: 2;
        grid-row: 1;
        margin-top: 0;
        padding: 28px;
        align-self: start;
        position: sticky;
        top: 100px;
        max-height: calc(100vh - 120px);
        overflow-y: auto;
    }
    .ate-bar { max-width: 1080px; }
    .ate-share-modal { align-items: center; }
    .ate-share-modal__box { border-radius: 16px; margin: auto; max-width: 500px; }
}

/* ─── Mobile full-width fix ─────────────────────────────────────────── */
@media (max-width: 767px) {
    html, body {
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }
    .ate-product {
        width: 100% !important;
        max-width: 100% !important;
    }
    .ate-bar {
        width: 100% !important;
        max-width: 100% !important;
        left: 0 !important;
        transform: none !important;
    }
}

/* Hidden WC form */
#ateHiddenCart { display: none !important; }
