/**
 * ZolaaSearch - Recherche Fullscreen Premium
 * Styles pour l'overlay, grille produits, animations
 */

/* ============================================
   TRIGGER (Icône loupe dans le header)
   ============================================ */
.zolaasearch-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 100;
    background: rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.zolaasearch-trigger:hover {
    background: rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.2);
    transform: scale(1.1);
}

.zolaasearch-trigger:active {
    transform: scale(0.95);
}

.zolaasearch-icon {
    width: 20px;
    height: 20px;
    color: #333;
    pointer-events: none;
}

.zolaasearch-cart-flex-wrapper {
    display: inline-flex !important;
    align-items: center !important;
    position: relative !important;
}

.zolaasearch-trigger-mobile {
    width: 24px !important;
    height: 24px !important;
    background: transparent !important;
    border: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
}

.zolaasearch-trigger-mobile:hover,
.zolaasearch-trigger-mobile:active {
    background: transparent !important;
    border: none !important;
}

.zolaasearch-trigger-mobile .zolaasearch-icon {
    width: 20px;
    height: 20px;
    color: #333;
}

/* Hide the old mobile search bar when ZolaaSearch is active */
body .mh-search-module,
body .mobile-condensed-header .mh-search-module {
    display: none !important;
}

/* ============================================
   OVERLAY (Fond + Container)
   ============================================ */
.zolaasearch-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.zolaasearch-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 10, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    opacity: 0;
    transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.zolaasearch-overlay.is-active .zolaasearch-backdrop {
    opacity: 1;
}

.zolaasearch-container {
    position: relative;
    width: 100%;
    max-width: 860px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    margin-top: 60px;
    opacity: 0;
    transform: translateY(-30px) scale(0.97);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1;
}

.zolaasearch-overlay.is-active .zolaasearch-container {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* ============================================
   HEADER (Barre de recherche)
   ============================================ */
.zolaasearch-header {
    background: #fff;
    border-radius: 16px 16px 0 0;
    padding: 0;
    box-shadow: 0 -1px 0 0 rgba(0,0,0,0.05);
    flex-shrink: 0;
}

.zolaasearch-input-wrap {
    display: flex;
    align-items: center;
    padding: 4px 8px 4px 20px;
    gap: 8px;
    border-bottom: 2px solid #f0f0f0;
    min-height: 64px;
}

.zolaasearch-input-icon {
    width: 22px;
    height: 22px;
    color: #9ca3af;
    flex-shrink: 0;
    transition: color 0.2s;
}

.zolaasearch-input-wrap:focus-within .zolaasearch-input-icon {
    color: #2563eb;
}

#zolaasearch-form {
    flex: 1;
    display: flex;
    margin: 0;
    padding: 0;
}

.zolaasearch-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 18px;
    font-weight: 400;
    color: #1f2937;
    background: transparent;
    padding: 16px 8px;
    font-family: inherit;
    letter-spacing: -0.01em;
    line-height: 1.4;
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
}

.zolaasearch-input::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

.zolaasearch-input:focus {
    outline: none;
    box-shadow: none;
}

.zolaasearch-shortcuts {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.zolaasearch-shortcuts kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 6px;
    font-size: 11px;
    font-weight: 600;
    color: #9ca3af;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-family: inherit;
    line-height: 1;
}

.zolaasearch-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: none;
    background: #f3f4f6;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    padding: 0;
}

.zolaasearch-close:hover {
    background: #e5e7eb;
}

.zolaasearch-close svg {
    width: 18px;
    height: 18px;
    color: #6b7280;
}

/* ============================================
   BODY (Zone de contenu)
   ============================================ */
.zolaasearch-body {
    background: #fff;
    border-radius: 0 0 16px 16px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 200px;
    max-height: calc(85vh - 80px);
    -webkit-overflow-scrolling: touch;
}

/* Scrollbar custom */
.zolaasearch-body::-webkit-scrollbar {
    width: 6px;
}
.zolaasearch-body::-webkit-scrollbar-track {
    background: transparent;
}
.zolaasearch-body::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}
.zolaasearch-body::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* ============================================
   STATUS (État initial)
   ============================================ */
.zolaasearch-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
}

.zolaasearch-status-icon {
    margin-bottom: 16px;
}

.zolaasearch-status-icon svg {
    width: 48px;
    height: 48px;
    color: #d1d5db;
}

.zolaasearch-status-text {
    font-size: 15px;
    color: #9ca3af;
    margin: 0 0 12px 0;
    line-height: 1.5;
}

.zolaasearch-status-shortcut {
    font-size: 13px;
    color: #c0c5cd;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.zolaasearch-status-shortcut kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    font-size: 10px;
    font-weight: 600;
    color: #b0b5bd;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 5px;
    font-family: inherit;
    line-height: 1;
}

/* ============================================
   LOADER
   ============================================ */
.zolaasearch-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
}

.zolaasearch-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e5e7eb;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: zolaasearch-spin 0.7s linear infinite;
    margin-bottom: 16px;
}

@keyframes zolaasearch-spin {
    to { transform: rotate(360deg); }
}

.zolaasearch-loader p {
    font-size: 14px;
    color: #9ca3af;
    margin: 0;
}

/* ============================================
   RESULTS
   ============================================ */
.zolaasearch-results {
    padding: 0;
}

.zolaasearch-results-inner {
    display: flex;
    gap: 0;
}

