/**
 * Aratice Products Card Styles - Design moderne
 */

/* === Card Produit === */
.apg-product-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.apg-product-card:hover {
    transition: all 0.3s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
    transform: translateY(-4px);
}

/* === Mode Liste === */
.apg-products-grid[data-view="list"] .apg-product-card {
    flex-direction: row;
    align-items: stretch;
    min-height: 200px;
    padding: 24px 16px;
    width: 100%;
    max-width: 100%;
}

/* === Badges en haut === */
.apg-badges-top {
    position: absolute;
    top: 16px;
    left: 16px;
    right: 16px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    z-index: 10;
    gap: 8px;
}

.apg-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    text-transform: capitalize;
}

.apg-badge-condition {
    background: #7AC143;
    color: #fff;
}

.apg-badge-discount {
    background: #E4F4DC;
    color: #427d0c;
    margin-right: auto;
}

/* Mode liste - badges repositionnés */
.apg-products-grid[data-view="list"] .apg-badges-top {
    position: absolute;
    top: 16px;
    left: 16px;
    right: 16px;
}

/* === Image === */
.apg-product-image {
    position: relative;
    width: 100%;
    padding-top: 65%;
    overflow: hidden;
    background: #fff;
}

/* Étiquette État du produit (Neuf, Reconditionné, Occasion) */
.apg-badge-state {
    position: absolute;
    top: 12px;
    left: 12px;
    color: #fff;
    padding: 6px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1.1px;
    z-index: 15;
}

/* État: Seconde main */
.apg-badge-state-seconde-main {
    background-color: #DDEAFF;
    color: #236197;
}

/* Icônes SVG dans les badges */
.apg-badge-state svg {
    width: 14px;
    height: 14px;
    stroke-width: 2.5;
}

/* Mode liste - Étiquette État repositionnée */
.apg-products-grid[data-view="list"] .apg-badge-state {
    top: 8px;
    left: 8px;
    padding: 6px 12px;
    font-size: 11px;
}

.apg-products-grid[data-view="list"] .apg-badge-state svg {
    width: 12px;
    height: 12px;
}

.apg-product-image a {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.apg-product-image img,
.apg-product-image .apg-product-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity 0.4s ease, transform 0.3s ease;
    padding: 0px !important;
    opacity: 0;
    pointer-events: none;
}

.apg-product-image .apg-product-img.active {
    opacity: 1;
    pointer-events: auto;
}

.apg-product-card:hover .apg-product-image .apg-product-img.active {
    transform: scale(1.02);
}

/* Mode liste - Image */
.apg-products-grid[data-view="list"] .apg-product-image {
    width: 180px;
    min-width: 180px;
    padding-top: 0;
    height: 180px;
    flex-shrink: 0;
    background: #fff;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    margin-right: 8px;
}

