/* Hide WooCommerce "View cart" link */
a.added_to_cart,
.wc-forward {
    display: none !important;
}

body.drawer-open {
    overflow: hidden !important;
    touch-action: none;
    -webkit-overflow-scrolling: none;
    overflow-scrolling: none;
}

/* Add-to-cart button loading spinner */
.cp-btn-atc.loading,
.ajax_add_to_cart.loading,
.add_to_cart_button.loading {
    pointer-events: none;
    opacity: 0.85;
}

.btn-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: btn-spin 0.6s linear infinite;
    vertical-align: middle;
}

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

/* Fly animation badge */
.fly-badge-only {
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.2));
}
.fly-badge-only svg {
    width: 100%;
    height: 100%;
}

/* --- Cart Drawer Premium Styles --- */
.cart-drawer-modern {
    background: #fff;
    border-top-left-radius: 24px;
    border-bottom-left-radius: 24px;
    overflow: hidden;
}

.cart-drawer-modern .drawer-header {
    border-bottom: 1px solid #f3f4f6;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-direction: row-reverse; /* Put title on right, close on left */
}

.cart-drawer-modern .drawer-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--secondary);
    text-align: right;
    flex-grow: 1;
}

.cart-drawer-modern .drawer-item-count {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-inline-end: 2px;
}

.cart-drawer-modern .drawer-content {
    padding: 0;
    overflow-x: hidden;
}

.cart-empty-state {
    padding: 60px 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.cart-empty-state h3 {
    margin-top: 15px;
    font-size: 1.25rem;
    color: var(--secondary);
}

.cart-empty-state p {
    color: var(--text-muted);
    margin-bottom: 10px;
}

/* Free Shipping Progress */
.cart-progress-wrapper {
    padding: 20px 25px;
    background: #f9fafb;
    border-bottom: 1px solid #f3f4f6;
}

.progress-text {
    font-size: 0.88rem;
    margin-bottom: 10px;
    text-align: center;
}

.progress-text strong {
    color: var(--primary);
}

.progress-text.success {
    color: #059669;
    font-weight: 700;
}


.cart-drawer-items {
    padding: 0;
}

.cart-drawer-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 15px 20px;
    border-bottom: 1px solid #f9fafb;
    transition: background 0.2s ease;
    position: relative;
}

.cart-drawer-item:hover {
    background: #fcfcfc;
}

.cart-drawer-item .item-image {
    width: 65px;
    height: 65px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #f3f4f6;
}

.cart-drawer-item .item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-drawer-item .item-details {
    flex: 1;
    min-width: 0; /* Crucial for long title truncation */
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cart-drawer-item .item-title {
    font-size: 0.78rem;
    font-weight: 700;
    margin-bottom: 2px;
    line-height: 1.3;
    color: var(--secondary);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-drawer-item .item-title a:hover {
    color: var(--primary);
}

.cart-drawer-item .item-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.cart-drawer-item .item-price-qty {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 5px;
}

.cart-drawer-item .item-subtotal {
    font-weight: 800;
    color: var(--primary);
    font-size: 0.95rem;
}

.cart-drawer-item .remove-cart-item-ajax {
    /* Integrated Flex Item - Far Right Position */
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent !important;
    border: none !important;
    color: #9ca3af !important;
    cursor: pointer;
    transition: none !important;
    padding: 0;
    margin-inline-start: auto; /* Push to far right */
    margin-top: -2px;
}

.cart-drawer-item .remove-cart-item-ajax:hover {
    background: transparent !important;
    color: #9ca3af !important;
    transform: none !important;
}

.cart-drawer-item .remove-cart-item-ajax svg {
    width: 17px;
    height: 17px;
}

/* Qty Selector inside drawer */
.item-qty-modern {
    display: flex;
    align-items: center;
    border: 1px solid #f1f1f1;
    border-radius: 8px;
    padding: 2px;
}

.item-qty-modern .qty-btn {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    color: var(--secondary);
    transition: color 0.2s ease;
}

.item-qty-modern .qty-btn:hover {
    color: var(--primary);
}

.item-qty-modern .qty-input {
    width: 25px;
    text-align: center;
    background: transparent;
    border: none;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--secondary);
}

/* Footer Actions */
.cart-drawer-modern .drawer-footer {
    padding: 25px;
    border-top: 1px solid #f3f4f6;
    background: #fff;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.02);
}

.cart-drawer-totals {
    margin-bottom: 20px;
}

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.total-row .label {
    font-weight: 700;
    color: var(--secondary);
    font-size: 1.1rem;
}

.total-row .value {
    font-weight: 900;
    color: var(--primary);
    font-size: 1.25rem;
}

.cart-drawer-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checkout-btn {
    display: block !important;
    width: 100% !important;
    min-height: 54px !important;
    border-radius: 12px !important;
    padding: 0 !important;
    border: none !important;
    background: var(--primary) !important;
    box-shadow: none !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.checkout-btn-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    height: 100%;
    color: #fff;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 0 20px;
}

.checkout-btn:hover {
    background: var(--primary-dark) !important;
}

.checkout-btn:active {
    opacity: 0.8;
}

.btn-teal {
    background: var(--primary) !important;
    color: #fff !important;
    border: none !important;
    transition: all 0.3s ease !important;
    cursor: pointer;
}

.btn-teal:hover {
    background: var(--primary-dark) !important;
    opacity: 0.9;
}

.btn-full {
    width: 100% !important;
    display: flex !important;
}

.view-cart-link {
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: underline;
}

.view-cart-link:hover {
    color: var(--secondary);
}


/* Button Refinement */
.btn-small {
    padding: 8px 20px !important;
    min-width: 140px !important;
    font-size: 0.88rem !important;
    border-radius: 8px !important;
}

.cart-empty-state .btn-small {
    padding: 5px 12px !important;
    min-width: auto !important;
    width: fit-content !important;
    font-size: 0.75rem !important;
    display: inline-flex !important;
    margin: 0 auto;
}

/* Drawer Layout Fix for AJAX content */
#cart-drawer-content-inner {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    overflow: hidden; /* To handle internal scroll */
}

.cart-drawer-modern .drawer-content {
    flex-grow: 1;
    overflow-y: auto;
    padding-bottom: 20px;
}
