/* ====== GLOBAL ====== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: sans-serif;
}

body {
    background: #ffffff;
}

.parts-container {
    padding: 20px 40px;
    max-width: 1400px;
    margin: 0 auto;
    background: white;
}

/* Nouveau style pour l'en-tête */
.parts-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px 20px;
    /* Augmenter le padding pour mieux voir l'image */
    margin-bottom: 20px;
    border-bottom: 3px solid #0036FF;
    background-image: url('{{ asset("/assets/Images/Login/600.png") }}');
    background-size: cover;
    /* Ajuste l'image pour couvrir tout l'espace */
    background-position: center;
    /* Centre l'image */
    background-repeat: no-repeat;
    /* Empêche la répétition */
    color: white;
    /* Change la couleur du texte pour contraster avec l'image */
    position: relative;
    /* Pour le pseudo-élément */
    min-height: 100px;
    /* Hauteur minimale */
    border-radius: 5px;
}

.parts-header-bar h1,
.parts-shopping {
    position: relative;
    /* Pour placer au-dessus de l'overlay */
    z-index: 1;
}

.parts-header-bar h1 {
    margin: 0;
    font-size: 28px;
    font-weight: bold;
    color: #333;
}

.parts-shopping {
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.parts-shopping .cart-icon {
    font-size: 24px;
    color: #333;
    margin-right: 4px;
}

.parts-shopping .quantity {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #0036FF;
    color: white;
    font-size: 12px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 50%;
    line-height: 1;
}

/* ====== FILTER BAR - MODIFIÉ ====== */
.parts-filter-bar {
    margin: 0 0 30px;
    padding: 12px 24px;
    background: #f7f8fa;
    border-radius: 8px;
}

.parts-filter-form {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
    max-width: 1200px;
}

.parts-filter-form input[type="text"] {
    height: 56px;
    padding: 0 20px;
    font-size: 16px;
    background: #fff;
    border: 1.5px solid #ccd1d9;
    border-radius: 10px;
    box-sizing: border-box;
    transition: 0.2s;
    flex: 1 1 auto;
    max-width: 400px;
    min-width: 240px;
}

.parts-filter-form select {
    height: 56px;
    padding: 0 20px;
    font-size: 16px;
    background: #fff;
    border: 1.5px solid #ccd1d9;
    border-radius: 10px;
    box-sizing: border-box;
    transition: 0.2s;
    min-width: 220px;
    max-width: 300px;
    appearance: none;
    background: url("data:image/svg+xml,%3Csvg%20viewBox%3D'0%200%2010%206'%20xmlns%3D'http%3A//www.w3.org/2000/svg'%3E%3Cpath%20d%3D'M0%200l5%206%205-6z'%20fill%3D'%230036FF'/%3E%3C/svg%3E") no-repeat right 16px center/12px;
    background-color: #fff;
    padding-right: 46px;
    flex: 1 1 auto;
    text-overflow: ellipsis;
}

.parts-filter-form input:focus,
.parts-filter-form select:focus {
    outline: none;
    border-color: #0036FF;
    box-shadow: 0 0 6px rgba(0, 54, 255, 0.25);
}

/* ====== PARTS LIST - CENTERED ====== */
.parts-list {
    display: grid;
    /* This ensures a uniform grid with centered columns depending on auto-fill width */
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 30px;
    justify-content: center;
    justify-items: center;
    /* Ensures individual flex children center inside their tracks */
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding: 20px 0;
}

/* Override the grid properties specifically for mobile if grid-items still float left */
@media (max-width: 768px) {
    .parts-list {
        display: flex;
        /* Switch to flex on mobile for guaranteed centering */
        flex-direction: column;
        align-items: center;
    }
}

.parts-item {
    width: 280px;
    padding: 20px;
    height: 380px;
    background: #fff;
    text-align: center;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    margin-bottom: 25px;
    cursor: pointer;
    /* Indique que toute la carte est cliquable */
}

.parts-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    border: 1px solid #e2e8f0;
    /* subtly highlight on hover */
}

.parts-item img {
    width: 100%;
    height: 150px;
    object-fit: cover; /* CHANGED FROM contain TO cover TO STRETCH IMAGE */
    background-color: #f9f9f9;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: opacity 0.3s ease;
}

.parts-item:hover img {
    opacity: 0.9;
    /* Slight interaction effect instead of scaling/zooming */
}

