/**
 * Amigo Side Cart Styles v4.9.4
 * Slide-out delete, Undo toast, Skeleton loading, Price flash, Add-to-cart queue
 */

/* ==========================================================================
   ПРИХОВУЄМО СТАНДАРТНІ ЕЛЕМЕНТИ
   ========================================================================== */

/* Стандартна кнопка видалення */
.woocommerce-mini-cart-item > .remove_from_cart_button {
    display: none !important;
}

/* Ховаємо стандартні WooCommerce notices в side cart (є наш toast) */
.xts-cart-widget-side .woocommerce-notices-wrapper,
.xts-cart-widget-side .woocommerce-error,
.xts-cart-widget-side .woocommerce-message,
.xts-cart-widget-side .woocommerce-info,
.widget_shopping_cart .woocommerce-notices-wrapper,
.widget_shopping_cart .woocommerce-message {
    display: none !important;
}

/* Стандартні кнопки внизу */
.woocommerce-mini-cart__buttons,
.woocommerce-mini-cart__total {
    display: none !important;
}

/* Стандартний прогрес-бар внизу - ховаємо */
.xts-mini-cart-footer .xts-free-progress-bar,
.xts-mini-cart-footer .xts-progress-bar {
    display: none !important;
}

/* Стандартний блок кількості XTS - ховаємо (є наш) */
.woocommerce-mini-cart-item .xts-quantity,
.woocommerce-mini-cart-item .quantity:not(.amg-qty-wrapper) {
    display: none !important;
}

/* Стандартний span.quantity з ціною - ховаємо */
.woocommerce-mini-cart-item .xts-mini-cart-content .quantity {
    display: none !important;
}

/* Стандартний контент XTS - ховаємо повністю (є наш amg-cart-item-content) */
.woocommerce-mini-cart-item > .xts-mini-cart-content {
    display: none !important;
}


/* ==========================================================================
   LAYOUT КОШИКА
   ========================================================================== */

.xts-side-opened .widget_shopping_cart_content,
.xts-cart-opened .widget_shopping_cart_content {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    max-height: calc(100vh - 60px) !important;
    max-height: calc(100dvh - 60px) !important;
}

/* Контейнер для хедера + товарів (все скролиться разом) */
.widget_shopping_cart_content .amg-scrollable-wrapper {
    flex: 1 1 auto !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 12px !important;
}

/* Якщо немає wrapper - скролимо звичайний контент */
.widget_shopping_cart_content .woocommerce-mini-cart.xts-scroll-content {
    flex: 1 1 auto !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    max-height: none !important;
    padding: 0 12px 12px !important;
}

/* Хедер переміщений всередину scroll (через JS) */
.amg-cart-header {
    position: static !important;
    top: unset !important;
    z-index: auto !important;
    padding: 0 0 12px 0 !important;
    margin: 0 !important;
    background: transparent !important;
    display: block !important;
}

/* Коли хедер переміщено в scroll-область */
.woocommerce-mini-cart .amg-cart-header.amg-moved {
    padding: 0 0 12px 0 !important;
    margin: 0 0 0 0 !important;
    list-style: none !important;
}


/* ==========================================================================
   HEADER КОШИКА - Прогрес-бар (всередині scroll)
   ========================================================================== */

/* Header як елемент списку */
.amg-cart-header-item {
    display: block !important;
    padding: 0 0 12px 0 !important;
    margin: 0 0 8px 0 !important;
    border-bottom: none !important;
    list-style: none !important;
    /* Sticky Header */
    position: sticky !important;
    top: 0 !important;
    z-index: 10 !important;
    background: #fff !important;
    /* Small shadow to separate from content when scrolling */
    box-shadow: 0 4px 6px -4px rgba(0,0,0,0.1) !important;
    /* Ensure padding covers the top gap */
    padding-top: 12px !important;
    margin-top: -12px !important; /* Compensate for padding in wrapper */
}

.amg-cart-header-item .xts-free-progress-bar,
.amg-cart-header-item .xts-progress-bar {
    display: block !important;
    background: #fffbeb !important;
    border-radius: 10px !important;
    padding: 10px 12px !important;
    margin-bottom: 0 !important;
}

.amg-cart-header-item .xts-progress-info {
    font-size: 13px !important;
    color: #333 !important;
    margin-bottom: 6px !important;
}

.amg-cart-header-item .xts-progress-info strong {
    color: #f59e0b !important;
}

.amg-cart-header-item .xts-progress-line {
    height: 5px !important;
    background: #fde68a !important;
    border-radius: 3px !important;
    overflow: hidden !important;
}

