/* ============================================================
   LuxTextile — Cart styles
   ============================================================ */

/* === Header cart icon === */
.cm-cart-btn {
    position: relative;
    width: 42px;
    height: 42px;
    border: 0;
    background: #fdf3f7;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform .18s ease, background .18s;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
    border: 1px solid #f8d3e3;
}
.cm-cart-btn:hover { transform: scale(1.06); background: #fae0ee; }
.cm-cart-btn svg { width: 20px; height: 20px; stroke: #b03062; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cm-cart-btn__badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    background: #e74694;
    color: #fff;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(231,70,148,.5);
    border: 2px solid #fff;
}
.cm-cart-btn--filled .cm-cart-btn__badge { display: flex; }
.cm-cart-btn--pulse { animation: cmCartPulse .55s ease; }
@keyframes cmCartPulse {
    0%, 100% { transform: scale(1); }
    40%      { transform: scale(1.25); box-shadow: 0 0 0 8px rgba(231,70,148,.18); }
    70%      { transform: scale(.95); }
}

/* === Backdrop === */
.cm-cart-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(20,20,30,.5);
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility .25s ease;
}
.cm-cart-backdrop--open { opacity: 1; visibility: visible; }

/* === Drawer (Cart panel) === */
.cm-cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(420px, 90vw);
    background: #fff;
    z-index: 99999;
    transform: translateX(100%);
    transition: transform .3s cubic-bezier(.32,.72,.32,1);
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 40px rgba(0,0,0,.15);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #1f1a25;
}
.cm-cart-drawer--open { transform: translateX(0); }

.cm-cart-header {
    padding: 20px 22px 16px;
    border-bottom: 1px solid #f3e8ee;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.cm-cart-header h2 {
    margin: 0;
    font-size: 19px;
    font-weight: 700;
    color: #2d1830;
}
.cm-cart-close {
    width: 36px; height: 36px;
    border: 0;
    background: #fdf3f7;
    border-radius: 999px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #b03062;
    font-size: 20px;
    line-height: 1;
}
.cm-cart-close:hover { background: #fae0eb; }

.cm-cart-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 18px;
}

