/**
 * GetPaid Cart Styles
 *
 * Minimal custom styles - most styling handled via Bootstrap/AUI classes.
 *
 * @package WPInv_Cart
 * @version 1.0.0
 */

/* Mini Cart Dropdown Toggle */
.wpinv-mini-cart {
    position: relative;
}

.wpinv-mini-cart-dropdown {
    display: none;
}

.wpinv-mini-cart:hover .wpinv-mini-cart-dropdown,
.wpinv-mini-cart:focus-within .wpinv-mini-cart-dropdown,
.wpinv-mini-cart-dropdown.open {
    display: block;
}

/* Cart Loading State */
.wpinv-cart-loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Add to Cart Button Loading */
.wpinv-add-to-cart.loading .wpinv-add-to-cart-text {
    display: none;
}

.wpinv-add-to-cart.loading .wpinv-add-to-cart-loading {
    display: inline-block !important;
}

/* Hide GetPaid's default cart during cart checkout flow */
.wpinv-cart-hide-form-items,
.wpinv-cart-hide-form-items * {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Cart Icon */
.wpinv-cart-icon-link {
    color: inherit;
    text-decoration: none !important;
}

.wpinv-cart-icon-link:hover,
.wpinv-cart-icon-link:focus {
    opacity: 0.8;
    outline: none;
    border: none;
    text-decoration: none !important;
}

/* Navigation Cart Icon Block */
.wpinv-cart-icon-nav {
    display: flex;
    align-items: center;
}

.wpinv-cart-icon-nav .wpinv-cart-icon-link {
    display: flex;
    align-items: center;
    position: relative;
    padding: 4px;
    color: inherit;
    text-decoration: none;
}

/* Cart Count Badge - Base Styles */
.wpinv-cart-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: #fff;
    border-radius: 9px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.wpinv-cart-count:empty,
.wpinv-cart-count[style*="display:none"],
.wpinv-cart-count[style*="display: none"] {
    display: none !important;
}

/* Cart Count Badge - Hover Effect */
.wpinv-cart-icon-link:hover .wpinv-cart-count {
    transform: scale(1.1);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
}

/* Cart Count Badge - Animation for updates */
@keyframes wpinv-cart-count-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.wpinv-cart-count.wpinv-cart-count-updated {
    animation: wpinv-cart-count-pulse 0.3s ease-in-out;
}

/* Cart Count Badge - Navigation Block Specific */
.wpinv-cart-icon-nav .wpinv-cart-count-nav {
    position: absolute;
    top: -4px;
    right: -8px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 10px;
    border-radius: 8px;
    line-height: 16px;
}

.wp-block-navigation .wpinv-cart-icon-nav {
    padding: 0;
}

.wp-block-navigation .wpinv-cart-icon-link {
    padding: var(--wp--style--block-gap, 0.5em);
}

/* Cart Notices Container */
.wpinv-cart-notices:empty {
    display: none;
    margin: 0 !important;
}

.wpinv-cart-notices .alert {
    margin-bottom: 0;
}

/* Responsive Table - Mobile */
@media (max-width: 768px) {
    .wpinv-cart-page .table-responsive thead {
        display: none;
    }

    .wpinv-cart-page .table-responsive tbody td {
        display: block;
        text-align: right;
        padding: 10px;
        border-bottom: none;
    }

    .wpinv-cart-page .table-responsive tbody td::before {
        content: attr(data-label);
        float: left;
        font-weight: 600;
    }

    .wpinv-cart-page .table-responsive tbody tr {
        border-bottom: 1px solid #dee2e6;
        margin-bottom: 1rem;
        display: block;
    }

    .wpinv-cart-page .table-responsive tbody td.wpinv-cart-item-thumbnail {
        text-align: center;
    }

    .wpinv-cart-page .table-responsive tbody td.wpinv-cart-item-thumbnail::before {
        display: none;
    }
}

/* Skeleton Loading */
@keyframes wpinv-skeleton-pulse {
    0% { opacity: 0.15; }
    50% { opacity: 0.3; }
    100% { opacity: 0.15; }
}

.wpinv-skeleton {
    background: currentColor;
    animation: wpinv-skeleton-pulse 1.5s ease-in-out infinite;
}

/* Quantity Stepper */
.bsui .wpinv-qty-stepper .wpinv-cart-quantity {
    -moz-appearance: textfield;
    min-width: 30px !important;
    padding-left: 2px !important;
    padding-right: 2px !important;
}

.bsui .wpinv-qty-stepper .wpinv-cart-quantity::-webkit-outer-spin-button,
.bsui .wpinv-qty-stepper .wpinv-cart-quantity::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
