/**
 * ============================================================================
 * @file        subheader-shop.css
 * @version     1.0.0
 * @date        2025-10-16
 * @description Styles pour le sub-header PrestaShop (Search + Cart)
 * ============================================================================
 * 
 * @purpose     Styles dédiés aux fonctionnalités PrestaShop (recherche + panier)
 *              Séparés du header CMS pour faciliter la maintenance
 * 
 * @target      shop/themes/sg_theme/css/subheader-shop.css
 * @used-by     shop/themes/sg_theme/subheader_shop.php
 * 
 * @design      - Layout flexbox (search left/center + cart right)
 *              - Responsive (mobile, tablet, desktop)
 *              - Cohérent avec header-cms-sync.css
 * 
 * @last-changes - Initial creation
 *               - Search form + Cart display
 *               - Responsive layout
 * ============================================================================
 */

/* ============================================================================
   @section Sub-header Container
   ========================================================================== */

.subheader-shop {
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    padding: 16px 0; /* @equivalent 1rem */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.subheader-shop-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px; /* Espace entre recherche et panier */
    max-width: 1200px; /* Aligné avec le contenu principal */
    margin: 0 auto;
    padding: 0; /* Pas de padding - alignement exact avec le contenu */
}

/* ============================================================================
   @section Search Form
   ========================================================================== */

.subheader-search {
    flex: 1 1 auto; /* Prend tout l'espace disponible */
    min-width: 280px; /* Minimum pour rester fonctionnel */
}

/* Désactiver complètement le module blocksearch natif PrestaShop */
/* Note: Notre formulaire custom a l'ID #searchbox et la classe .search-form-custom */
.subheader-search #search_block_top,
.subheader-search .btn.button-search,
.subheader-search form:not(.search-form-custom) {
    display: none !important;
}

/* Reset complet pour éviter les interférences de styles globaux */
.search-form-custom * {
    box-sizing: border-box !important;
}

.search-form-custom input,
.search-form-custom button {
    margin: 0 !important;
    font-family: inherit !important;
}

/* Forcer la suppression de la bordure PrestaShop (1px solid #b2bec3 !important) */
.search-form-custom input[type="text"],
.search-form-custom input[name="search_query"],
.search-form-custom .search-input-custom {
    border: 0 !important;
    border-width: 0 !important;
    border-style: none !important;
    border-color: transparent !important;
}

/* ============================================================================
   @section Search Form - Design Custom Swiss-Green
   @description Modern search with icon, clear button, and green submit
   ========================================================================== */

/* Formulaire de recherche */
.search-form-custom {
    display: flex;
    gap: 8px;
    width: 100%;
}

/* Input wrapper (avec icône et bouton clear) */
.search-input-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-input-wrapper:focus-within {
    border-color: #58A333;
    box-shadow: 0 0 0 3px rgba(88, 163, 51, 0.1);
}

/* Icône de recherche (à gauche dans l'input) */
.search-icon-input {
    position: absolute !important;
    left: 14px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    stroke: #9ca3af !important;
    pointer-events: none !important;
    z-index: 1 !important;
    flex-shrink: 0 !important;
}

/* Input de recherche */
.search-input-custom {
    flex: 1 !important;
    padding: 13px 42px 13px 44px !important; /* Espace pour icône gauche et bouton clear droite */
    border: none !important;
    border-width: 0 !important;
    border-style: none !important;
    outline: none !important;
    box-shadow: none !important;
    font-size: 15px !important;
    color: #1f2937 !important;
    background: transparent !important;
    width: 100% !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    position: relative !important;
    z-index: 2 !important;
    line-height: 1.5 !important;
}

.search-input-custom::placeholder {
    color: #9ca3af !important;
    opacity: 1 !important;
}

.search-input-custom:focus,
.search-input-custom:hover,
.search-input-custom:active {
    border: none !important;
    border-width: 0 !important;
    outline: none !important;
    box-shadow: none !important;
}

/* Bouton clear (X) - Affiché uniquement si input non vide */
.search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s ease;
    z-index: 2;
}

.search-clear:hover {
    background: #f3f4f6;
}

.search-clear svg {
    stroke: #6b7280;
}

.search-clear:hover svg {
    stroke: #1f2937;
}

/* Bouton de recherche */
.search-button-custom {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 13px 24px;
    background: #58A333;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.search-button-custom:hover {
    background: #4a8c2a;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(88, 163, 51, 0.3);
}

.search-button-custom:active {
    transform: translateY(0);
}

.search-button-custom svg {
    stroke: white;
    flex-shrink: 0;
}