/* Trust блок — закриває "дирку" в порожньому drawer */
.cm-cart-trust {
    margin-top: 18px;
    padding: 16px 14px;
    background: linear-gradient(135deg,#fef0f7,#fff8fb);
    border-radius: 16px;
    border: 1px solid #f8d3e3;
}
.cm-cart-trust__title {
    font-size: 12px;
    font-weight: 700;
    color: #2d1830;
    margin: 0 0 10px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.cm-cart-trust__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.cm-cart-trust__list li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: #5e4860;
}
.cm-cart-trust__list li svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke: #b03062;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.cm-cart-trust__list li strong { color: #2d1830; font-weight: 700; }

.cm-cart-empty {
    text-align: center;
    padding: 60px 20px;
    color: #998998;
}
.cm-cart-empty-icon {
    width: 64px; height: 64px;
    margin: 0 auto 18px;
    opacity: .35;
}
.cm-cart-empty p { margin: 0; font-size: 15px; }
.cm-cart-empty .cm-cart-empty-cta {
    margin-top: 18px;
    display: inline-block;
    background: #fdc8e4;
    color: #2d1830;
    padding: 10px 20px;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
}

/* === Cart item === */
.cm-cart-item {
    display: flex;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid #f8eaf2;
}
.cm-cart-item:last-child { border-bottom: 0; }
.cm-cart-item__img {
    width: 70px;
    height: 90px;
    object-fit: cover;
    border-radius: 10px;
    background: #f8eaf2;
    flex-shrink: 0;
}
.cm-cart-item__info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.cm-cart-item__name {
    font-size: 14px;
    font-weight: 600;
    color: #2d1830;
    margin: 0;
    line-height: 1.3;
}
.cm-cart-item__meta {
    font-size: 12px;
    color: #786578;
    line-height: 1.4;
}
.cm-cart-item__row {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.cm-cart-qty {
    display: inline-flex;
    align-items: center;
    background: #fdf3f7;
    border-radius: 999px;
    padding: 2px;
}
.cm-cart-qty button {
    width: 26px; height: 26px;
    border: 0;
    background: #fff;
    border-radius: 999px;
    cursor: pointer;
    color: #b03062;
    font-size: 14px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.cm-cart-qty button:disabled { opacity: .3; cursor: not-allowed; }
.cm-cart-qty span {
    min-width: 24px;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: #2d1830;
}
.cm-cart-item__price {
    font-size: 14px;
    font-weight: 700;
    color: #b03062;
}
.cm-cart-item__remove {
    background: transparent;
    border: 0;
    color: #b03062;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    padding: 0;
    margin-top: 6px;
    text-decoration: underline;
    text-decoration-color: rgba(176,48,98,.4);
    width: fit-content;
}
.cm-cart-item__remove:hover { color: #d63a82; text-decoration-color: #d63a82; }

/* === Summary / Totals === */
.cm-cart-summary {
    padding: 16px 22px;
    border-top: 1px solid #f3e8ee;
    background: #fffafc;
    flex-shrink: 0;
}
.cm-cart-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 13px;
    color: #786578;
}
.cm-cart-row strong { color: #2d1830; }
.cm-cart-row--discount strong { color: #1aa364; }
.cm-cart-row--total {
    margin-top: 10px;
    padding-top: 12px;
    border-top: 1px dashed #e8d5e0;
    font-size: 17px;
}
.cm-cart-row--total strong { color: #b03062; font-size: 22px; }
.cm-cart-bulk-hint {
    background: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 11px;
    color: #5e4860;
    text-align: center;
    margin-bottom: 12px;
    border: 1px dashed #f0d5e3;
}
.cm-cart-checkout-btn {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, #e74694, #c43476);
    color: #fff;
    border: 0;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 10px;
    box-shadow: 0 4px 14px rgba(231,70,148,.3);
}
.cm-cart-checkout-btn:hover { transform: translateY(-1px); }
.cm-cart-checkout-btn:disabled {
    background: #c8a8b8;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}
.cm-cart-continue-btn {
    width: 100%;
    padding: 12px 20px;
    background: transparent;
    color: #786578;
    border: 1.5px solid #f0d5e3;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    transition: all .15s;
}
.cm-cart-continue-btn:hover { background: #fdf3f7; color: #b03062; border-color: #e74694; }

/* === Sticky cart bar (внизу екрану на сторінці товара) === */
.cm-sticky-cart {
    position: fixed;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%) translateY(120%);
    z-index: 9998;
    background: linear-gradient(135deg, #2d1830, #4a2645);
    color: #fff;
    padding: 12px 18px 12px 14px;
    border-radius: 999px;
    box-shadow: 0 12px 32px rgba(45,24,48,.35);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    border: 0;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    transition: transform .35s cubic-bezier(.34,1.56,.64,1), opacity .3s;
    opacity: 0;
    pointer-events: none;
    max-width: calc(100vw - 24px);
}
.cm-sticky-cart--visible { transform: translateX(-50%) translateY(0); opacity: 1; pointer-events: auto; }
.cm-sticky-cart:hover { box-shadow: 0 16px 40px rgba(45,24,48,.45); }
.cm-sticky-cart__icon {
    width: 32px; height: 32px;
    background: rgba(255,255,255,.15);
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
}
.cm-sticky-cart__icon svg { width: 16px; height: 16px; stroke: #fff; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cm-sticky-cart__count {
    position: absolute;
    top: -4px; right: -4px;
    min-width: 18px; height: 18px;
    background: #e74694;
    border-radius: 999px;
    font-size: 10px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid #2d1830;
    line-height: 1;
}
.cm-sticky-cart__text { display: flex; flex-direction: column; line-height: 1.2; }
.cm-sticky-cart__title { font-size: 12px; opacity: .75; font-weight: 500; }
.cm-sticky-cart__amount { font-size: 14px; font-weight: 800; }
.cm-sticky-cart__arrow {
    background: rgba(255,255,255,.2);
    border-radius: 999px;
    width: 28px; height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.cm-sticky-cart__arrow svg { width: 14px; height: 14px; stroke: #fff; fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }

/* === Checkout panel (replaces cart body) === */
.cm-checkout {
    padding: 16px 22px;
}
.cm-checkout-back {
    background: transparent;
    border: 0;
    color: #786578;
    font-size: 13px;
    cursor: pointer;
    padding: 0;
    margin-bottom: 14px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.cm-checkout-back:hover { color: #b03062; }
.cm-checkout h3 {
    font-family: 'Playfair Display', Georgia, serif;
    font-style: italic;
    font-size: 22px;
    text-align: center;
    margin: 0 0 6px;
    color: #2d1830;
}
.cm-checkout p.cm-checkout__sub {
    text-align: center;
    color: #786578;
    font-size: 13px;
    margin: 0 0 18px;
}
.cm-checkout-summary {
    background: #fef0f7;
    border-radius: 16px;
    padding: 14px 16px;
    margin-bottom: 16px;
}
.cm-checkout-summary__line {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    padding: 4px 0;
    color: #5e4860;
}
.cm-checkout-summary__total {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #f0c8de;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    color: #2d1830;
}
.cm-checkout-summary__total strong { color: #b03062; font-size: 18px; }

.cm-checkout-form { display: flex; flex-direction: column; gap: 12px; }
.cm-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cm-checkout-form input[type=text],
.cm-checkout-form input[type=tel],
.cm-checkout-form .cm-np-field {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid #f0d5e3;
    border-radius: 14px;
    background: #fff;
    font-size: 15px;
    color: #2d1830;
    transition: border-color .15s;
    outline: none;
    font-family: inherit;
}
.cm-checkout-form input:focus { border-color: #e74694; }
.cm-np-field { position: relative; }
.cm-np-field input {
    width: 100%; border: 0; outline: 0; background: transparent;
    font-size: 15px; padding: 0;
}
.cm-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    background: #fdf3f7;
    border-radius: 14px;
    cursor: pointer;
    font-size: 13px;
    color: #2d1830;
}
.cm-checkbox input { margin: 2px 0 0; cursor: pointer; }
.cm-submit {
    width: 100%;
    padding: 16px 20px;
    background: linear-gradient(135deg, #e74694, #c43476);
    color: #fff;
    border: 0;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 8px;
    box-shadow: 0 6px 20px rgba(231,70,148,.35);
}
.cm-submit:disabled {
    background: linear-gradient(135deg, #f5d8e8, #ecc6dc);
    cursor: not-allowed;
    box-shadow: none;
}
.cm-submit-hint {
    text-align: center;
    font-size: 12px;
    color: #c43476;
    margin: 4px 0 0;
    background: #fef0f7;
    padding: 10px;
    border-radius: 999px;
}
.cm-checkout-trust {
    text-align: center;
    font-size: 11px;
    color: #998998;
    font-style: italic;
    margin-top: 12px;
    line-height: 1.4;
}

/* === Toast notification === */
.cm-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #2d1830;
    color: #fff;
    padding: 12px 20px;
    border-radius: 999px;
    font-size: 13px;
    z-index: 100000;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s, transform .25s;
    box-shadow: 0 8px 28px rgba(45,24,48,.35);
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}
.cm-toast--show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* === PDP additions: size picker + dual buttons === */
.cm-size-picker {
    margin: 16px auto;
    max-width: 480px;
    width: 100%;
    box-sizing: border-box;
    padding: 0 12px;
}
.cm-size-picker__label {
    font-weight: 600;
    color: #2d1830;
    font-size: 13px;
    margin-bottom: 8px;
    display: block;
}
.cm-size-picker__grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
}
.cm-size-picker__btn {
    padding: 10px 4px;
    border: 1.5px solid #f0d5e3;
    background: #fff;
    border-radius: 12px;
    font-weight: 700;
    color: #2d1830;
    cursor: pointer;
    transition: border-color .12s, background .12s, color .12s, box-shadow .12s;
    font-size: 13px;
    font-family: inherit;
    text-align: center;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    touch-action: manipulation;
    line-height: 1;
    white-space: nowrap;
}
.cm-size-picker__btn:hover { border-color: #e74694; color: #b03062; }
.cm-size-picker__btn:active { transform: scale(.96); }
.cm-size-picker__btn--active {
    background: linear-gradient(135deg, #ff79b8, #e74694);
    color: #fff;
    border-color: #e74694;
    box-shadow: 0 4px 12px rgba(231,70,148,.32);
}
.cm-size-picker__btn--active:hover { color: #fff; border-color: #e74694; }

@media(max-width: 380px) {
    .cm-size-picker__grid { gap: 5px; }
    .cm-size-picker__btn { padding: 9px 2px; font-size: 12px; }
}

.cm-cta-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 16px auto 0;
    max-width: 480px;
    width: 100%;
    box-sizing: border-box;
    padding: 0 12px;
}
.cm-btn-add-cart {
    padding: 14px 16px;
    border: 2px solid #e74694;
    background: #fff;
    color: #e74694;
    border-radius: 999px;
    font-weight: 700;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    transition: all .15s;
}
.cm-btn-add-cart:hover { background: #fef0f7; }
.cm-btn-quick-order {
    padding: 14px 16px;
    background: linear-gradient(135deg, #e74694, #c43476);
    color: #fff;
    border: 0;
    border-radius: 999px;
    font-weight: 700;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    box-shadow: 0 4px 14px rgba(231,70,148,.3);
}

/* Quick order modal */
.cm-quick-order {
    background: #fff;
    border-radius: 20px;
    padding: 22px;
    max-width: 420px;
    margin: 40px auto;
    position: relative;
}

/* === Nova Poshta autocomplete === */
.cm-np-autocomplete {
    position: relative;
}
.cm-np-autocomplete input {
    width: 100%;
}
.cm-np-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 12px 36px rgba(45,24,48,.18), 0 0 0 1px rgba(248,211,227,.6);
    max-height: 280px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    padding: 4px;
}
.cm-np-list--show { display: block; }
.cm-np-item {
    padding: 10px 14px;
    cursor: pointer;
    border-radius: 10px;
    transition: background .12s;
}
.cm-np-item:hover { background: #fdf3f7; }
.cm-np-item strong {
    display: block;
    color: #2d1830;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
}
.cm-np-item span {
    display: block;
    color: #786578;
    font-size: 12px;
    margin-top: 2px;
}
.cm-np-item--info {
    color: #998998;
    font-size: 12px;
    cursor: default;
    text-align: center;
    font-style: italic;
}
.cm-np-item--info:hover { background: transparent; }

@media (max-width: 460px) {
    .cm-cart-drawer { width: 90vw; max-width: 380px; }
    /* На етапі оформлення — на весь екран */
    .cm-cart-drawer.cm-cart-drawer--checkout { width: 100vw; max-width: 100vw; }
    .cm-sticky-cart { bottom: 12px; padding: 10px 14px 10px 12px; }
}
