/* ── Cart Drawer — adscode-ug ──────────────────────────────────── */

/* overlay */
.adscode-drawer-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(10, 14, 22, 0.54);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.adscode-drawer-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

/* drawer panel */
.adscode-cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    width: min(420px, 100vw);
    max-width: 100vw;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    box-shadow: -8px 0 48px rgba(10, 14, 22, 0.22);
    transform: translateX(100%);
    transition: transform 0.36s cubic-bezier(0.22, 1, 0.36, 1);
    font-family: Arial, Helvetica, sans-serif;
    color: #141a29;
}

.adscode-cart-drawer.is-open {
    transform: translateX(0);
}

/* ── Header ──────────────────────────────────────────────────── */
.acd-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(20px + env(safe-area-inset-top, 0px)) 20px 16px;
    border-bottom: 1.5px solid #dbe2ee;
    flex-shrink: 0;
}

.acd-header__title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 900;
    letter-spacing: -0.02em;
    color: #111827;
}

.acd-header__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    border-radius: 999px;
    background: #00a8e8;
    color: #fff;
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
}

.acd-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 10px;
    background: #f5f7fb;
    color: #697386;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s ease, color 0.15s ease;
}

.acd-close:hover {
    background: #e8ebf2;
    color: #111827;
}

/* ── Free shipping bar ───────────────────────────────────────── */
.acd-shipping-bar {
    padding: 12px 20px 14px;
    border-bottom: 1.5px solid #dbe2ee;
    flex-shrink: 0;
    background: #fafbfd;
}

.acd-shipping-bar:empty {
    display: none;
}

.acd-shipping-bar__text {
    margin: 0 0 9px;
    font-size: 12.5px;
    color: #697386;
    text-align: center;
}

.acd-shipping-bar__text strong {
    color: #111827;
}

.acd-shipping-bar__text--done {
    color: #0f8a4b;
    font-weight: 700;
}

.acd-shipping-bar__track {
    position: relative;
    height: 6px;
    border-radius: 999px;
    background: #dbe2ee;
    overflow: visible;
}

.acd-shipping-bar__fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #00a8e8, #0077b6);
    transition: width 0.5s ease;
    min-width: 6px;
}

.acd-shipping-bar__truck {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #00a8e8;
    color: #00a8e8;
    transition: left 0.5s ease;
    z-index: 1;
}

.acd-shipping-bar__truck svg {
    width: 14px;
    height: 14px;
}

/* ── Scrollable body ─────────────────────────────────────────── */
.acd-body {
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 0 0 8px;
}

.acd-body::-webkit-scrollbar {
    width: 4px;
}

.acd-body::-webkit-scrollbar-track {
    background: transparent;
}

.acd-body::-webkit-scrollbar-thumb {
    background: #dbe2ee;
    border-radius: 999px;
}

/* ── Empty state ─────────────────────────────────────────────── */
.acd-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 60px 24px;
    text-align: center;
    color: #697386;
}

.acd-empty svg {
    width: 52px;
    height: 52px;
    opacity: 0.4;
}

.acd-empty p {
    margin: 0;
    font-size: 15px;
}