.amg-cart-header-item .xts-progress-track {
    height: 100% !important;
    background: linear-gradient(90deg, #f59e0b, #fbbf24) !important;
    border-radius: 3px !important;
    transition: width 0.3s ease !important;
}

/* Дата відправки */
.amg-cart-shipping-date {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    margin-top: 8px !important;
    padding: 8px 10px !important;
    background: #f0fdf4 !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    color: #166534 !important;
}

.amg-cart-shipping-date .amg-shipping-icon {
    font-size: 14px !important;
}

.amg-cart-shipping-date strong {
    color: #15803d !important;
}


/* ==========================================================================
   КАРТКА ТОВАРУ - Desktop: горизонтальний layout
   ========================================================================== */

/* Картка товару - GRID layout */
.woocommerce-mini-cart li.woocommerce-mini-cart-item.amg-cart-item {
    display: grid !important;
    grid-template-columns: 64px 1fr !important;
    grid-template-rows: auto auto !important;
    gap: 8px 12px !important;
    padding: 14px 0 !important;
    border-bottom: 1px solid #e8e8e8 !important;
    position: relative !important;
    align-items: start !important;
}

.woocommerce-mini-cart li.woocommerce-mini-cart-item.amg-cart-item:last-child {
    border-bottom: none !important;
}

/* Верхній ряд - розміщення в grid */
.amg-cart-item-row-top {
    display: contents !important; /* Діти стають частиною батьківського grid */
}

/* Зображення товару - колонка 1, обидва ряди */
.amg-cart-item:not(.amg-clerk-recommendations-item) .amg-cart-thumb {
    grid-column: 1 !important;
    grid-row: 1 / 3 !important;
    position: relative !important;
    display: block !important;
    width: 64px !important;
    height: 64px !important;
    min-width: 64px !important;
    max-width: 64px !important;
    min-height: 64px !important;
    max-height: 64px !important;
    flex-shrink: 0 !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    background: #f8f8f8 !important;
    border: 1px solid #f0f0f0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

.amg-cart-item:not(.amg-clerk-recommendations-item) .amg-cart-thumb img {
    position: relative !important;
    display: block !important;
    width: 64px !important;
    height: 64px !important;
    max-width: 64px !important;
    max-height: 64px !important;
    object-fit: contain !important;
    object-position: center !important;
    background: transparent !important;
    mix-blend-mode: normal !important;
    filter: none !important;
    opacity: 1 !important;
}

/* Прибираємо будь-які оверлеї на картинках товарів */
li.amg-cart-item:not(.amg-clerk-recommendations-item) .amg-cart-thumb::before,
li.amg-cart-item:not(.amg-clerk-recommendations-item) .amg-cart-thumb::after {
    display: none !important;
    content: none !important;
}

/* Прибираємо lazy load ефекти */
li.amg-cart-item:not(.amg-clerk-recommendations-item) .amg-cart-thumb img.xts-lazy-load,
li.amg-cart-item:not(.amg-clerk-recommendations-item) .amg-cart-thumb img.lazyload {
    opacity: 1 !important;
    filter: none !important;
    background: transparent !important;
}

/* Контент товару - колонка 2, ряд 1 */
.amg-cart-item-content {
    grid-column: 2 !important;
    grid-row: 1 !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
}

/* Назва товару */
.amg-cart-item-title {
    font-size: 13px !important;
    font-weight: 400 !important;
    color: #333 !important;
    text-decoration: none !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    line-height: 1.4 !important;
    margin: 0 !important;
}

.amg-cart-item-title:hover {
    color: #ffba00 !important;
}

/* Варіації/мета товару */
.amg-cart-item-meta {
    font-size: 12px !important;
    color: #666 !important;
    line-height: 1.3 !important;
}

.amg-cart-item-meta dt,
.amg-cart-item-meta dd {
    display: inline !important;
    margin: 0 !important;
}

.amg-cart-item-meta dt::after {
    content: ': ' !important;
}

.amg-cart-item-meta dd::after {
    content: '' !important;
}

.amg-cart-item-meta dl {
    margin: 0 !important;
}

.amg-cart-item-meta p {
    margin: 0 !important;
}

/* Ціна - flex-дитина row-bottom, притиснута праворуч */
.amg-cart-item-price {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-end !important;
    justify-content: flex-start !important;
    text-align: right !important;
    min-width: 75px !important;
    margin-left: auto !important;
}

/* Кнопка видалення */
.amg-item-delete {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 28px !important;
    height: 28px !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    color: #bbb !important;
    font-size: 20px !important;
    font-weight: 300 !important;
    line-height: 1 !important;
    margin: 0 !important;
    padding: 0 !important;
    transition: all 0.15s !important;
    flex-shrink: 0 !important;
    border-radius: 6px !important;
}

.amg-item-delete:hover {
    color: #f84147 !important;
    background: #fef2f2 !important;
}

/* Нижній ряд з qty + ціна + delete */
.amg-cart-item-row-bottom {
    grid-column: 2 !important;
    grid-row: 2 !important;
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 6px 12px !important;
    margin-top: 0 !important;
}


/* ==========================================================================
   КНОПКИ КІЛЬКОСТІ - Modern Capsule Style
   ========================================================================== */

.amg-qty-wrapper {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0 !important;
    background: #f3f4f6 !important;
    border: none !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    flex-shrink: 0 !important;
}

.amg-qty-btn {
    width: 32px !important;
    height: 30px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    color: #6b7280 !important;
    transition: all 0.15s !important;
    padding: 0 !important;
}

.amg-qty-btn:hover {
    color: #1f2937 !important;
    background: #e5e7eb !important;
}

.amg-qty-btn.amg-disabled,
.amg-qty-btn:disabled {
    opacity: 0.35 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
}

.amg-qty-plus {
    color: #d97706 !important;
}

.amg-qty-plus:hover {
    color: #b45309 !important;
    background: #fef3c7 !important;
}

.amg-qty-input {
    width: 32px !important;
    height: 30px !important;
    text-align: center !important;
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #1f2937 !important;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 30px !important;
    -moz-appearance: textfield !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

.amg-qty-input::-webkit-outer-spin-button,
.amg-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
}

.amg-qty-input:focus {
    outline: none !important;
    background: rgba(0,0,0,0.03) !important;
}


/* Стара ціна (закреслена) - inline в рядку з бейджем */
.amg-cart-item-price del,
.amg-cart-item-price .amg-old-price {
    color: #999 !important;
    font-weight: 400 !important;
    font-size: 12px !important;
    text-decoration: line-through !important;
    display: inline !important;
    margin: 0 !important;
}

.amg-cart-item-price del .woocommerce-Price-amount {
    color: #999 !important;
    display: inline !important;
}

/* Актуальна ціна - другий рядок */
.amg-cart-item-price .amg-current-price,
.amg-cart-item-price ins {
    font-size: 15px !important;
    font-weight: 700 !important;
    color: #333 !important;
    text-decoration: none !important;
    background: none !important;
    display: block !important;
}

.amg-cart-item-price ins .woocommerce-Price-amount {
    color: #333 !important;
}

/* Звичайна ціна без знижки */
.amg-cart-item-price .amg-regular-price {
    font-size: 16px !important;
    font-weight: 700 !important;
    color: #333 !important;
}

/* Перший рядок ціни: бейдж + стара ціна */
.amg-price-row-old {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    margin-bottom: 2px !important;
}

/* Бейдж знижки - inline біля старої ціни */
.amg-cart-item-price .amg-discount-badge {
    position: static !important;
    display: inline-block !important;
    background: #f84147 !important;
    color: #fff !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    padding: 2px 5px !important;
    border-radius: 4px !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
}


/* ==========================================================================
   FOOTER КОШИКА
   ========================================================================== */

.xts-mini-cart-footer {
    padding: 8px 12px !important;
    background: #fff !important;
    border-top: 1px solid #e5e7eb !important;
}

/* Підсумок-картка */
.amg-cart-summary-card {
    background: #f9fafb !important;
    border-radius: 8px !important;
    padding: 8px 12px !important;
    margin-bottom: 8px !important;
    text-align: center !important;
}
.amg-cart-summary-card__total {
    font-size: 13px !important;
    color: #6b7280 !important;
    line-height: 1.4 !important;
}
.amg-cart-summary-card__total .amg-items-total {
    font-weight: 600 !important;
    color: #1f2937 !important;
}
.amg-cart-summary-card__savings {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #16a34a !important;
    margin-top: 4px !important;
    line-height: 1.3 !important;
}
.amg-cart-summary-card__savings svg {
    flex-shrink: 0 !important;
}
.amg-cart-cashback-hint {
    color: #b8860b !important;
    font-weight: 500 !important;
    font-size: inherit !important;
}
.amg-cart-summary-card--has-savings {
    background: #f0fdf4 !important;
    border: 1px solid #dcfce7 !important;
}

/* Підсумок - переміщений в scroll (legacy) */
.woocommerce-mini-cart .amg-cart-summary.amg-moved {
    text-align: center !important;
    padding: 12px 0 !important;
    margin: 0 !important;
    font-size: 13px !important;
    color: #6b7280 !important;
    border-top: 1px solid #f3f4f6 !important;
    list-style: none !important;
}

.amg-items-total {
    font-weight: 600 !important;
    color: #1f2937 !important;
}

/* ==========================================================================
   КНОПКА ОФОРМЛЕННЯ
   ========================================================================== */

.amg-checkout-btn-wrapper {
    width: 100% !important;
}

.amg-checkout-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 48px !important;
    background: #ffba00 !important;
    border: none !important;
    border-radius: 10px !important;
    text-decoration: none !important;
    overflow: hidden !important;
    transition: background 0.2s !important;
}

.amg-checkout-btn:hover {
    background: #e5a800 !important;
}

.amg-checkout-btn-text {
    flex: 1 !important;
    text-align: center !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    color: #190a03 !important;
    padding: 0 16px !important;
}

.amg-checkout-btn-price {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 100% !important;
    padding: 0 20px !important;
    background: transparent !important;
    border-left: 1px solid rgba(25,10,3,0.15) !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    color: #190a03 !important;
}

/* Ціна на кнопці - контрастна */
.amg-checkout-btn-price,
.amg-checkout-btn-price .woocommerce-Price-amount,
.amg-checkout-btn-price .woocommerce-Price-currencySymbol,
.amg-checkout-btn-price bdi {
    color: #190a03 !important;
}


/* ==========================================================================
   ТОВАР НЕ В НАЯВНОСТІ
   ========================================================================== */

.woocommerce-mini-cart-item.amg-item-oos {
    opacity: 0.6 !important;
}


/* ==========================================================================
   АНІМАЦІЇ ТА СТАНИ
   ========================================================================== */

/* --- SLIDE-OUT видалення --- */
.woocommerce-mini-cart-item.amg-removing {
    animation: amg-slide-out 0.3s ease forwards !important;
    pointer-events: none !important;
    overflow: hidden !important;
}

@keyframes amg-slide-out {
    0% {
        opacity: 1;
        transform: translateX(0);
        max-height: 150px;
    }
    50% {
        opacity: 0.5;
        transform: translateX(100%);
        max-height: 150px;
    }
    100% {
        opacity: 0;
        transform: translateX(100%);
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
        margin: 0;
        border: none;
    }
}

/* --- Оновлення кількості --- */
.woocommerce-mini-cart-item.amg-updating {
    position: relative !important;
    pointer-events: none !important;
}

.woocommerce-mini-cart-item.amg-updating::after {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(255,255,255,0.7) !important;
    border-radius: 8px !important;
}

/* --- Підсвітка ціни при зміні --- */
.amg-cart-item-price.amg-price-flash {
    animation: amg-price-flash 0.6s ease !important;
}

@keyframes amg-price-flash {
    0% {
        background: transparent;
        transform: scale(1);
    }
    25% {
        background: #fef3c7;
        transform: scale(1.08);
        border-radius: 6px;
    }
    50% {
        background: #fde68a;
        transform: scale(1.05);
    }
    100% {
        background: transparent;
        transform: scale(1);
    }
}

/* Колір тексту при flash */
.amg-cart-item-price.amg-price-flash .amg-current-price,
.amg-cart-item-price.amg-price-flash .amg-regular-price {
    color: #b45309 !important;
    transition: color 0.3s !important;
}

/* Зменшення ціни - зелений flash */
.amg-cart-item-price.amg-price-decrease {
    animation: amg-price-decrease 0.6s ease !important;
}

@keyframes amg-price-decrease {
    0% {
        background: transparent;
        transform: scale(1);
    }
    25% {
        background: #dcfce7;
        transform: scale(1.08);
        border-radius: 6px;
    }
    50% {
        background: #bbf7d0;
        transform: scale(1.05);
    }
    100% {
        background: transparent;
        transform: scale(1);
    }
}

.amg-cart-item-price.amg-price-decrease .amg-current-price,
.amg-cart-item-price.amg-price-decrease .amg-regular-price {
    color: #15803d !important;
    transition: color 0.3s !important;
}

/* --- SKELETON LOADING --- */
.woocommerce-mini-cart.amg-loading {
    pointer-events: none !important;
    position: relative !important;
}

.woocommerce-mini-cart.amg-loading .amg-cart-item {
    position: relative !important;
}

/* Skeleton overlay на елементах */
.woocommerce-mini-cart.amg-loading .amg-cart-thumb,
.woocommerce-mini-cart.amg-loading .amg-cart-item-title,
.woocommerce-mini-cart.amg-loading .amg-cart-item-price,
.woocommerce-mini-cart.amg-loading .amg-qty-wrapper {
    position: relative !important;
    overflow: hidden !important;
}

.woocommerce-mini-cart.amg-loading .amg-cart-thumb::after,
.woocommerce-mini-cart.amg-loading .amg-cart-item-title::after,
.woocommerce-mini-cart.amg-loading .amg-cart-item-price::after,
.woocommerce-mini-cart.amg-loading .amg-qty-wrapper::after {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: linear-gradient(90deg,
        rgba(255,255,255,0) 0%,
        rgba(255,255,255,0.8) 50%,
        rgba(255,255,255,0) 100%) !important;
    background-size: 200% 100% !important;
    animation: amg-skeleton-shimmer 1.2s infinite !important;
    border-radius: inherit !important;
}

@keyframes amg-skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Глобальний лоадер (fallback) */
.woocommerce-mini-cart.amg-loading::before {
    content: '' !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    width: 32px !important;
    height: 32px !important;
    margin: -16px 0 0 -16px !important;
    border: 3px solid #e5e7eb !important;
    border-top-color: #ffba00 !important;
    border-radius: 50% !important;
    animation: amg-spin 0.8s linear infinite !important;
}

@keyframes amg-spin {
    to { transform: rotate(360deg); }
}


/* ==========================================================================
   UNDO TOAST - Повідомлення про видалення
   ========================================================================== */

.amg-toast-container {
    position: fixed !important;
    bottom: 20px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    z-index: 999999 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    pointer-events: none !important;
}

.amg-toast {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 12px 16px !important;
    background: #1f2937 !important;
    color: #fff !important;
    border-radius: 10px !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25) !important;
    font-size: 14px !important;
    pointer-events: auto !important;
    animation: amg-toast-in 0.3s ease !important;
    max-width: 320px !important;
}