.parts-item h2 {
    font-size: 18px;
    margin: 10px 0 6px;
    min-height: 40px;
    /* 2 lignes de 24 px          */
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
}

.parts-item .description {
    flex-grow: 1;
    font-size: 14px;
    color: #555;
    line-height: 1.4;
    margin: 0 0 4px;
    position: relative;
    word-break: break-word;
    text-align: left;
    /* Alignement à gauche pour une meilleure lisibilité */
}

.parts-item .description:not(.expanded) {
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    /* Limite à 3 lignes */
    max-height: calc(1.4em * 3);
    /* 3 lignes × hauteur de ligne */
    text-overflow: ellipsis;
}

.parts-item .description::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 70%;
    height: 1em;
    /* hauteur d’une ligne */

}

.parts-item .description.expanded {
    -webkit-line-clamp: unset;
    line-clamp: unset;
    max-height: none;
    overflow: visible;
    display: block;
}


.parts-item .description {
    max-height: 4.2em;
    /* ~3 lignes */
}





.parts-item .description-toggle:hover {
    color: #1976d2;
    text-decoration: underline;
}

.description-toggle {
    display: inline-block;
    margin-top: 4px;
    color: #0036FF;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    font-size: 12px;
    transition: color 0.2s ease;
}

.description-toggle:hover {
    color: #1976d2;
    text-decoration: underline;
}

.parts-item.has-long-description {
    min-height: 380px;
    /* Hauteur minimale pour les cartes avec description longue */
}

.parts-item.has-long-description .description.expanded {
    max-height: 200px;
    /* Limite la hauteur maximale même en mode étendu */
    overflow-y: auto;
    /* Ajoute un scroll si nécessaire */
}

/* Scroll personnalisé pour les descriptions étendues */
.parts-item .description.expanded::-webkit-scrollbar {
    width: 4px;
}

.parts-item .description.expanded::-webkit-scrollbar-thumb {
    background-color: #0036FF;
    border-radius: 2px;
}

.parts-item .description.expanded::-webkit-scrollbar-track {
    background-color: #f1f1f1;
    border-radius: 2px;
}

/* Animation pour la transition */
.parts-item .description {
    transition: max-height 0.3s ease, opacity 0.2s ease;
}

/* Amélioration pour les très longues descriptions */
.parts-item .description.expanded {
    padding-right: 8px;
    /* Espace pour le scrollbar */
}

.parts-item button {
    background-color: #0036ff;
    color: white;
    border: none;
    padding: 12px 0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer !important;
    user-select: none !important;
    transition: background-color 0.3s ease, transform 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 10px rgba(52, 152, 219, 0.2);
    margin-top: auto;
    width: 100%;
}

.parts-item button:hover {
    background-color: #1976d2 !important;
    transform: translateY(-2px);
}

.parts-item button:focus {
    outline: none !important;
    box-shadow: none !important;
}

/* ====== PAGINATION STYLES ====== */
/* ====== PAGINATION STYLES - Version améliorée ====== */
.pagination-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 40px;
    padding: 20px 0;
    border-top: 1px solid #e2e8f0;
}

.pagination-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.pagination-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
    padding: 0 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.pagination-btn:hover:not(.disabled) {
    background-color: #0036FF;
    color: white;
    border-color: #0036FF;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 54, 255, 0.25);
    text-decoration: none;
}

.pagination-btn.active {
    background-color: #0036FF;
    color: white;
    border-color: #0036FF;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 54, 255, 0.3);
}

.pagination-btn.disabled {
    background-color: #f8f9fa;
    color: #ccc;
    cursor: not-allowed;
    border-color: #eee;
    opacity: 0.6;
}