.acd-go-shop {
    display: inline-flex;
    align-items: center;
    height: 44px;
    padding: 0 22px;
    border-radius: 11px;
    background: linear-gradient(135deg, #00a8e8 0%, #0077b6 100%);
    color: #fff;
    font-size: 13px;
    font-weight: 900;
    text-decoration: none;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    box-shadow: 0 4px 14px rgba(0,168,232,0.3);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.acd-go-shop:hover {
    box-shadow: 0 6px 20px rgba(0,168,232,0.44);
    transform: translateY(-1px);
    color: #fff;
}

/* ── Cart items ──────────────────────────────────────────────── */
.acd-items {
    padding: 4px 0;
}

.acd-item {
    display: flex;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid #f0f3f8;
    transition: background 0.12s ease;
}

.acd-item:hover {
    background: #fafbfd;
}

.acd-item__img {
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #dbe2ee;
    background: #f5f7fb;
}

.acd-item__img a,
.acd-item__img img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 4px;
    box-sizing: border-box;
}

.acd-item__img a {
    padding: 0;
}

.acd-item__info {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.acd-item__name {
    font-size: 13px;
    font-weight: 800;
    color: #111827;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.acd-item__name a {
    color: inherit;
    text-decoration: none;
    transition: color 0.15s ease;
}

.acd-item__name a:hover {
    color: #00a8e8;
}

.acd-item__meta {
    font-size: 11.5px;
    color: #697386;
    line-height: 1.4;
}

.acd-item__meta dl {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 2px 8px;
}

.acd-item__meta dt { display: inline; font-weight: 600; }
.acd-item__meta dt::after { content: ': '; }
.acd-item__meta dd { display: inline; margin: 0; }

.acd-item__row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
}

/* quantity stepper */
.acd-qty {
    display: inline-flex;
    align-items: center;
    border: 1.5px solid #dbe2ee;
    border-radius: 9px;
    overflow: hidden;
    height: 34px;
}

.acd-qty__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 34px;
    border: 0;
    background: transparent;
    color: #697386;
    font-size: 16px;
    cursor: pointer;
    line-height: 1;
    transition: background 0.12s ease, color 0.12s ease;
    padding: 0;
    flex-shrink: 0;
}

.acd-qty__btn:hover {
    background: #f0f3f8;
    color: #111827;
}

.acd-qty__input {
    width: 32px;
    height: 34px;
    border: 0;
    border-left: 1.5px solid #dbe2ee;
    border-right: 1.5px solid #dbe2ee;
    text-align: center;
    font-size: 13px;
    font-weight: 800;
    color: #111827;
    background: transparent;
    -moz-appearance: textfield;
    padding: 0;
    box-sizing: border-box;
}

.acd-qty__input::-webkit-inner-spin-button,
.acd-qty__input::-webkit-outer-spin-button {
    -webkit-appearance: none;
}

.acd-qty__input:focus {
    outline: none;
    background: #f5f7fb;
}

/* price */
.acd-item__price {
    margin-left: auto;
    font-size: 14px;
    font-weight: 900;
    color: #00a8e8;
    white-space: nowrap;
    flex-shrink: 0;
}

.acd-item__price del {
    color: #697386;
    font-weight: 400;
    font-size: 11px;
    margin-right: 3px;
}

/* remove button */
.acd-item__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #c2c8d4;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    flex-shrink: 0;
    padding: 0;
}

.acd-item__remove:hover {
    background: rgba(220,38,38,0.08);
    color: #dc2626;
}

.acd-item__remove svg {
    width: 16px;
    height: 16px;
}

/* loading state */
.acd-items.is-loading {
    opacity: 0.5;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

/* ── Cross-sells ─────────────────────────────────────────────── */
.acd-crosssells {
    padding: 16px 20px 4px;
    border-top: 1.5px solid #dbe2ee;
    margin-top: 8px;
}

.acd-crosssells__title {
    margin: 0 0 12px;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #697386;
}

.acd-crosssells__list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.acd-cs-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid #eef1f8;
    background: #fafbfd;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.acd-cs-item:hover {
    border-color: #d0d8ef;
    box-shadow: 0 2px 10px rgba(20,26,41,0.07);
}

.acd-cs-item__img {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #dbe2ee;
    background: #fff;
}

.acd-cs-item__img a,
.acd-cs-item__img img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 3px;
    box-sizing: border-box;
}

.acd-cs-item__img a { padding: 0; }

.acd-cs-item__info {
    flex: 1 1 0;
    min-width: 0;
}

.acd-cs-item__name {
    display: block;
    font-size: 12.5px;
    font-weight: 800;
    color: #111827;
    text-decoration: none;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    transition: color 0.15s ease;
}

.acd-cs-item__name:hover {
    color: #00a8e8;
}

.acd-cs-item__price {
    display: block;
    margin-top: 2px;
    font-size: 13px;
    font-weight: 900;
    color: #00a8e8;
}

.acd-cs-item__add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    height: 34px;
    padding: 0 14px;
    border-radius: 9px;
    background: #111827;
    color: #fff;
    font-size: 12px;
    font-weight: 900;
    text-decoration: none;
    letter-spacing: 0.04em;
    white-space: nowrap;
    transition: background 0.15s ease, transform 0.15s ease;
}

