/**
 * Quick Add to Cart - Styles
 * Black & Gold Aesthetic by Strassdentaires
 *
 * @author    Tilou - Strassdentaires.com
 * @copyright 2025 Strassdentaires
 */

/* Force vertical layout in form - Compatible tous navigateurs */
form.cart-form-url {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 0.5rem;
}

/* Main container - Compact version */
.quick-add-quantity-selector {
    display: block !important;
    width: 100%;
    text-align: center;
    margin: 0.5rem 0 !important;
    order: -1; /* Place le sélecteur avant le bouton */
}

/* Quantity Controls - Compact */
.qty-controls-compact {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #000;
    border: 1px solid #d4af37;
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
    margin: 0 auto;
}

.qty-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #d4af37 0%, #f2d06b 100%);
    border: none;
    border-radius: 4px;
    color: #000;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 700;
    padding: 0;
}

.qty-btn:hover {
    background: linear-gradient(135deg, #f2d06b 0%, #d4af37 100%);
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.4);
    transform: scale(1.1);
}

.qty-btn:active {
    transform: scale(0.9);
}

.qty-btn .material-icons {
    font-size: 16px;
}

.qty-btn svg {
    width: 16px;
    height: 16px;
    display: block;
    pointer-events: none; /* Important: évite les problèmes de clic sur le SVG */
}

.qty-input-compact {
    width: 50px;
    height: 28px;
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    color: #d4af37;
    background: #000;
    border: 1px solid #d4af37;
    border-radius: 4px;
    padding: 0.25rem;
    transition: all 0.3s ease;
}

.qty-input-compact:focus {
    outline: none;
    border-color: #f2d06b;
    box-shadow: 0 0 6px rgba(212, 175, 55, 0.3);
}

/* Remove spinner arrows for number input */
.qty-input-compact::-webkit-inner-spin-button,
.qty-input-compact::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.qty-input-compact[type=number] {
    -moz-appearance: textfield;
}

/* Visual feedback when quantity changes */
.qty-input-compact.qty-changed {
    background: linear-gradient(135deg, #d4af37 0%, #f2d06b 100%);
    color: #000;
    transform: scale(1.05);
}

@keyframes qtyPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Stock info - Compact */
.stock-info-compact {
    font-size: 11px;
    color: #d4af37;
    font-weight: 600;
    text-align: center;
    padding: 0.25rem 0.5rem;
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 4px;
    margin-top: 0.25rem;
}

/* Ensure button takes full width and is below selector */
form.cart-form-url button[data-button-action="add-to-cart"] {
    display: block !important;
    width: 100% !important;
    order: 1;
}

form.cart-form-url .wishlist-button-add {
    order: 2;
}

/* Hide hidden inputs visually */
form.cart-form-url input[type="hidden"] {
    display: none;
}

/* Loading state for existing button */
.add-to-cart.loading,
.ajax_add_to_cart_button.loading,
[data-button-action="add-to-cart"].loading {
    opacity: 0.7;
    cursor: not-allowed;
    position: relative;
}

/* Responsive Design */
@media (max-width: 768px) {
    .qty-controls-compact {
        gap: 0.375rem;
        padding: 0.2rem 0.4rem;
    }

    .qty-btn {
        width: 24px;
        height: 24px;
    }

    .qty-btn .material-icons {
        font-size: 14px;
    }

    .qty-btn svg {
        width: 14px;
        height: 14px;
    }

    .qty-input-compact {
        width: 45px;
        height: 24px;
        font-size: 13px;
    }

    .stock-info-compact {
        font-size: 10px;
    }
}

/* Animation for button press */
@keyframes buttonPress {
    0% { transform: scale(1); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

.qty-btn:active {
    animation: buttonPress 0.2s ease;
}

/* Hover effect */
.qty-controls-compact:hover {
    border-color: #f2d06b;
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.15);
}

