/* ═══════════════════════════════════════════════
   JASA V2 — Item Details Page
   item-details.css
   ═══════════════════════════════════════════════ */

/* ── Override body for this page ── */
body {
    background: var(--bg);
    padding-bottom: 80px;
}

/* ════════════════════════════════
   HEADER
   ════════════════════════════════ */
.id-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--hh);
    background: var(--bg-white);
    border-bottom: 1.5px solid var(--border);
    box-shadow: var(--sh-sm);
    z-index: 900;
    display: flex;
    align-items: center;
    padding: 0 6px 0 4px;
    gap: 4px;
}
.id-back-btn {
    width: 40px; height: 40px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: none; border: none;
    color: var(--txt1); font-size: 1rem;
    cursor: pointer; border-radius: var(--r-xs);
    transition: background var(--ease);
}
.id-back-btn:hover { background: var(--primary-light); color: var(--primary); }

.id-header-title {
    flex: 1; min-width: 0;
    font-size: .9rem; font-weight: 800;
    color: var(--txt1);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    letter-spacing: -.2px;
    margin: 0;
}
.id-cart-btn {
    width: 40px; height: 40px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    color: var(--txt1); text-decoration: none;
    font-size: 1.1rem; position: relative;
    border-radius: var(--r-xs);
    transition: background var(--ease);
}
.id-cart-btn:hover { background: var(--primary-light); color: var(--primary); }
.id-cart-badge {
    position: absolute;
    top: 5px; right: 4px;
    background: #ef4444; color: #fff;
    font-size: .55rem; font-weight: 800;
    min-width: 16px; height: 16px;
    border-radius: 50px; padding: 0 3px;
    display: flex; align-items: center; justify-content: center;
}

/* ════════════════════════════════
   MAIN
   ════════════════════════════════ */
.id-main {
    padding-top: var(--hh);
}

/* ════════════════════════════════
   SKELETON
   ════════════════════════════════ */
.id-skeleton {
    padding-top: var(--hh);
    animation: idSkelPulse 1.3s ease-in-out infinite;
}
@keyframes idSkelPulse {
    0%,100% { opacity:1; }
    50%      { opacity:.4; }
}
.id-skel-img {
    width: 100%; height: 300px;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
}
.id-skel-body {
    background: var(--bg-white);
    padding: 18px 16px;
    display: flex; flex-direction: column; gap: 10px;
}
.id-skel-line {
    height: 14px; border-radius: 6px;
    background: var(--border);
}
.id-skel-line.w70 { width: 70%; }
.id-skel-line.w50 { width: 50%; }
.id-skel-line.w35 { width: 35%; height: 22px; }

/* ════════════════════════════════
   IMAGE GALLERY
   ════════════════════════════════ */
.id-gallery {
    position: relative;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    overflow: hidden;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: pan-y;
}
/* slides strip */
.id-gallery-track {
    display: flex;
    height: 100%;
    transition: transform .35s cubic-bezier(.4,0,.2,1);
    will-change: transform;
}
.id-gallery-slide {
    min-width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    padding: 18px;
    background: var(--bg-white);
}
.id-gallery-slide img {
    max-width: 100%; max-height: 100%;
    object-fit: contain;
}
.id-gallery-slide .id-no-img {
    font-size: 5rem; color: var(--border2);
}
/* nav arrows */
.id-gallery-arrow {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 30px; height: 30px; border-radius: 50%;
    background: rgba(255,255,255,.85);
    border: 1.5px solid var(--border);
    color: var(--txt1); font-size: .7rem;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; z-index: 5;
    transition: background var(--ease), box-shadow var(--ease);
    box-shadow: var(--sh-sm);
}
.id-gallery-arrow:hover { background: #fff; box-shadow: var(--sh-md); }
.id-gallery-arrow.prev { left: 8px; }
.id-gallery-arrow.next { right: 8px; }

/* dots */
.id-gallery-dots {
    display: flex; align-items: center; justify-content: center;
    gap: 5px;
    padding: 8px 0 4px;
    background: var(--bg-white);
}
.id-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--border2);
    cursor: pointer;
    transition: background var(--ease), width .25s ease, border-radius .25s ease;
}
.id-dot.active {
    background: var(--primary);
    width: 20px; border-radius: 4px;
}

/* ════════════════════════════════
   SECTIONS
   ════════════════════════════════ */
.id-section {
    background: var(--bg-white);
    border-top: 1px solid var(--border);
    padding: 16px;
    margin-bottom: 2px;
}
.id-section-title {
    font-size: .72rem; font-weight: 800;
    color: var(--txt3);
    text-transform: uppercase; letter-spacing: .5px;
    margin-bottom: 10px;
}