.pagination-btn.disabled:hover {
    background-color: #f8f9fa;
    color: #ccc;
    transform: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.pagination-info {
    font-size: 14px;
    color: #666;
    text-align: center;
    margin-top: 10px;
    padding: 8px 16px;
    background-color: #f8f9fa;
    border-radius: 20px;
    border: 1px solid #e9ecef;
}

/* Responsive pagination */
@media (max-width: 768px) {
    .parts-item .description {
        font-size: 13px;
        line-height: 1.3;
    }

    .parts-item .description:not(.expanded) {
        max-height: calc(1.3em * 3);
    }

    .description-toggle {
        font-size: 11px;
    }

    .pagination-container {
        gap: 4px;
    }

    .pagination-btn {
        min-width: 35px;
        height: 35px;
        font-size: 12px;
    }

    .pagination-info {
        font-size: 12px;
        padding: 6px 12px;
    }
}

/* Animation pour les boutons de pagination */
@keyframes paginationPulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

.pagination-btn.active {
    animation: paginationPulse 0.3s ease-in-out;
}

/* Style pour les ellipses de pagination (si utilisées) */
.pagination-ellipsis {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: #666;
    font-size: 14px;
    user-select: none;
}

/* Amélioration du style pour les très grandes paginations */
.pagination-container:has(.pagination-btn:nth-child(10)) {
    max-width: 100%;
    overflow-x: auto;
    padding: 0 10px;
}

.pagination-container:has(.pagination-btn:nth-child(10))::-webkit-scrollbar {
    height: 6px;
}

.pagination-container:has(.pagination-btn:nth-child(10))::-webkit-scrollbar-thumb {
    background-color: #0036FF;
    border-radius: 3px;
}

.pagination-container:has(.pagination-btn:nth-child(10))::-webkit-scrollbar-track {
    background-color: #f1f1f1;
    border-radius: 3px;
}

/* ====== CART OVERLAY ====== */
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.cart-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ====== CART ====== */
.parts-cart {
    position: fixed;
    top: 0;
    right: 0;
    width: 350px;
    height: 100%;
    background: #333;
    color: white;
    overflow: hidden;
    padding: 20px;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 1000;
}

.parts-cart.active {
    transform: translateX(0);
}

/* Ajouter cette règle */
.parts-cart.hidden {
    display: none;
}

.parts-cart h1 {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
}

.parts-cart .listCard {
    flex-grow: 1;
    overflow-y: auto;
    margin-top: 20px;
    padding-right: 10px;
    max-height: calc(100vh - 200px);
}

.parts-cart .listCard::-webkit-scrollbar {
    width: 6px;
}

.parts-cart .listCard::-webkit-scrollbar-thumb {
    background-color: #666;
    border-radius: 10px;
}

.parts-cart .listCard li {
    list-style: none;
    margin-bottom: 15px;
    padding: 10px;
    background: #444;
    border-radius: 8px;
}

.checkout-footer {
    padding: 6px;
    background-color: #2e2e2e;
    border-top: 1px solid #444;
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.total-box {
    width: 90%;
    max-width: 320px;
    background-color: #1f1f1f;
    padding: 14px 20px;
    border-radius: 12px;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    box-shadow: inset 0 0 0 2px #9eb0a7;
    margin-top: 10px;
}

.btn-group {
    width: 90%;
    max-width: 320px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.checkout-btn {
    background-color: #00cc66;
    color: white;
    border: none;
    padding: 12px 16px;
    cursor: pointer;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1;
    transition: background-color 0.3s, transform 0.2s;
    box-shadow: 0 4px 10px rgba(0, 204, 102, 0.3);
}

.checkout-btn:hover {
    background-color: #00994d;
    transform: translateY(-2px);
}

.closeShopping {
    background-color: transparent;
    color: #fff;
    border: 2px dashed #bbb;
    border-radius: 10px;
    padding: 12px;
    font-weight: 600;
    flex-shrink: 0;
    transition: all 0.3s ease;
    min-width: 100px;
    text-align: center;
    cursor: pointer;
}

.closeShopping:hover {
    border-color: #fff;
    background-color: #444;
    color: #eee;
}

/* Quantity controls */
.quantity-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 5px;
}

.btn-qty {
    background: #0036FF;
    color: white;
    border: none;
    width: 25px;
    height: 25px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-qty:hover {
    background: #1976d2;
}

.qty-value {
    color: #ccc;
    font-size: 14px;
    min-width: 20px;
    text-align: center;
}

/* Comment zone */
.quote-note-wrapper {
    margin-top: 16px;
}

.quote-note-wrapper textarea {
    width: 100%;
    min-height: 70px;
    background-color: #2d3748;
    color: #e2e8f0;
    border: 2px solid #4a5568;
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s ease;
}

.quote-note-wrapper textarea:focus {
    outline: none;
    border-color: #0036FF;
}

/* ====== MODAL REDESIGN ====== */
.parts-modal {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.75);
    /* slightly darker for better contrast */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
    /* modern touch */
}

.parts-modal.hidden {
    display: none;
}

.parts-modal-redesign {
    background: #ffffff;
    padding: 0;
    /* padding removed to allow image to touch edges on mobile if needed, but handled in layout */
    border-radius: 16px;
    max-width: 90%;
    width: 800px;
    /* Wider for the split layout */
    max-height: 90vh;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    text-align: left;
    /* Reset from old center */
    position: relative;
    overflow: hidden;
    animation: modalScaleIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalScaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-body-layout {
    display: flex;
    flex-wrap: wrap;
    /* allows stacking on mobile */
    max-height: 90vh;
    /* ensure it respects the modal height */
}

.modal-image-col {
    flex: 1 1 300px;
    background-color: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    border-right: 1px solid #eee;
}

.modal-image-col img {
    width: 100%;
    height: auto;
    max-height: 350px;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.modal-info-col {
    flex: 1.5 1 350px;
    padding: 40px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    max-height: 90vh;
}

.modal-info-col h2 {
    color: #1a202c;
    margin-bottom: 20px;
    font-size: 24px;
    line-height: 1.3;
    font-weight: 700;
}

.spec-badge {
    display: inline-flex;
    align-items: center;
    background: #f0f4f8;
    padding: 6px 14px;
    border-radius: 20px;
    margin-bottom: 20px;
    border: 1px solid #e2e8f0;
    max-width: fit-content;
}

.spec-badge.hidden {
    display: none !important;
}

.spec-label {
    font-size: 13px;
    color: #4a5568;
    margin-right: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ====== FIX IMAGE ZOOM Z-INDEX ====== */
/* Ensures the Magnific Popup lightbox appears ABOVE the modal */
.mfp-bg,
.mfp-wrap {
    z-index: 100000 !important;
}

.badge-condition {
    font-size: 14px;
    color: #0036FF;
    font-weight: 700;
}

.modal-desc-scroll {
    color: #4a5568;
    line-height: 1.7;
    font-size: 15px;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: 300;
    line-height: 1;
    color: #a0aec0;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
    background: white;
    /* to ensure visibility over scroll/content */
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.close-modal:hover {
    color: #e53e3e;
    transform: rotate(90deg);
}

/* Responsive modal fix */
@media (max-width: 768px) {
    .modal-body-layout {
        flex-direction: column;
        overflow-y: auto;
    }

    .modal-image-col {
        border-right: none;
        border-bottom: 1px solid #eee;
        padding: 20px;
    }

    .modal-image-col img {
        max-height: 200px;
    }

    .modal-info-col {
        padding: 24px;
        overflow-y: visible;
    }
}

/* ====== MESSAGES ====== */
.parts-message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    background: #00cc66;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.parts-message.error {
    background: #ff4757;
}

.parts-message.success {
    background: #00cc66;
}

/* ====== ANIMATIONS ====== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

.parts-item {
    animation: fadeIn 0.5s ease-out;
}

/* ====== RESPONSIVE ====== */
@media (max-width: 768px) {
    .parts-container {
        padding: 20px;
    }

    .parts-header-bar {
        padding: 15px 20px;
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .parts-shopping {
        align-self: flex-end;
        margin-top: -10px;
    }

    .parts-filter-bar .parts-filter-form {
        flex-direction: column;
        gap: 15px;
    }

    .parts-filter-form input[type="text"] {
        width: 100%;
        max-width: none;
        min-width: auto;
    }

    .parts-filter-form select {
        width: 100%;
    }

    .parts-list {
        justify-content: center;
    }

    .parts-item {
        width: 90%;
        max-width: 300px;
    }

    .parts-cart {
        width: 100%;
    }

    .parts-modal .modal-content {
        width: 90%;
    }
}

/* Empty state styling */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #718096;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 24px;
    margin-bottom: 10px;
    color: #4a5568;
}

.empty-state p {
    font-size: 16px;
    color: #718096;
}

/* Supprime l’espace vertical que Bootstrap ajoute */
.form-control,
form select {
    margin-bottom: 0 !important;
    /* aucun espacement dessous */
}


.parts-item .img-wrapper {
    width: 100%;
    height: 150px;
    /* même hauteur pour toutes   */
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: #f9f9f9;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
}





.pbmit-service-icon i.fa-cart-shopping {
    color: #fff !important;
}