/**
 * Styles optimisés pour les champs quantité d'archive WooCommerce
 * Utilise les variables CSS du thème Akibat et évite les doublons
 */

/* ============================================================================
   CONTENEUR PRINCIPAL - UTILISE LES VARIABLES AKIBAT
   ============================================================================ */
.archive-product-cart {
    margin: var(--akibat-margin-std) 0;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}

/* ============================================================================
   LIGNE PRINCIPALE
   ============================================================================ */
.cart-controls-line {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    width: 100%;
}

/* ============================================================================
   SECTION QUANTITÉ
   ============================================================================ */
.quantity-section {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 1em;
}

/* Label masqué pour les lecteurs d'écran */
.qty-label-inline {
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
    white-space: nowrap;
    border: 0;
    margin: -1px;
    padding: 0;
}

/* ============================================================================
   CONTRÔLES QUANTITÉ - RÉUTILISE LES STYLES EXISTANTS
   ============================================================================ */
.quantity-controls {
    position: relative;
    display: flex;
    align-items: center;
}

/* ============================================================================
   CHAMP INPUT - HÉRITE DU STYLE WOOCOMMERCE EXISTANT
   ============================================================================ */
.qty-input {
    width: 50px;
    height: 36px;
    padding: 0 5px;
    border: 1px solid var(--akibat-maron-fonce);
    border-radius: var(--akibat-border-radius) 0 0 var(--akibat-border-radius);
    text-align: center;
    font-size: 14px;
    color: var(--akibat-maron-fonce);
    background-color: var(--akibat-text-cream);
    outline: none;
    margin: 0;
    flex-shrink: 0;
    transition: border-color var(--akibat-transition-std), box-shadow var(--akibat-transition-std);
    -moz-appearance: textfield;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.qty-input:focus {
    outline: none;
    border-color: var(--akibat-maron-clair);
    box-shadow: 0 0 0 2px rgba(160, 56, 0, 0.2);
}

/* ============================================================================
   CONTENEUR DES BOUTONS - STYLE COHÉRENT
   ============================================================================ */
.qty-buttons {
    display: flex;
    flex-direction: column;
    width: 20px;
    height: 36px;
    border-left: none;
    border-radius: 0 var(--akibat-border-radius) var(--akibat-border-radius) 0;
    background: var(--akibat-light-bg);
}
.qty-buttons button {
	  background: #a03800 !important;
	  color: #fff !important;
	  min-height: 50% !important;
}

/* ============================================================================
   BOUTONS +/- - UTILISE LES COULEURS AKIBAT
   ============================================================================ */
.qty-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--akibat-light-bg);
    border: none;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    color: #666;
    user-select: none;
    transition: all var(--akibat-transition-fast);
    line-height: 1;
    margin: 0;
    padding: 0;
    min-height: 18px;
}

.qty-btn:hover {
    background: var(--akibat-border-color);
    color: var(--akibat-text-dark);
}

.qty-btn:active {
    background: var(--akibat-border-light);
    transform: none;
}

.qty-btn.qty-plus {
    border-bottom: 1px solid var(--akibat-border-light);
    border-radius: 0 var(--akibat-border-radius) 0 0;
}

.qty-btn.qty-minus {
    border-radius: 0 0 var(--akibat-border-radius) 0;
}

.qty-btn:focus {
    outline: none;
    background: var(--akibat-border-color);
}

/* ============================================================================
   BOUTON AJOUT AU PANIER - HÉRITE DU STYLE EXISTANT
   ============================================================================ */
.archive_add_to_cart_button {
    border: none;
    padding: 10px 15px;
    text-align: center;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border-radius: var(--akibat-border-radius);
    cursor: pointer;
    transition: all var(--akibat-transition-std);
    text-transform: uppercase;
    font-weight: 600;
    min-height: 36px;
    flex: 1;
    max-width: 180px;
    line-height: 1.2;
    word-wrap: break-word;
    hyphens: auto;
    outline: none;
    box-sizing: border-box;
    margin: 0;
    white-space: nowrap;

    /* Couleurs cohérentes avec le thème */
    background: var(--akibat-light-bg);
    color: var(--akibat-text-dark);
    border: 1px solid var(--akibat-border-light);
}