/* ── Product info ── */
.id-info-section { border-top: none; }

.id-product-name {
    font-size: 1.1rem; font-weight: 800;
    color: var(--txt1); line-height: 1.3;
    margin-bottom: 5px;
}
.id-product-sub {
    font-size: .78rem; font-weight: 600;
    color: var(--txt3); margin-bottom: 10px;
}
.id-price-row {
    display: flex; align-items: baseline; gap: 8px;
    flex-wrap: wrap;
}
.id-price {
    font-size: 1.5rem; font-weight: 900;
    color: var(--txt1); letter-spacing: -.5px;
}
.id-price-orig {
    font-size: .85rem; font-weight: 600;
    color: var(--txt3); text-decoration: line-through;
}
.id-price-disc {
    font-size: .72rem; font-weight: 800;
    background: #dcfce7; color: #16a34a;
    border-radius: 6px; padding: 2px 8px;
}

/* ── Action buttons ── */
.id-actions {
    display: flex; gap: 10px;
}
.id-btn-cart,
.id-btn-buy {
    flex: 1; height: 46px;
    border-radius: var(--r-sm);
    font-size: .9rem; font-weight: 800;
    cursor: pointer; font-family: inherit;
    display: flex; align-items: center; justify-content: center; gap: 7px;
    transition: background var(--ease), transform var(--ease), box-shadow var(--ease);
}
.id-btn-cart {
    background: var(--bg);
    border: 1.5px solid var(--border2);
    color: var(--txt1);
}
.id-btn-cart:hover {
    border-color: var(--primary); color: var(--primary);
    background: var(--primary-faint);
}
.id-btn-buy {
    background: var(--primary); color: #fff; border: none;
    box-shadow: 0 4px 16px rgba(45,140,240,.35);
}
.id-btn-buy:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(45,140,240,.45);
}