.apg-products-grid[data-view="list"] .apg-product-image a {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.apg-products-grid[data-view="list"] .apg-product-image img,
.apg-products-grid[data-view="list"] .apg-product-image .apg-product-img {
    position: absolute !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 0 !important;
    opacity: 0;
    transition: opacity 0.4s ease, transform 0.3s ease;
    pointer-events: none;
}

.apg-products-grid[data-view="list"] .apg-product-image .apg-product-img.active {
    opacity: 1;
    pointer-events: auto;
}

.apg-products-grid[data-view="list"] .apg-product-card:hover .apg-product-image .apg-product-img.active {
    transform: scale(1.02);
}

/* === Contenu === */
.apg-product-content {
    padding: 20px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.apg-products-grid[data-view="list"] .apg-product-content {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 0;
    gap: 25px;
    flex: 1;
}

/* Mode grille - masquer les wrappers (pas utilisés en mode grille) */
.apg-products-grid[data-view="grid"] .apg-product-info,
.apg-products-grid[data-view="grid"] .apg-product-sidebar {
    display: contents;
}

/* Mode liste - zone info (gauche) */
.apg-product-info {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.apg-products-grid[data-view="list"] .apg-product-info {
    flex-basis: 300px;
    flex-grow: 9999;
}

/* Mode liste - zone sidebar (droite) */
.apg-product-sidebar {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.apg-products-grid[data-view="list"] .apg-product-sidebar {
    flex-basis: 240px;
    flex-grow: 1;
}

/* Mode liste - prix et actions */
.apg-products-grid[data-view="list"] .apg-product-price {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-end;
    margin-bottom: 16px;
}

.apg-products-grid[data-view="list"] .apg-product-actions {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-end;
    margin-top: 12px;
}

.apg-products-grid[data-view="list"] .apg-add-to-quote {
    width: 100%;
    padding: 14px 24px;
}

.apg-products-grid[data-view="list"] .apg-view-options {
    width: 100%;
    padding: 14px 24px;
}

/* === Titre === */
.apg-product-title {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
    margin: 0 0 0px 0;
    color: #2C3E50;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
}

.apg-product-title a {
    color: #2C3E50;
    text-decoration: none;
    transition: color 0.2s ease;
}

.apg-product-title a:hover {
    color: #3B5998;
}

.apg-product-title a:active,
.apg-product-title a:focus {
    text-decoration: none;
    outline: none;
}

.apg-products-grid[data-view="list"] .apg-product-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 6px 0;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}

/* === Catégorie === */
.apg-product-category {
    margin-top: -5px;
    font-size: 13px;
    font-weight: 400;
    margin-bottom: 4px;
    padding: 4px 8px;
    background-color: #EAF7FA;
    width: fit-content;
    border-radius: 20px;
    color: #1b517f;
}

.apg-products-grid[data-view="list"] .apg-product-category {
    margin-top: -5px;
    margin-bottom: 0;
    font-size: 14px;
}

/* === Description === */
.apg-product-description {
    font-size: 13px;
    line-height: 1.6;
    color: #5F6368;
    margin: 8px 0;
}

.apg-product-description ul {
    margin: 0 !important;
}

/* Masquer en mode grille, afficher en mode liste */
.apg-products-grid[data-view="grid"] .apg-list-only {
    display: none;
}

.apg-products-grid[data-view="list"] .apg-list-only {
    display: block;
}

.apg-product-description,
.apg-products-grid[data-view="list"] .apg-product-description,
.apg-products-grid[data-view="list"] .apg-product-description li {
    display: inline;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* === Note === */
.apg-product-rating {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0px 0;
}

.apg-stars {
    display: flex;
    gap: 2px;
}

.apg-star {
    color: #FFC107;
    font-size: 18px;
    font-style: normal;
    line-height: 1;
}

.apg-star-full {
    color: #FFC107;
}

.apg-star-half {
    color: #FFC107;
    opacity: 0.5;
}

.apg-star-empty {
    color: #E0E0E0;
}

.apg-rating-count {
    font-size: 14px;
    color: #7F8C8D;
    font-weight: 500;
}

/* === Prix === */
.apg-product-price {
    margin: 4px 0;
    margin-top: auto;
}

.apg-price-container {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Prix HT (principal - en haut) */
.apg-price-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.apg-price-ht {
    margin-bottom: 0px;
}

.apg-price-amount-ht {
    font-size: 17px;
    font-weight: 700;
    color: #163C79;
    line-height: 1.2;
}

.apg-price-amount-ht.apg-price-discounted {
    color: #7AC143 !important;
}

.apg-price-amount-ht .woocommerce-Price-amount {
    font-weight: 700 !important;
    color: #163C79 !important;
}

.apg-price-amount-ht.apg-price-discounted .woocommerce-Price-amount {
    color: #7AC143 !important;
}

.apg-price-label-main {
    font-size: 17px;
    color: #163C79;
    font-weight: 700;
    line-height: 1.2;
}

.apg-price-old {
    font-size: 14px;
    color: #163C79;
    text-decoration: line-through;
    font-weight: 500;
}

.apg-price-old .woocommerce-Price-amount {
    font-weight: 500;
    color: #163C79 !important;
}

/* Prix TTC (secondaire - en bas) */
.apg-price-ttc {
    font-size: 16px;
    font-weight: 500;
    color: #7F8C8D;
}

.apg-price-amount-ttc {
    font-size: 16px;
    font-weight: 500;
    color: #7F8C8D;
}

.apg-price-amount-ttc.apg-price-discounted {
    color: #7AC143 !important;
}

.apg-price-amount-ttc .woocommerce-Price-amount {
    font-weight: 500 !important;
    color: #7F8C8D !important;
}

.apg-price-amount-ttc.apg-price-discounted .woocommerce-Price-amount {
    color: #7AC143 !important;
}

.apg-price-label-secondary {
    font-size: 16px;
    color: #7F8C8D;
    font-weight: 500;
}

.apg-price-old-small {
    font-size: 12px;
    color: #7F8C8D;
    text-decoration: line-through;
    font-weight: 400;
}

.apg-price-old-small .woocommerce-Price-amount {
    color: #7F8C8D !important;
}

.apg-no-price {
    font-size: 16px;
    font-weight: 600;
    color: #95A5A6;
    font-style: italic;
}

/* Mode liste - prix et actions */
.apg-products-grid[data-view="list"] .apg-product-price {
    margin: 0;
}

.apg-products-grid[data-view="list"] .apg-price-container {
    align-items: flex-end;
}

.apg-products-grid[data-view="list"] .apg-price-row {
    justify-content: flex-end;
}

.apg-products-grid[data-view="list"] .apg-price-amount-ht {
    font-size: 24px;
}

.apg-products-grid[data-view="list"] .apg-price-label-main {
    font-size: 24px;
}

.apg-products-grid[data-view="list"] .apg-price-amount-ttc {
    font-size: 16px;
}

.apg-products-grid[data-view="list"] .apg-price-label-secondary {
    font-size: 16px;
}

.apg-products-grid[data-view="list"] .apg-product-rating {
    margin: 0 0 12px 0;
}

/* === Actions === */
.apg-add-to-quote {
    width: 100%;
    padding: 10px 24px;
    background: #163C79;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 2px 4px rgba(59, 89, 152, 0.2);
}

.apg-add-to-quote:hover {
    background: #0f2a5a;
    box-shadow: 0 2px 8px rgba(59, 89, 152, 0.3);
    transform: translateY(-1px);
}

.apg-add-to-quote:active {
    transform: translateY(0);
}

.apg-add-to-quote:disabled,
.apg-add-to-quote.disabled {
    background: #BDC3C7;
    color: #7F8C8D;
    cursor: not-allowed;
    opacity: 0.6;
    pointer-events: none;
    box-shadow: none;
    transform: none;
}

.apg-add-to-quote:disabled:hover,
.apg-add-to-quote.disabled:hover {
    background: #BDC3C7;
    transform: none;
    box-shadow: none;
}

/* Bouton Voir les options (produits variables) - Même design que Ajouter au devis */
.apg-view-options {
    width: 100%;
    padding: 10px 24px;
    background: #163C79;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    box-shadow: 0 2px 4px rgba(59, 89, 152, 0.2);
}

.apg-view-options svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.apg-view-options:hover {
    background: #0f2a5a;
    color: #fff;
    box-shadow: 0 2px 8px rgba(59, 89, 152, 0.3);
    transform: translateY(-1px);
}

.apg-view-options:hover svg {
    stroke: #fff;
}

.apg-view-options:active {
    transform: translateY(0);
}

.apg-btn-icon {
    font-size: 22px;
    font-weight: 500;
    line-height: 1;
}

/* Animation de succès du bouton */
.apg-add-to-quote.btn-success {
    animation: btnAddSuccess 0.6s ease;
}

@keyframes btnAddSuccess {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.08);
        box-shadow: 0 8px 24px rgba(40, 167, 69, 0.4);
    }
}

/* === Responsive === */

/* Vue liste : Ajustements pour les largeurs moyennes (550-768px) */
@media (max-width: 768px) and (min-width: 551px) {
    .apg-products-grid[data-view="list"] .apg-product-image {
        width: 140px;
        min-width: 140px;
        height: 140px;
    }

    .apg-products-grid[data-view="list"] .apg-product-content {
        gap: 16px;
    }

    .apg-products-grid[data-view="list"] .apg-product-sidebar {
        flex-basis: 200px;
    }

    .apg-products-grid[data-view="list"] .apg-product-title {
        font-size: 16px;
    }

    .apg-products-grid[data-view="list"] .apg-price-amount-ht {
        font-size: 20px;
    }

    .apg-products-grid[data-view="list"] .apg-price-label-main {
        font-size: 20px;
    }
}

/* Vue liste : Passer en colonne en dessous de 550px */
@media (max-width: 550px) {
    .apg-products-grid[data-view="list"] .apg-product-card {
        flex-direction: column;
        min-height: auto;
    }

    .apg-products-grid[data-view="list"] .apg-product-image {
        width: 100%;
        min-width: 100%;
        padding-top: 75%;
        height: auto;
        position: relative;
        margin-right: 0;
    }

    .apg-products-grid[data-view="list"] .apg-product-image a {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }

    .apg-products-grid[data-view="list"] .apg-product-image img,
    .apg-products-grid[data-view="list"] .apg-product-image .apg-product-img {
        position: absolute !important;
        padding: 20px !important;
        opacity: 0;
        pointer-events: none;
    }

    .apg-products-grid[data-view="list"] .apg-product-image .apg-product-img.active {
        opacity: 1;
        pointer-events: auto;
    }

    .apg-products-grid[data-view="list"] .apg-product-content {
        flex-direction: column;
        padding: 0;
        gap: 12px;
    }

    .apg-products-grid[data-view="list"] .apg-product-sidebar {
        width: 100%;
        align-items: flex-start;
    }

    .apg-products-grid[data-view="list"] .apg-product-price {
        align-items: flex-start;
        margin-bottom: 12px;
    }

    .apg-products-grid[data-view="list"] .apg-price-container {
        align-items: flex-start;
    }

    .apg-products-grid[data-view="list"] .apg-price-row {
        justify-content: flex-start;
    }

    .apg-products-grid[data-view="list"] .apg-product-actions {
        align-items: stretch;
    }

    .apg-products-grid[data-view="list"] .apg-add-to-quote {
        width: 100%;
        max-width: 100%;
    }

    .apg-products-grid[data-view="list"] .apg-view-options {
        width: 100%;
        max-width: 100%;
    }

    .apg-product-title {
        font-size: 16px;
    }

    .apg-price-amount-ht {
        font-size: 20px;
    }

    .apg-price-label-main {
        font-size: 20px;
    }

    .apg-price-amount-ttc {
        font-size: 13px;
    }

    .apg-price-label-secondary {
        font-size: 13px;
    }

    .apg-price-old {
        font-size: 14px;
    }

    .apg-price-old-small {
        font-size: 12px;
    }
}

@media (max-width: 576px) {
    .apg-product-content {
        padding: 10px 8px;
    }

    .apg-product-title {
        font-size: 14px;
    }

    .apg-product-category {
        font-size: 12px;
    }

    .apg-price-amount-ht {
        font-size: 14px;
    }

    .apg-price-label-main {
        font-size: 14px;
    }

    .apg-price-amount-ttc {
        font-size: 12px;
    }

    .apg-price-label-secondary {
        font-size: 12px;
    }

    .apg-price-old {
        font-size: 13px;
    }

    .apg-price-old-small {
        font-size: 11px;
    }

    .apg-add-to-quote,
    .apg-view-options {
        padding: 4px;
        font-size: 12px;
        gap: 4px;
        min-height: 42px;
        height: 42px;
    }

    .apg-btn-icon {
        position: relative;
        top: 1px;
        font-size: 18px;
    }

    .apg-badge {
        padding: 5px 12px;
        font-size: 12px;
    }

    .apg-products-grid[data-view="list"] .apg-product-price {
        margin: 12px 0;
    }

    .apg-products-grid[data-view="list"] .apg-price-amount-ht {
        font-size: 22px;
    }

    .apg-products-grid[data-view="list"] .apg-price-label-main {
        font-size: 22px;
    }
}

@media (max-width: 420px) {
    .apg-price-row {
        flex-direction: row;
        gap: 2px;
        align-items: flex-start;
    }
}

/* === Contrôle de quantité dans la carte produit === */
.apg-card-quantity-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 8px 16px;
    min-height: 48px;
}

.apg-card-qty-btn {
    width: 32px;
    height: 32px;
    background: #163C79;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.apg-card-qty-btn:hover {
    background: #0f2a5a;
    transform: scale(1.1);
}

.apg-card-qty-btn:active {
    transform: scale(0.95);
}

.apg-card-qty-value {
    font-size: 18px;
    font-weight: 700;
    color: #163C79;
    min-width: 40px;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
}

.apg-card-qty-value:hover {
    color: #2B4B7C;
    transform: scale(1.05);
}

/* Input de quantité éditable dans la grille */
.apg-card-qty-input {
    font-size: 18px;
    font-weight: 700;
    color: #163C79;
    min-width: 40px;
    width: 60px;
    text-align: center;
    border: 2px solid #2B4B7C;
    border-radius: 4px;
    padding: 4px 8px;
    background: #fff;
    outline: none;
    transition: all 0.2s ease;
}

.apg-card-qty-input:focus {
    border-color: #163C79;
    box-shadow: 0 0 0 3px rgba(22, 60, 121, 0.1);
}

.apg-card-qty-value.updating {
    animation: qtyPulse 0.3s ease;
}

@keyframes qtyPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
        color: #7AC143;
    }
}

/* Mode liste - contrôle de quantité pleine largeur */
.apg-products-grid[data-view="list"] .apg-card-quantity-control {
    width: 100%;
    padding: 12px 16px;
}