.archive_add_to_cart_button:hover {
    transform: translateY(-1px);
    text-decoration: none;
    background: var(--akibat-border-color);
    border-color: var(--akibat-border-light);
}

.archive_add_to_cart_button:active {
    transform: translateY(0);
    background: var(--akibat-border-light);
}

.archive_add_to_cart_button:focus {
    outline: 2px solid var(--akibat-maron-clair);
    outline-offset: 2px;
}

/* ============================================================================
   ÉTATS DU BOUTON - RÉUTILISE LES ANIMATIONS EXISTANTES
   ============================================================================ */
.archive_add_to_cart_button.loading {
    opacity: 0.7;
    cursor: not-allowed;
    position: relative;
}

.archive_add_to_cart_button.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    transform: translate(-50%, -50%);
}

.archive_add_to_cart_button.added {
    animation: added-success 0.6s ease;
}

/* Animations déjà définies dans le CSS principal - pas de doublon */

/* ============================================================================
   RESPONSIVE - COHÉRENT AVEC LE THÈME EXISTANT
   ============================================================================ */
@media (max-width: 768px) {
    .cart-controls-line {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }

    .archive_add_to_cart_button {
        max-width: none;
        width: 100%;
    }
}

/* Réutilise les breakpoints et styles mobile existants */
@media (max-width: 1310px) {
    .archive_add_to_cart_button {
        font-size: 0 !important;
        padding: 0 !important;
        width: 36px;
        min-width: 36px;
        height: 36px;
        position: relative;
        max-width: 36px;
    }

    .archive_add_to_cart_button::before {
		font-family: "Font Awesome 6 Free", "Font Awesome 6 Pro";
		font-size: clamp(1.4rem, 1vw + 0.8rem, 1.8rem) !important;
		font-weight: 900;
		line-height: 1;
		content: "\f217";
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }

    .cart-controls-line {
        flex-direction: row;
        justify-content: center;
        gap: 5px;
    }

    .quantity-section {
        flex: 0 0 auto;
		margin:0px;
    }

    .archive_add_to_cart_button.loading::after {
        width: 14px;
        height: 14px;
    }
}

@media (max-width: 480px) {
    .qty-buttons {
        width: 18px !important;
        height: 32px !important;
    }

    .qty-input {
        width: 45px !important;
        height: 32px !important;
        font-size: 13px;
    }

    .qty-btn {
        font-size: 11px;
    }
}

/* ============================================================================
   ACCESSIBILITÉ - COHÉRENT AVEC LE THÈME
   ============================================================================ */
.archive_add_to_cart_button:focus,
.qty-input:focus {
    outline: 2px solid var(--akibat-maron-clair);
    outline-offset: 2px;
}

/* ============================================================================
   MODE SOMBRE - UTILISE LES VARIABLES EXISTANTES
   ============================================================================ */
/*
@media (prefers-color-scheme: dark) {
    .qty-input {
        background-color: #34495e;
        border-color: #4a5568;
        color: #ecf0f1;
    }

    .qty-buttons {
        background: #34495e;
        border-color: #4a5568;
    }

    .qty-btn {
        background: #2c3e50;
        color: #bdc3c7;
        border-color: #4a5568;
    }

    .qty-btn:hover {
        background: #34495e;
        color: #ecf0f1;
    }

    .archive_add_to_cart_button {
        background: #34495e;
        color: #ecf0f1;
        border-color: #4a5568;
    }

    .archive_add_to_cart_button:hover {
        background: #2c3e50;
    }
}
*/

/* ============================================================================
   OPTIMISATIONS - ÉVITE LES CONFLITS
   ============================================================================ */
.archive-product-cart * {
    box-sizing: border-box;
}

/* Spécificité élevée pour éviter les conflits avec le thème */
.archive-product-cart .qty-btn,
.archive-product-cart .archive_add_to_cart_button {
    text-decoration: none !important;
    text-shadow: none !important;
    font-family: inherit !important;
}