/**
 * Sticky Add-to-Cart Bar
 * Appears when user scrolls past product details
 */

.sticky-cart-bar {
    position: fixed;
    bottom: -100px;
    left: 0;
    right: 0;
    background: #ffffff;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 999;
    transition: bottom 0.3s ease-in-out;
    border-top: 1px solid #e0e0e0;
}

.sticky-cart-bar.show {
    bottom: 0;
}

.sticky-cart-bar-content {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    max-width: 1200px;
    margin: 0 auto;
    gap: 20px;
}

/* Product Info */
.sticky-product-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
    min-width: 0;
}

.sticky-product-image {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid #e0e0e0;
}

.sticky-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sticky-product-details {
    flex: 1;
    min-width: 0;
}

.sticky-product-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin: 0 0 5px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sticky-product-price {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.sticky-price-current {
    font-size: 18px;
    font-weight: 700;
    color: #12cca7;
}

.sticky-price-old {
    font-size: 14px;
    color: #999;
    text-decoration: line-through;
}

.sticky-discount-badge {
    display: inline-block;
    background: #ff4444;
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
}

/* Quantity Controls */
.sticky-quantity-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.sticky-quantity-label {
    font-size: 13px;
    color: #666;
    display: none;
}

.sticky-qty-wrapper {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.sticky-qty-btn {
    width: 32px;
    height: 32px;
    background: #f8f8f8;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #333;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sticky-qty-btn:hover {
    background: #e0e0e0;
    color: #12cca7;
}

.sticky-qty-btn:active {
    transform: scale(0.95);
}

.sticky-qty-input {
    width: 45px;
    height: 32px;
    border: none;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.sticky-qty-input:focus {
    outline: none;
    background: #f9f9f9;
}

/* Add to Cart Button */
.sticky-add-to-cart-btn {
    background: #12cca7;
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    flex-shrink: 0;
}

.sticky-add-to-cart-btn:hover {
    background: #0fa889;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(18, 204, 167, 0.3);
}

.sticky-add-to-cart-btn:active {
    transform: translateY(0);
}

.sticky-add-to-cart-btn i {
    font-size: 16px;
}

.sticky-add-to-cart-btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.sticky-add-to-cart-btn.loading::after {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-left: 8px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Out of Stock State */
.sticky-add-to-cart-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.sticky-add-to-cart-btn:disabled:hover {
    background: #ccc;
    transform: none;
    box-shadow: none;
}

/* Wishlist Button */
.sticky-wishlist-btn {
    width: 44px;
    height: 44px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    flex-shrink: 0;
}

.sticky-wishlist-btn:hover {
    border-color: #ff6b6b;
    color: #ff6b6b;
    background: #fff5f5;
}

.sticky-wishlist-btn.active {
    background: #ff6b6b;
    border-color: #ff6b6b;
    color: white;
}

.sticky-wishlist-btn i {
    font-size: 18px;
}

/* Stock Badge */
.sticky-stock-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
    margin-left: auto;
}

.sticky-stock-badge.in-stock {
    background: #e8f5e9;
    color: #2e7d32;
}

.sticky-stock-badge.low-stock {
    background: #fff3e0;
    color: #f57c00;
}

.sticky-stock-badge.out-of-stock {
    background: #ffebee;
    color: #c62828;
}

.sticky-stock-badge i {
    font-size: 10px;
}

/* Desktop: 992px and up */
@media (min-width: 992px) {
    .sticky-cart-bar-content {
        padding: 15px 30px;
    }
    
    .sticky-quantity-label {
        display: block;
    }
    
    .sticky-product-name {
        font-size: 15px;
    }
}

/* Tablet: 768px to 991px */
@media (max-width: 991px) {
    .sticky-cart-bar-content {
        gap: 15px;
    }
    
    .sticky-product-details {
        max-width: 200px;
    }
    
    .sticky-add-to-cart-btn {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .sticky-wishlist-btn {
        width: 40px;
        height: 40px;
    }
}

/* Mobile: below 768px */
@media (max-width: 767px) {
    .sticky-cart-bar-content {
        padding: 10px 15px;
        gap: 10px;
    }
    
    .sticky-product-image {
        width: 50px;
        height: 50px;
    }
    
    .sticky-product-name {
        font-size: 13px;
    }
    
    .sticky-product-price {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .sticky-price-current {
        font-size: 16px;
    }
    
    .sticky-price-old {
        font-size: 12px;
    }
    
    .sticky-discount-badge {
        font-size: 10px;
        padding: 1px 5px;
    }
    
    .sticky-qty-wrapper {
        display: flex;
    }
    
    .sticky-qty-btn {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
    
    .sticky-qty-input {
        width: 40px;
        height: 28px;
        font-size: 13px;
    }
    
    .sticky-add-to-cart-btn {
        padding: 8px 16px;
        font-size: 13px;
        gap: 6px;
    }
    
    .sticky-add-to-cart-btn span {
        display: none;
    }
    
    .sticky-add-to-cart-btn i {
        font-size: 18px;
    }
    
    .sticky-wishlist-btn {
        width: 36px;
        height: 36px;
    }
    
    .sticky-wishlist-btn i {
        font-size: 16px;
    }
    
    .sticky-stock-badge {
        display: none;
    }
}

/* Extra Small Mobile: below 576px */
@media (max-width: 575px) {
    .sticky-cart-bar-content {
        padding: 8px 10px;
        gap: 8px;
    }
    
    .sticky-product-details {
        max-width: 120px;
    }
    
    .sticky-quantity-controls {
        gap: 6px;
    }
    
    /* Simplify on very small screens */
    .sticky-discount-badge {
        display: none;
    }
}

/* Animation for showing/hiding */
@media (prefers-reduced-motion: reduce) {
    .sticky-cart-bar {
        transition: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .sticky-cart-bar {
        border-top: 2px solid #000;
    }
    
    .sticky-add-to-cart-btn {
        border: 2px solid transparent;
    }
}
