/**
 * CSS final pour la modal de recherche - Structure exacte demandée
 */

/* Force l'override de tous les autres styles */
#ps-chatbot-search-modal .ps-chatbot-modal-content {
    width: 1100px !important;
    min-width: 1100px !important;
    max-width: 1100px !important;
}

/* Override supplémentaire pour contrer d'éventuelles règles max-width */
div#ps-chatbot-search-modal div.ps-chatbot-modal-content {
    width: 1100px !important;
    min-width: 1100px !important;
    max-width: 1100px !important;
}

/* Override global pour toute classe ou ID qui pourrait interférer */
[id*="ps-chatbot"][class*="modal-content"] {
    width: 1100px !important;
    min-width: 1100px !important;
    max-width: 1100px !important;
}

/* Variables */
:root {
    --search-primary: #7C3AED;
    --search-primary-light: #8B5CF6;
    --search-bg: #FFFFFF;
    --search-text: #1F2937;
    --search-text-secondary: #6B7280;
    --search-text-muted: #9CA3AF;
    --search-border: #E5E7EB;
    --search-hover: #F9FAFB;
    --search-radius: 12px;
    --search-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Modal avec overlay pour gérer les clics extérieurs */
#ps-chatbot-search-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Container principal - 1100px de large */
.ps-chatbot-modal-content {
    width: 1100px !important;
    min-width: 1100px !important;
    max-width: 1100px !important;
    max-height: 80vh;
    background: var(--search-bg);
    border-radius: var(--search-radius);
    box-shadow: var(--search-shadow);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    box-sizing: border-box;
}

/* Header */
.ps-chatbot-modal-header {
    background: linear-gradient(135deg, var(--search-primary) 0%, var(--search-primary-light) 100%);
    padding: 20px 24px;
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ps-chatbot-modal-header h3 {
    color: white;
    font-size: 24px;
    font-weight: 600;
    margin: 0;
}

/* Bouton fermeture */
.ps-chatbot-modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.ps-chatbot-modal-close:hover {
    opacity: 1;
}

/* Body de la modal */
.ps-chatbot-modal-body {
    padding: 24px;
    max-height: calc(80vh - 80px);
    overflow-y: auto;
}

/* Scrollbar personnalisée */
.ps-chatbot-modal-body::-webkit-scrollbar {
    width: 6px;
}

.ps-chatbot-modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.ps-chatbot-modal-body::-webkit-scrollbar-thumb {
    background: var(--search-border);
    border-radius: 3px;
}

/* Formulaire de recherche */
#ps-chatbot-modal-search-form {
    position: relative;
    margin: 0 0 20px 0;
    padding: 0;
}

.ps-chatbot-modal-search-input {
    width: 100%;
    padding: 16px 60px 16px 16px;
    font-size: 16px;
    border: 1px solid var(--search-border);
    border-radius: 8px;
    background: var(--search-bg);
    color: var(--search-text);
    box-sizing: border-box;
}

.ps-chatbot-modal-search-input:focus {
    outline: none;
    border-color: var(--search-primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.ps-chatbot-modal-search-input::placeholder {
    color: var(--search-text-muted);
}

/* Bouton de recherche */
#ps-chatbot-modal-search-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    outline: none;
    height: 40px;
    width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Historique des recherches */
.ps-chatbot-modal-history {
    margin-bottom: 20px;
}

.ps-chatbot-modal-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.ps-chatbot-modal-history-header span {
    font-weight: bold;
    font-size: 14px;
    color: var(--search-text-secondary);
}

#ps-chatbot-modal-history-clear {
    background: none;
    border: none;
    color: var(--search-text-muted);
    cursor: pointer;
    font-size: 13px;
    transition: color 0.2s;
}

#ps-chatbot-modal-history-clear:hover {
    color: var(--search-text-secondary);
}

/* Liste de l'historique */
.ps-chatbot-modal-history-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ps-chatbot-modal-history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--search-bg);
    cursor: pointer;
    transition: background 0.2s;
    border-radius: 6px;
}

.ps-chatbot-modal-history-item:hover {
    background: var(--search-hover);
}

.ps-chatbot-modal-history-text {
    color: var(--search-text);
    font-size: 15px;
    flex: 1;
}

.ps-chatbot-modal-history-mode {
    background: var(--search-hover);
    color: var(--search-text-secondary);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

/* Loading */
.ps-chatbot-modal-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.ps-chatbot-loader-text {
    color: var(--search-text-secondary);
    font-size: 16px;
}

.ps-chatbot-typing-dots {
    display: inline-block;
}

.ps-chatbot-typing-dots span {
    display: inline-block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--search-text-secondary);
    margin: 0 1px;
    animation: typing-dots 1.4s infinite both;
}

.ps-chatbot-typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.ps-chatbot-typing-dots span:nth-child(2) { animation-delay: -0.16s; }
.ps-chatbot-typing-dots span:nth-child(3) { animation-delay: 0; }

@keyframes typing-dots {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Conteneur des produits suggérés */
.ps-chatbot-suggested-products {
    margin-top: 0;
}

/* Grille de produits - 5 vignettes par ligne avec tailles fixes */
.ps-chatbot-products-grid {
    display: grid;
    grid-template-columns: repeat(5, 200px);
    gap: 20px;
    padding: 0;
    margin: 0;
    justify-content: center;
}

/* Carte produit - dimensions fixes pour 5 colonnes */
.ps-chatbot-product-card {
    width: 200px !important;
    height: 260px !important;
    background: var(--search-bg);
    border: 1px solid var(--search-border);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: flex;
    flex-direction: column;
}

.ps-chatbot-product-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

/* Image produit - plus grande pour 5 colonnes */
.ps-chatbot-product-image {
    width: 100%;
    height: 160px;
    object-fit: cover;
    display: block;
}

/* Info produit - ajustée pour les dimensions plus grandes */
.ps-chatbot-product-info {
    padding: 12px;
    text-align: center;
}

.ps-chatbot-product-name {
    font-size: 13px;
    color: var(--search-text);
    margin: 0 0 8px 0;
    font-weight: 600;
    line-height: 1.3;
    text-transform: uppercase;
    height: 32px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.ps-chatbot-product-price {
    font-size: 16px;
    color: var(--search-primary);
    font-weight: 600;
    margin: 0;
}

.ps-chatbot-product-description {
    display: none; /* Masquer la description comme dans le screenshot */
}

/* Responsive pour écrans plus petits */
@media (max-width: 1200px) {
    .ps-chatbot-modal-content {
        width: 95vw;
        max-width: 1100px;
    }
    
    .ps-chatbot-products-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (max-width: 900px) {
    .ps-chatbot-products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 700px) {
    .ps-chatbot-products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .ps-chatbot-product-image {
        height: 140px;
    }
    
    .ps-chatbot-product-name {
        font-size: 12px;
    }
    
    .ps-chatbot-product-price {
        font-size: 15px;
    }
}

@media (max-width: 500px) {
    .ps-chatbot-modal-content {
        width: 95vw;
    }
    
    .ps-chatbot-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .ps-chatbot-product-image {
        height: 120px;
    }
    
    .ps-chatbot-product-info {
        padding: 10px;
    }
    
    .ps-chatbot-product-name {
        font-size: 11px;
        height: 28px;
    }
    
    .ps-chatbot-product-price {
        font-size: 14px;
    }
}

/* Animation d'apparition */
.ps-chatbot-fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}