/**
 * Aratice Products Grid Widget - Layout Principal
 * Ce fichier ne contient que la structure de layout principale
 * 
 * Les styles des composants individuels sont dans :
 * - products-grid-header.css (breadcrumb, titre, description)
 * - products-grid-toolbar.css (tri, compteur, toggle vue)
 * - products-grid-main.css (grille, pagination, loader)
 * - products-filters.css (sidebar filtres)
 * - products-card.css (cartes produits)
 */

/* === Container Principal === */
.aratice-products-grid-wrapper {
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
}

/* === Layout Principal === */
.apg-layout {
    display: flex;
    gap: 40px;
    align-items: flex-start;
}

/* Layout sans filtres (pleine largeur) */
.apg-layout:not(:has(.apg-filters)) {
    display: block;
}

/* === Contenu principal à droite === */
.apg-main-content {
    flex: 1;
    min-width: 0;
    order: 2;
}

/* Contenu pleine largeur quand pas de filtres */
.apg-layout:not(:has(.apg-filters)) .apg-main-content {
    max-width: 100%;
}

/* === Responsive === */
@media (max-width: 992px) {
    .apg-layout {
        flex-direction: column;
        gap: 30px;
    }

    .apg-main-content {
        width: 100%;
        order: 2;
    }
}

/* === Notifications === */
.apg-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    min-width: 300px;
    max-width: 500px;
    padding: 16px 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.apg-notification-show {
    opacity: 1;
    transform: translateX(0);
}

.apg-notification-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 18px;
    font-weight: bold;
    flex-shrink: 0;
}

.apg-notification-message {
    flex: 1;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
}

/* Types de notifications */
.apg-notification-success {
    border-left: 4px solid #7EAD53;
}

.apg-notification-success .apg-notification-icon {
    background: #d4edda;
    color: #155724;
}

.apg-notification-error {
    border-left: 4px solid #dc3545;
}

.apg-notification-error .apg-notification-icon {
    background: #f8d7da;
    color: #721c24;
}

.apg-notification-warning {
    border-left: 4px solid #ffc107;
}

.apg-notification-warning .apg-notification-icon {
    background: #fff3cd;
    color: #856404;
}

.apg-notification-info {
    border-left: 4px solid #17a2b8;
}

.apg-notification-info .apg-notification-icon {
    background: #d1ecf1;
    color: #0c5460;
}

/* Animation du compteur */
.apg-cart-counter-updated {
    animation: pulse 0.5s ease-in-out;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

/* Responsive pour les notifications */
@media (max-width: 768px) {
    .apg-notification {
        top: 10px;
        right: 10px;
        left: 10px;
        min-width: auto;
        max-width: none;
    }
}

/* Texte d'indication drag pour le devis */
.apg-drag-hint {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    margin-top: 12px;
    font-size: 12px;
    color: #636262;
}

.apg-drag-hint svg {
    width: 14px;
    height: 14px;
}

/* === Drag & Drop (Cartes produits) === */

/* Carte produit draggable */
.apg-product-card.apg-draggable {
    cursor: grab;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Les liens et images gardent leur curseur normal */
.apg-product-card.apg-draggable .apg-product-image a,
.apg-product-card.apg-draggable .apg-product-image img,
.apg-product-card.apg-draggable .apg-product-title a {
    cursor: pointer;
}

.apg-product-card.apg-draggable:active {
    cursor: grabbing;
}

/* Carte en cours de drag */
.apg-product-card.apg-dragging {
    opacity: 0.5;
    transform: scale(0.95);
    cursor: grabbing;
}

/* Animation de succès après ajout */
.apg-product-card.apg-card-added {
    animation: cardAddSuccess 0.6s ease;
}

@keyframes cardAddSuccess {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 8px 24px rgba(34, 197, 94, 0.3);
    }
}

/* Ghost du drag */
.apg-drag-ghost {
    width: 280px;
    pointer-events: none;
    z-index: 10000;
    opacity: 1 !important;
    visibility: visible !important;
    filter: none !important;
}

.apg-drag-ghost * {
    opacity: 1 !important;
    filter: none !important;
}

.apg-drag-ghost-inner {
    display: flex;
    gap: 12px;
    background: #ffffff !important;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4), 0 0 0 3px rgba(59, 130, 246, 0.8);
    transform: rotate(-2deg);
    transition: none;
    opacity: 1 !important;
    backdrop-filter: none;
}

.apg-drag-ghost-image {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #f7fafc !important;
    border: 2px solid #e2e8f0;
}

.apg-drag-ghost-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 1 !important;
    display: block !important;
    filter: none !important;
    -webkit-filter: none !important;
}

.apg-drag-ghost-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    min-width: 0;
    background: transparent !important;
}

.apg-drag-ghost-title {
    font-size: 14px;
    font-weight: 700;
    color: #1a202c !important;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    opacity: 1 !important;
    text-shadow: none;
}

.apg-drag-ghost-price {
    font-size: 16px;
    font-weight: 800;
    color: #2B4B7C !important;
    opacity: 1 !important;
    text-shadow: none;
    background: rgba(59, 130, 246, 0.1);
    padding: 4px 8px;
    border-radius: 6px;
    display: inline-block;
    width: fit-content;
}

/* Désactiver le drag sur les liens et images à l'intérieur des cartes */
.apg-product-card a,
.apg-product-card img,
.apg-product-card button {
    user-select: none;
    -webkit-user-drag: none;
}

/* Responsive */
@media (max-width: 768px) {
    .apg-product-card.apg-draggable {
        cursor: pointer;
    }

    .apg-drag-ghost {
        width: 240px;
    }

    .apg-drag-ghost-image {
        width: 60px;
        height: 60px;
    }
}