.acd-cs-item__add:hover {
    background: #1f2937;
    transform: translateY(-1px);
    color: #fff;
}

/* ── Footer / Checkout button ────────────────────────────────── */
.acd-footer {
    flex-shrink: 0;
    padding: 14px 20px calc(20px + env(safe-area-inset-bottom, 0px));
    border-top: 1.5px solid #dbe2ee;
    background: #fafbfd;
}

.acd-checkout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 56px;
    border-radius: 14px;
    background: linear-gradient(135deg, #00a8e8 0%, #0077b6 100%);
    color: #fff;
    font-size: 15px;
    font-weight: 900;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-decoration: none;
    box-shadow:
        0 4px 18px rgba(0,168,232,0.38),
        inset 0 1px 0 rgba(255,255,255,0.18);
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.15s ease;
    box-sizing: border-box;
}

.acd-checkout-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.13) 50%, transparent 60%);
    transform: translateX(-100%);
    transition: transform 0.5s ease;
}

.acd-checkout-btn:hover {
    box-shadow:
        0 8px 30px rgba(0,168,232,0.52),
        inset 0 1px 0 rgba(255,255,255,0.22);
    transform: translateY(-2px);
    color: #fff;
}

.acd-checkout-btn:hover::after {
    transform: translateX(100%);
}

.acd-checkout-btn:active {
    transform: translateY(0);
    box-shadow: 0 3px 12px rgba(0,168,232,0.3);
}

/* ── Cart trigger icon badge ─────────────────────────────────── */
.adscode-cart-trigger {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    background: none;
    border: 0;
    padding: 0;
    color: inherit;
    text-decoration: none;
}

.adscode-cart-count {
    position: absolute;
    top: -6px;
    right: -8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #00a8e8;
    color: #fff;
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
    box-sizing: border-box;
}

.adscode-cart-count:empty {
    display: none;
}

/* ── no-scroll on body ───────────────────────────────────────── */
body.acd-drawer-open {
    overflow: hidden;
}

@media (max-width: 640px) {
    .adscode-cart-drawer {
        width: 100vw;
        border-radius: 0;
    }

    .acd-header {
        padding: calc(16px + env(safe-area-inset-top, 0px)) 16px 14px;
    }

    .acd-header__title {
        font-size: 17px;
    }

    .acd-shipping-bar,
    .acd-crosssells,
    .acd-footer {
        padding-left: 16px;
        padding-right: 16px;
    }

    .acd-shipping-bar {
        padding-top: 10px;
        padding-bottom: 12px;
    }

    .acd-item {
        display: grid;
        grid-template-columns: 64px minmax(0, 1fr);
        gap: 10px 12px;
        padding: 14px 16px;
    }

    .acd-item__img {
        width: 64px;
        height: 64px;
        grid-row: 1 / span 3;
    }

    .acd-item__info {
        gap: 6px;
    }

    .acd-item__row {
        flex-wrap: wrap;
        align-items: stretch;
        gap: 8px 10px;
    }

    .acd-item__price {
        margin-left: 0;
    }

    .acd-item__remove {
        margin-left: auto;
    }

    .acd-qty {
        height: 36px;
    }

    .acd-qty__btn {
        width: 32px;
        height: 36px;
    }

    .acd-qty__input {
        width: 38px;
        height: 36px;
    }

    .acd-cs-item {
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .acd-cs-item__add {
        width: 100%;
        min-height: 38px;
    }

    .acd-checkout-btn {
        min-height: 52px;
        font-size: 14px;
    }
}

@media (max-width: 380px) {
    .acd-header__title {
        font-size: 16px;
    }

    .acd-item {
        grid-template-columns: 56px minmax(0, 1fr);
    }

    .acd-item__img {
        width: 56px;
        height: 56px;
    }

    .acd-go-shop,
    .acd-checkout-btn {
        width: 100%;
        justify-content: center;
    }

    .acd-checkout-btn {
        font-size: 13px;
    }
}