/* ============================================================================
   @section Shopping Cart - Design Custom Swiss-Green
   @description Simple cart link (no dropdown) - Clean and performant
   ========================================================================== */

.subheader-cart {
    flex-shrink: 0;
}

/* Cart link principal */
.cart-link-custom {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.cart-link-custom:hover {
    border-color: #58A333;
    box-shadow: 0 0 0 3px rgba(88, 163, 51, 0.1);
    transform: translateY(-1px);
}

/* Icon wrapper avec badge */
.cart-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-icon {
    width: 24px;
    height: 24px;
    stroke: #4b5563;
    transition: stroke 0.2s ease;
}

.cart-link-custom:hover .cart-icon {
    stroke: #58A333;
}

/* Badge quantité (position absolue sur l'icône) */
.cart-qty-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #58A333;
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    line-height: 1.2;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Cart details (label + total) */
.cart-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cart-label {
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
    line-height: 1;
}

.cart-total {
    font-size: 16px;
    font-weight: 700;
    color: #1f2937;
    line-height: 1;
}

.cart-link-custom:hover .cart-label {
    color: #58A333;
}

.cart-link-custom:hover .cart-total {
    color: #58A333;
}

/* ============================================================================
   @section Autocomplete Suggestions (jQuery Plugin)
   @description Styles pour les suggestions live de recherche
   ========================================================================== */

/* Container des suggestions (dropdown) - généré par jQuery autocomplete */
.ac_results {
    position: absolute !important;
    background: white !important;
    border: 2px solid #58A333 !important;
    border-top: none !important;
    border-radius: 0 0 8px 8px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
    overflow: hidden !important;
    z-index: 9999 !important;
    margin-top: -2px !important; /* Aligner avec le champ de recherche */
}

/* Liste des suggestions */
.ac_results ul {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    max-height: 400px !important;
    overflow-y: auto !important;
}

/* Item de suggestion */
.ac_results li {
    padding: 12px 16px !important;
    cursor: pointer !important;
    color: #1f2937 !important;
    font-size: 14px !important;
    border-bottom: 1px solid #f3f4f6 !important;
    transition: all 0.15s ease !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

.ac_results li:last-child {
    border-bottom: none !important;
}

/* Item survolé ou sélectionné */
.ac_results li:hover,
.ac_results li.ac_over {
    background: #f0f9eb !important; /* Vert très clair Swiss-Green */
    color: #58A333 !important;
}

/* Pas de résultats */
.ac_results li.ac_no_results {
    color: #9ca3af !important;
    cursor: default !important;
    font-style: italic !important;
}

.ac_results li.ac_no_results:hover {
    background: transparent !important;
    color: #9ca3af !important;
}

/* Scrollbar personnalisée pour les suggestions */
.ac_results ul::-webkit-scrollbar {
    width: 8px;
}

.ac_results ul::-webkit-scrollbar-track {
    background: #f3f4f6;
}

.ac_results ul::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

.ac_results ul::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* ============================================================================
   @section Utilities
   ========================================================================== */

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================================================================
   @section Responsive
   ========================================================================== */

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {
    .subheader-shop-content {
        gap: 20px;
    }
}

/* Mobile (< 768px) */
@media (max-width: 768px) {
    .subheader-shop {
        padding: 12px 0;
    }
    
    .subheader-shop-content {
        flex-direction: column;
        gap: 12px;
    }
    
    .subheader-search {
        max-width: 100%;
        width: 100%;
    }
    
    .search-form-custom {
        flex-direction: column;
        gap: 10px;
    }
    
    .search-input-wrapper {
        width: 100%;
    }
    
    .search-button-custom {
        width: 100%;
        justify-content: center;
        padding: 14px 20px;
    }
    
    .subheader-cart {
        width: 100%;
    }
    
    .cart-link-custom {
        justify-content: center;
        width: 100%;
        padding: 12px 20px;
    }
    
    .cart-details {
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }
    
    .cart-label::after {
        content: ':';
    }
}

/* Very small screens (< 480px) */
@media (max-width: 480px) {
    .subheader-shop-content {
        padding-left: 16px;
        padding-right: 16px;
    }
    
    .search-form-fallback .search-input,
    .subheader-search #search_query_top {
        font-size: 14px !important;
        padding: 8px 40px 8px 12px !important;
    }
    
    .cart-total,
    .subheader-cart .ajax_cart_total {
        font-size: 14px !important;
    }
    
    /* Masquer le texte du bouton recherche sur très petits écrans */
    .search-button-text {
        display: none;
    }
    
    .search-button-custom {
        padding: 14px 16px;
    }
    
    .search-input-custom {
        font-size: 14px;
        padding: 12px 40px 12px 42px;
    }
}