.amg-toast.amg-toast-out {
    animation: amg-toast-out 0.25s ease forwards !important;
}

@keyframes amg-toast-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes amg-toast-out {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(20px);
    }
}

.amg-toast-icon {
    font-size: 18px !important;
    flex-shrink: 0 !important;
}

.amg-toast-message {
    flex: 1 !important;
    line-height: 1.3 !important;
}

.amg-toast-undo {
    background: transparent !important;
    border: none !important;
    color: #fbbf24 !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    padding: 4px 8px !important;
    border-radius: 4px !important;
    transition: background 0.15s !important;
    flex-shrink: 0 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

.amg-toast-undo:hover {
    background: rgba(255,255,255,0.1) !important;
}

.amg-toast-close {
    background: transparent !important;
    border: none !important;
    color: #9ca3af !important;
    font-size: 20px !important;
    cursor: pointer !important;
    padding: 0 !important;
    width: 24px !important;
    height: 24px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    line-height: 1 !important;
}

.amg-toast-close:hover {
    color: #fff !important;
}

/* Toast progress bar */
.amg-toast-progress {
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    height: 3px !important;
    background: #fbbf24 !important;
    border-radius: 0 0 10px 10px !important;
    animation: amg-toast-progress 5s linear forwards !important;
}

@keyframes amg-toast-progress {
    from { width: 100%; }
    to { width: 0%; }
}

/* Mobile toast */
@media (max-width: 480px) {
    .amg-toast-container {
        bottom: 10px !important;
        left: 10px !important;
        right: 10px !important;
        transform: none !important;
    }

    .amg-toast {
        max-width: none !important;
        padding: 10px 12px !important;
        font-size: 13px !important;
    }
}


/* ==========================================================================
   АДАПТИВ
   ========================================================================== */

/* Tablet / Large Mobile (481-768px) */
@media (max-width: 768px) {
    .widget_shopping_cart_content .amg-scrollable-wrapper {
        padding: 10px !important;
    }

    .amg-cart-header-item {
        padding: 10px 0 10px 0 !important;
        margin-top: -10px !important;
    }
}

/* Standard Mobile (<480px) */
@media (max-width: 480px) {
    /* Картка - зменшуємо фото */
    .woocommerce-mini-cart li.woocommerce-mini-cart-item.amg-cart-item {
        grid-template-columns: 56px 1fr !important;
        gap: 6px 10px !important;
    }

    .amg-cart-item:not(.amg-clerk-recommendations-item) .amg-cart-thumb,
    .amg-cart-item:not(.amg-clerk-recommendations-item) .amg-cart-thumb img {
        width: 56px !important;
        height: 56px !important;
        min-width: 56px !important;
        max-width: 56px !important;
        min-height: 56px !important;
        max-height: 56px !important;
    }

    .amg-cart-item-title {
        font-size: 13px !important;
    }

    .amg-cart-item-price {
        min-width: 65px !important;
    }

    .amg-cart-item-price .amg-current-price,
    .amg-cart-item-price .amg-regular-price,
    .amg-cart-item-price ins {
        font-size: 14px !important;
    }

    /* Progress bar compact */
    .amg-cart-header-item .xts-free-progress-bar,
    .amg-cart-header-item .xts-progress-bar {
        padding: 8px 10px !important;
    }

    .amg-cart-header-item .xts-progress-info {
        font-size: 12px !important;
    }

    /* Shipping date compact */
    .amg-cart-shipping-date {
        padding: 6px 8px !important;
        font-size: 12px !important;
    }

    /* Qty трохи більші */
    .amg-qty-btn {
        width: 34px !important;
        height: 32px !important;
    }

    .amg-qty-input {
        width: 36px !important;
        height: 32px !important;
    }

    .amg-item-delete {
        width: 32px !important;
        height: 32px !important;
    }
}

/* ============================================================================
   МОБІЛЬНИЙ LAYOUT (<400px)
   Збільшені touch targets
   ============================================================================ */
@media (max-width: 400px) {
    /* Картка - зменшуємо фото */
    .woocommerce-mini-cart li.woocommerce-mini-cart-item.amg-cart-item {
        grid-template-columns: 52px 1fr !important;
        gap: 6px 10px !important;
        padding: 12px 0 !important;
    }

    .amg-cart-item:not(.amg-clerk-recommendations-item) .amg-cart-thumb,
    .amg-cart-item:not(.amg-clerk-recommendations-item) .amg-cart-thumb img {
        width: 52px !important;
        height: 52px !important;
        min-width: 52px !important;
        max-width: 52px !important;
        min-height: 52px !important;
        max-height: 52px !important;
    }

    .amg-cart-item-title {
        font-size: 12px !important;
        -webkit-line-clamp: 2 !important;
    }

    .amg-cart-item-meta {
        font-size: 11px !important;
    }

    /* Ціна компактніша */
    .amg-cart-item-price {
        min-width: 60px !important;
    }

    .amg-cart-item-price .amg-current-price,
    .amg-cart-item-price .amg-regular-price,
    .amg-cart-item-price ins {
        font-size: 14px !important;
    }

    .amg-cart-item-price del,
    .amg-cart-item-price .amg-old-price {
        font-size: 10px !important;
    }

    .amg-cart-item-price .amg-discount-badge {
        font-size: 9px !important;
        padding: 1px 3px !important;
    }

    /* Кнопка видалення - ЗБІЛЬШЕНИЙ touch target */
    .amg-item-delete {
        width: 36px !important;
        height: 36px !important;
        font-size: 22px !important;
    }

    /* Qty controls - ЗБІЛЬШЕНІ touch targets */
    .amg-qty-btn {
        width: 36px !important;
        height: 36px !important;
        font-size: 18px !important;
        min-width: 36px !important;
    }

    .amg-qty-input {
        width: 38px !important;
        height: 36px !important;
        font-size: 14px !important;
        min-width: 38px !important;
    }

    /* Footer */
    .xts-mini-cart-footer {
        padding: 10px !important;
    }

    .amg-checkout-btn {
        height: 52px !important;
        border-radius: 12px !important;
    }

    .amg-checkout-btn-text {
        font-size: 14px !important;
    }

    .amg-checkout-btn-price {
        font-size: 14px !important;
        padding: 0 14px !important;
    }

    .amg-cart-summary-card {
        padding: 6px 10px !important;
    }
    .amg-cart-summary-card__total {
        font-size: 12px !important;
    }
    .amg-cart-summary-card__savings {
        font-size: 11px !important;
    }
    .xts-mini-cart-footer .amg-cart-summary,
    .woocommerce-mini-cart .amg-cart-summary.amg-moved {
        font-size: 12px !important;
        padding: 8px 0 !important;
    }
}

/* Extra Small Mobile (<340px) */
@media (max-width: 340px) {
    .woocommerce-mini-cart li.woocommerce-mini-cart-item.amg-cart-item {
        grid-template-columns: 44px 1fr !important;
        gap: 4px 8px !important;
    }

    .amg-cart-item:not(.amg-clerk-recommendations-item) .amg-cart-thumb,
    .amg-cart-item:not(.amg-clerk-recommendations-item) .amg-cart-thumb img {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        max-width: 44px !important;
        min-height: 44px !important;
        max-height: 44px !important;
    }

    .amg-cart-item-title {
        font-size: 11px !important;
    }

    .amg-cart-item-price {
        min-width: 50px !important;
    }

    .amg-cart-item-price .amg-current-price,
    .amg-cart-item-price .amg-regular-price,
    .amg-cart-item-price ins {
        font-size: 13px !important;
    }

    .amg-qty-btn {
        width: 32px !important;
        height: 32px !important;
        font-size: 16px !important;
        min-width: 32px !important;
    }

    .amg-qty-input {
        width: 32px !important;
        height: 32px !important;
        font-size: 13px !important;
        min-width: 32px !important;
    }

    .amg-item-delete {
        width: 32px !important;
        height: 32px !important;
        font-size: 20px !important;
    }
}

/* ==========================================================================
   Clerk.io Рекомендації - Боковий кошик
   ========================================================================== */

/* Контейнер рекомендацій */
.product_list_widget > li.amg-clerk-recommendations-item,
li.amg-clerk-recommendations-item {
    display: block !important;
    position: static !important;
    list-style: none !important;
    padding: 16px 0 8px 0 !important;
    padding-left: 0 !important;
    margin: 0 !important;
    min-height: auto !important;
    border-bottom: none !important;
    border-top: none !important;
}

/* Прибираємо border-bottom з останнього товару перед clerk recommendations */
.woocommerce-mini-cart li.woocommerce-mini-cart-item.amg-cart-item:has(+ .amg-clerk-recommendations-item),
.woocommerce-mini-cart li.woocommerce-mini-cart-item.amg-cart-item:last-of-type {
    border-bottom: none !important;
}

.amg-clerk-recommendations {
    display: block !important;
    width: 100% !important;
    min-height: 150px !important;
}

.amg-clerk-recommendations .clerk,
.amg-clerk-recommendations span[data-template] {
    display: block !important;
    width: 100% !important;
}

/* Заголовок Clerk */
.amg-clerk-recommendations .clerk-title,
.amg-clerk-recommendations h2,
.amg-clerk-recommendations h3,
.amg-clerk-recommendations .clerk-heading {
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #333 !important;
    margin: 0 0 12px 0 !important;
    padding: 0 !important;
}

/* Скидаємо .product_list_widget>li img правило XTS */
.product_list_widget > li.amg-clerk-recommendations-item img,
.amg-clerk-recommendations-item img,
.amg-clerk-recommendations img {
    position: static !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
}

/* Clerk slider/grid в кошику */
.amg-clerk-recommendations .clerk-slider,
.amg-clerk-recommendations .clerk-grid,
.amg-clerk-recommendations .clerk-products {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 10px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    padding-bottom: 8px !important;
    scrollbar-width: thin !important;
    -webkit-overflow-scrolling: touch !important;
}

.amg-clerk-recommendations .clerk-slider::-webkit-scrollbar {
    height: 4px !important;
}

.amg-clerk-recommendations .clerk-slider::-webkit-scrollbar-track {
    background: #f1f1f1 !important;
    border-radius: 2px !important;
}

.amg-clerk-recommendations .clerk-slider::-webkit-scrollbar-thumb {
    background: #ccc !important;
    border-radius: 2px !important;
}

/* Картка товару Clerk */
.amg-clerk-recommendations .clerk-product,
.amg-clerk-recommendations .clerk-item,
.amg-clerk-recommendations .clerk-slide {
    flex: 0 0 120px !important;
    width: 120px !important;
    min-width: 120px !important;
    max-width: 120px !important;
    background: #fff !important;
    border: 1px solid #f0f0f0 !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    text-decoration: none !important;
}

.amg-clerk-recommendations .clerk-product a,
.amg-clerk-recommendations .clerk-item a {
    text-decoration: none !important;
}

/* Зображення товару Clerk */
.amg-clerk-recommendations .clerk-thumbnail,
.amg-clerk-recommendations .clerk-image,
.amg-clerk-recommendations .clerk-product-image {
    width: 100% !important;
    height: 100px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 8px !important;
    box-sizing: border-box !important;
    position: relative !important;
}

.amg-clerk-recommendations .clerk-thumbnail:before,
.amg-clerk-recommendations-item .clerk-thumbnail:before {
    padding-top: 0 !important;
    display: none !important;
}

.amg-clerk-recommendations .clerk-thumbnail img,
.amg-clerk-recommendations .clerk-image img,
.amg-clerk-recommendations .clerk-product-image img {
    max-width: 100% !important;
    max-height: 84px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
}

/* Ховаємо другу картинку Clerk (flip-image для hover ефекту) */
.amg-clerk-recommendations .clerk-flip-image,
.amg-clerk-recommendations-item .clerk-flip-image {
    display: none !important;
}

/* Інфо товару Clerk */
.amg-clerk-recommendations .clerk-product-info,
.amg-clerk-recommendations .clerk-info,
.amg-clerk-recommendations .clerk-content {
    padding: 8px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
}

/* Назва товару Clerk */
.amg-clerk-recommendations .clerk-product-name,
.amg-clerk-recommendations .clerk-title,
.amg-clerk-recommendations .clerk-name {
    font-size: 11px !important;
    font-weight: 400 !important;
    color: #333 !important;
    line-height: 1.3 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    text-decoration: none !important;
}

/* Ціна товару Clerk */
.amg-clerk-recommendations .clerk-price,
.amg-clerk-recommendations .clerk-product-price {
    font-size: 13px !important;
    font-weight: 700 !important;
    color: #333 !important;
}

.amg-clerk-recommendations .clerk-price del,
.amg-clerk-recommendations .clerk-price .clerk-old-price {
    font-size: 11px !important;
    font-weight: 400 !important;
    color: #999 !important;
    text-decoration: line-through !important;
}

/* Бейдж знижки Clerk */
.amg-clerk-recommendations .clerk-badge,
.amg-clerk-recommendations .clerk-discount {
    position: absolute !important;
    top: 4px !important;
    left: 4px !important;
    background: #f84147 !important;
    color: #fff !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    padding: 2px 5px !important;
    border-radius: 4px !important;
}

/* Кнопка додати Clerk */
.amg-clerk-recommendations .clerk-add-to-cart,
.amg-clerk-recommendations .clerk-button {
    display: none !important;
}

/* Wishlist іконка Clerk */
.amg-clerk-recommendations .clerk-wishlist,
.amg-clerk-recommendations .clerk-favorite {
    position: absolute !important;
    top: 4px !important;
    right: 4px !important;
    width: 24px !important;
    height: 24px !important;
    background: rgba(255,255,255,0.9) !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    border: none !important;
}

/* Рекомендації для порожнього кошика */
.amg-clerk-empty {
    margin-top: 20px !important;
}

/* Loading стан */
.amg-clerk-recommendations:not(.clerk-loaded) .clerk:empty::after {
    content: "Завантаження рекомендацій..." !important;
    display: block !important;
    text-align: center !important;
    color: #999 !important;
    font-size: 12px !important;
    padding: 20px 0 !important;
}

/* Коли завантажено - приховуємо loading */
.amg-clerk-recommendations .clerk.clerk-loaded:empty::after {
    display: none !important;
}

/* ==========================================================================
   SUBSCRIPTION SCHEDULE CARDS (mini-cart)
   ========================================================================== */
.amg-sub-dropdown--mini {
    position: relative;
    margin: 6px 0 2px;
}
.amg-sub-dropdown--mini .amg-sub-toggle {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 20px 3px 8px;
    font-size: 11px;
    line-height: 1.3;
    color: #64748b;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%2394a3b8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E") no-repeat right 5px center;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color .15s, background .15s;
}
.amg-sub-dropdown--mini .amg-sub-toggle:hover {
    border-color: #ffba00;
    background-color: #fffbf0;
}
.amg-sub-dropdown--mini.is-open .amg-sub-toggle {
    border-color: #ffba00;
    background-color: #fff;
}
.amg-sub-dropdown--mini .amg-sub-menu {
    display: none;
    position: absolute;
    left: 0;
    top: calc(100% + 4px);
    z-index: 100;
    min-width: 220px;
    padding: 5px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
    flex-direction: column;
    gap: 3px;
}
.amg-sub-dropdown--mini.is-open .amg-sub-menu {
    display: flex;
}
.amg-sub-dropdown--mini .amg-sub-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 9px;
    border: 1.5px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    background: #fff;
}
.amg-sub-dropdown--mini .amg-sub-card:hover {
    border-color: #fbbf24;
    background: #fffbeb;
}
.amg-sub-dropdown--mini .amg-sub-card.is-active {
    border-color: #ffba00;
    background: #fffbf0;
}
.amg-sub-dropdown--mini .amg-sub-card input[type="radio"] {
    display: none;
}
.amg-sub-dropdown--mini .amg-sub-card__label {
    font-size: 11px;
    font-weight: 400;
    color: #374151;
}
.amg-sub-dropdown--mini .amg-sub-card.is-active .amg-sub-card__label {
    font-weight: 600;
    color: #190a03;
}
.amg-sub-dropdown--mini .amg-sub-card__right {
    display: flex;
    align-items: center;
    gap: 4px;
}
.amg-sub-dropdown--mini .amg-sub-card__badge {
    font-size: 9px;
    font-weight: 600;
    color: #16a34a;
    background: #dcfce7;
    padding: 1px 4px;
    border-radius: 3px;
    line-height: 1.3;
}
.amg-sub-dropdown--mini .amg-sub-card__price {
    font-size: 11px;
    font-weight: 500;
    color: #190a03;
}