/* ── Description ── */
.id-desc {
    font-size: .86rem; font-weight: 500;
    color: var(--txt2); line-height: 1.65;
    margin: 0;
    overflow: hidden;
    transition: max-height .3s ease;
}
.id-desc.clamped {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.id-desc-toggle {
    background: none; border: none;
    color: var(--primary); font-size: .78rem; font-weight: 800;
    cursor: pointer; font-family: inherit; padding: 6px 0 0;
    display: flex; align-items: center; gap: 5px;
}

/* ── Tags / chips ── */
.id-tags {
    display: flex; flex-wrap: wrap; gap: 7px;
}
.id-tag {
    display: inline-flex; align-items: center; gap: 5px;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: 50px;
    padding: 4px 12px;
    font-size: .74rem; font-weight: 700;
    color: var(--txt2);
}
.id-tag i { font-size: .7rem; color: var(--primary); }
.id-tag-size { cursor: pointer; font-family: inherit; }
.id-tag-size.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.id-tag-size.active i { color: #fff; }

/* ── Custom poster: customer's photo ── */
.id-upload {
    display: flex; align-items: center; justify-content: center;
    min-height: 120px; padding: 10px;
    border: 2px dashed var(--border2); border-radius: var(--r-sm);
    background: var(--bg); cursor: pointer; overflow: hidden;
}
.id-upload img { max-width: 100%; max-height: 260px; border-radius: var(--r-xs); display: block; }
.id-upload-hint { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: .8rem; font-weight: 700; color: var(--txt3); text-align: center; }
.id-upload-hint i { font-size: 1.5rem; color: var(--primary); }
.id-upload-status { font-size: .74rem; font-weight: 700; color: var(--txt3); margin: 8px 0; min-height: 1em; }
.id-upload-status.ok  { color: #16a34a; }
.id-upload-status.err { color: #ef4444; }
.id-note {
    width: 100%; box-sizing: border-box; resize: vertical;
    border: 1.5px solid var(--border); border-radius: var(--r-xs);
    background: var(--bg-white); color: var(--txt1);
    padding: 8px 10px; font: inherit; font-size: .8rem;
}

/* ════════════════════════════════
   RELATED SECTION
   ════════════════════════════════ */
.id-related-section {
    background: var(--bg-white);
    border-top: 1px solid var(--border);
    padding: 16px 0 16px 16px;
    margin-bottom: 2px;
}
.id-related-title {
    font-size: .72rem; font-weight: 800;
    color: var(--txt3);
    text-transform: uppercase; letter-spacing: .5px;
    margin-bottom: 12px;
    padding-right: 16px;
}
.id-related-scroll {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
    padding-right: 16px;
    scrollbar-width: none;
    cursor: grab;
}
.id-related-scroll:active { cursor: grabbing; }
.id-related-scroll::-webkit-scrollbar { display: none; }

/* Related product card */
.id-rel-card {
    flex-shrink: 0;
    width: 140px;
    background: var(--bg-white);
    border: 1.5px solid var(--border);
    border-radius: var(--r-sm);
    overflow: hidden;
    text-decoration: none; color: inherit;
    display: flex; flex-direction: column;
    transition: box-shadow var(--ease), border-color var(--ease);
}
.id-rel-card:hover { box-shadow: var(--sh-sm); border-color: var(--primary); }

.id-rel-img {
    height: 100px;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg);
    padding: 8px;
    border-bottom: 1px solid var(--border);
}
.id-rel-img img {
    max-width: 100%; max-height: 100%;
    object-fit: contain;
}
.id-rel-img .id-rel-no-img {
    font-size: 2rem; color: var(--border2);
}
.id-rel-body { padding: 8px 8px 6px; flex: 1; display: flex; flex-direction: column; }
.id-rel-name {
    font-size: .76rem; font-weight: 700;
    color: var(--txt1);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
    margin-bottom: 4px;
}
.id-rel-price {
    font-size: .82rem; font-weight: 800;
    color: var(--txt1); margin-top: auto;
}
.id-rel-price-orig {
    font-size: .62rem; color: var(--txt3);
    text-decoration: line-through; margin-left: 4px;
}
.id-rel-disc {
    font-size: .58rem; font-weight: 800;
    background: #dcfce7; color: #16a34a;
    border-radius: 4px; padding: 1px 4px;
    margin-left: auto;
}
.id-rel-actions {
    display: flex; gap: 5px;
    padding: 5px 6px 6px;
}
.id-rel-buy {
    flex: 1; height: 30px;
    background: var(--primary); color: #fff;
    border: none; border-radius: var(--r-xs);
    font-size: .66rem; font-weight: 800;
    cursor: pointer; font-family: inherit;
    display: flex; align-items: center; justify-content: center; gap: 4px;
    transition: background var(--ease);
}
.id-rel-buy:hover { background: var(--primary-dark); }
.id-rel-cart {
    width: 30px; height: 30px; flex-shrink: 0;
    border: 1.5px solid var(--border2);
    border-radius: var(--r-xs); background: none;
    color: var(--txt2); font-size: .72rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: border-color var(--ease), color var(--ease);
}
.id-rel-cart:hover { border-color: var(--primary); color: var(--primary); }

/* ════════════════════════════════
   STICKY BOTTOM ACTIONS
   ════════════════════════════════ */
.id-sticky-actions {
    position: fixed;
    bottom: var(--bnh);
    left: 0; right: 0;
    background: var(--bg-white);
    border-top: 1.5px solid var(--border);
    padding: 10px 14px;
    display: flex; gap: 10px;
    z-index: 800;
    box-shadow: 0 -4px 16px rgba(0,0,0,.08);
}
.id-sticky-cart,
.id-sticky-buy {
    flex: 1; height: 44px;
    border-radius: var(--r-sm);
    font-size: .88rem; font-weight: 800;
    cursor: pointer; font-family: inherit;
    display: flex; align-items: center; justify-content: center; gap: 7px;
    transition: background var(--ease), transform var(--ease);
}
.id-sticky-cart {
    background: var(--bg); color: var(--txt1);
    border: 1.5px solid var(--border2);
}
.id-sticky-cart:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-faint); }
.id-sticky-buy {
    background: var(--primary); color: #fff; border: none;
    box-shadow: 0 4px 14px rgba(45,140,240,.32);
}
.id-sticky-buy:hover { background: var(--primary-dark); transform: translateY(-1px); }

/* ════════════════════════════════
   TOAST
   ════════════════════════════════ */
.id-toast {
    position: fixed;
    bottom: calc(var(--bnh) + 60px);
    left: 50%; transform: translateX(-50%) translateY(16px);
    background: var(--txt1); color: var(--bg-white);
    padding: 9px 20px;
    border-radius: 50px;
    font-size: .8rem; font-weight: 700;
    white-space: nowrap;
    opacity: 0; pointer-events: none;
    z-index: 2000;
    box-shadow: var(--sh-md);
    transition: opacity .22s ease, transform .22s ease;
    max-width: calc(100vw - 32px);
}
.id-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.id-toast.success { background: #16a34a; }
.id-toast.error   { background: #dc2626; }

/* ── Responsive ── */
@media (min-width: 600px) {
    .id-gallery { height: 360px; }
    .id-gallery-arrow { width: 34px; height: 34px; }
}
@media (min-width: 900px) {
    .id-gallery { height: 420px; }
    .id-sticky-actions { max-width: 860px; left: 50%; right: auto; transform: translateX(-50%); width: 100%; }
}