/* Sidebar catégories */
.zolaasearch-sidebar {
    width: 220px;
    flex-shrink: 0;
    border-right: 1px solid #f0f0f0;
    padding: 20px 0;
    display: none;
}

.zolaasearch-sidebar.has-content {
    display: block;
}

.zolaasearch-sidebar-section {
    padding: 0 16px;
    margin-bottom: 20px;
}

.zolaasearch-sidebar-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9ca3af;
    margin: 0 0 10px 0;
    padding: 0 4px;
}

.zolaasearch-sidebar-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    color: #374151;
    font-size: 14px;
    line-height: 1.4;
}

.zolaasearch-sidebar-item:hover {
    background: #f3f4f6;
    color: #1f2937;
    text-decoration: none;
}

.zolaasearch-sidebar-count {
    font-size: 12px;
    color: #9ca3af;
    background: #f3f4f6;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
    flex-shrink: 0;
    margin-left: 8px;
}

.zolaasearch-sidebar-item:hover .zolaasearch-sidebar-count {
    background: #e5e7eb;
}

/* Zone produits */
.zolaasearch-products {
    flex: 1;
    padding: 16px;
    min-width: 0;
}

.zolaasearch-products-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 0 4px;
}

.zolaasearch-products-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9ca3af;
    margin: 0;
}

.zolaasearch-products-count {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
}

/* Grille produits */
.zolaasearch-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.zolaasearch-product {
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    color: inherit;
    background: #fafafa;
    border: 1px solid transparent;
}

.zolaasearch-product:hover {
    background: #fff;
    border-color: #e5e7eb;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
    text-decoration: none;
    color: inherit;
}

.zolaasearch-product-img {
    position: relative;
    width: 100%;
    padding-top: 100%;
    overflow: hidden;
    background: #f3f4f6;
}

.zolaasearch-product-img img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.zolaasearch-product:hover .zolaasearch-product-img img {
    transform: scale(1.05);
}

.zolaasearch-product-info {
    padding: 10px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.zolaasearch-product-name {
    font-size: 13px;
    font-weight: 500;
    color: #1f2937;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
}

.zolaasearch-product-category {
    font-size: 11px;
    color: #9ca3af;
    margin: 0;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.zolaasearch-product-price {
    font-size: 15px;
    font-weight: 700;
    color: #111827;
    margin: 2px 0 0;
    line-height: 1.2;
}

.zolaasearch-product-price-unit {
    font-size: 11px;
    font-weight: 400;
    color: #9ca3af;
    margin-left: 2px;
}

/* ============================================
   FOOTER (Voir tous les résultats)
   ============================================ */
.zolaasearch-footer {
    padding: 12px 20px;
    border-top: 1px solid #f0f0f0;
    text-align: center;
}

.zolaasearch-see-all {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: #1f2937;
    color: #fff;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}

.zolaasearch-see-all:hover {
    background: #111827;
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.zolaasearch-see-all svg {
    width: 16px;
    height: 16px;
    transition: transform 0.2s;
}

.zolaasearch-see-all:hover svg {
    transform: translateX(3px);
}

/* ============================================
   EMPTY STATE
   ============================================ */
.zolaasearch-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
}

.zolaasearch-empty-icon svg {
    width: 48px;
    height: 48px;
    color: #d1d5db;
    margin-bottom: 16px;
}

.zolaasearch-empty-title {
    font-size: 16px;
    font-weight: 600;
    color: #6b7280;
    margin: 0 0 6px 0;
}

.zolaasearch-empty-text {
    font-size: 14px;
    color: #9ca3af;
    margin: 0;
}

/* ============================================
   BODY LOCK
   ============================================ */
body.zolaasearch-open {
    overflow: hidden !important;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .zolaasearch-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .zolaasearch-sidebar {
        width: 190px;
    }
}

@media (max-width: 768px) {
    .zolaasearch-container {
        margin-top: 0;
        max-width: 100%;
        max-height: 100vh;
        height: 100%;
    }

    .zolaasearch-header {
        border-radius: 0;
    }

    .zolaasearch-body {
        border-radius: 0;
        max-height: calc(100vh - 72px);
    }

    .zolaasearch-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .zolaasearch-sidebar {
        display: none !important;
    }

    .zolaasearch-products {
        padding: 12px;
    }

    .zolaasearch-shortcuts {
        display: none;
    }

    .zolaasearch-input {
        font-size: 16px;
    }

    .zolaasearch-input-wrap {
        padding: 4px 4px 4px 16px;
        min-height: 56px;
    }
}

@media (max-width: 480px) {
    .zolaasearch-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .zolaasearch-product-info {
        padding: 8px 10px 10px;
    }

    .zolaasearch-product-name {
        font-size: 12px;
    }

    .zolaasearch-product-price {
        font-size: 14px;
    }
}

/* ============================================
   ANIMATION DE FERMETURE
   ============================================ */
.zolaasearch-overlay.is-closing .zolaasearch-backdrop {
    opacity: 0;
    transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.zolaasearch-overlay.is-closing .zolaasearch-container {
    opacity: 0;
    transform: translateY(-20px) scale(0.97);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   HIGHLIGHT TEXTE RECHERCHÉ
   ============================================ */
.zolaasearch-highlight {
    background: rgba(37, 99, 235, 0.12);
    color: #2563eb;
    border-radius: 2px;
    padding: 0 1px;
    font-weight: 600;
}
