/**
 * GO2 Smart Search — Styles CSS
 * Design coherent avec la charte GO2 Sante (orange #F7941D)
 */

/* =========================================
   WRAPPER & DROPDOWN
   ========================================= */
.go2s-wrapper {
    position: relative;
    width: 100%;
    z-index: 9999;
}

.go2s-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-top: 3px solid #F7941D;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    max-height: 520px;
    overflow-y: auto;
    z-index: 99999;
    scrollbar-width: thin;
    scrollbar-color: #F7941D #f5f5f5;
}

.go2s-dropdown.go2s-show {
    display: block;
    animation: go2s-slideDown 0.2s ease-out;
}

@keyframes go2s-slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.go2s-dropdown::-webkit-scrollbar {
    width: 6px;
}

.go2s-dropdown::-webkit-scrollbar-track {
    background: #f5f5f5;
}

.go2s-dropdown::-webkit-scrollbar-thumb {
    background: #F7941D;
    border-radius: 3px;
}

/* =========================================
   HEADER
   ========================================= */
.go2s-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: linear-gradient(135deg, #FFF8F0, #FFF3E0);
    border-bottom: 1px solid #FFE0B2;
}

.go2s-ai-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #F7941D;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 12px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.go2s-ai-badge::before {
    content: '✨';
    font-size: 10px;
}

.go2s-count {
    font-size: 13px;
    color: #888;
}

/* =========================================
   SECTIONS
   ========================================= */
.go2s-section {
    padding: 8px 0;
}

.go2s-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #999;
    padding: 4px 16px 6px;
}

/* =========================================
   ITEMS (produits & categories)
   ========================================= */
.go2s-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    text-decoration: none;
    color: #333;
    transition: background-color 0.15s;
    cursor: pointer;
    border-bottom: 1px solid #f5f5f5;
}

.go2s-item:last-child {
    border-bottom: none;
}

.go2s-item:hover,
.go2s-item.go2s-selected {
    background-color: #FFF8F0;
}

/* Category items */
.go2s-cat-icon {
    font-size: 20px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border-radius: 8px;
    flex-shrink: 0;
}

.go2s-cat-name {
    font-size: 14px;
    font-weight: 600;
    flex-grow: 1;
}

.go2s-cat-count {
    font-size: 12px;
    color: #999;
    white-space: nowrap;
}

/* Product items */
.go2s-product-img {
    width: 50px;
    height: 50px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #f9f9f9;
    border: 1px solid #eee;
}

.go2s-product-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.go2s-product-info {
    flex-grow: 1;
    min-width: 0;
}

.go2s-product-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.go2s-product-meta {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 2px;
}

.go2s-ref {
    font-size: 11px;
    color: #aaa;
}

.go2s-product-cat {
    font-size: 11px;
    color: #F7941D;
    background: #FFF3E0;
    padding: 1px 6px;
    border-radius: 4px;
}

.go2s-product-right {
    text-align: right;
    flex-shrink: 0;
}

.go2s-product-price {
    font-size: 15px;
    font-weight: 700;
    color: #F7941D;
    white-space: nowrap;
}

.go2s-stock {
    font-size: 11px;
    font-weight: 600;
    margin-top: 2px;
}

.go2s-stock-ok {
    color: #2E7D32;
}

.go2s-stock-out {
    color: #C62828;
}

/* Highlight matches */
.go2s-item mark,
.go2s-dropdown mark {
    background: #FFECB3;
    color: #333;
    padding: 0 1px;
    border-radius: 2px;
    font-weight: 700;
}

/* =========================================
   SUGGESTIONS
   ========================================= */
.go2s-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 16px;
}

.go2s-suggestion {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #FFF3E0;
    border: 1px solid #FFE0B2;
    color: #E65100;
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.go2s-suggestion:hover {
    background: #F7941D;
    color: #fff;
    border-color: #F7941D;
}

/* =========================================
   EMPTY STATE
   ========================================= */
.go2s-empty {
    padding: 24px 16px;
    text-align: center;
}

.go2s-empty-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.go2s-empty-text {
    font-size: 15px;
    color: #555;
    margin-bottom: 4px;
}

.go2s-empty-hint {
    font-size: 13px;
    color: #999;
    margin-bottom: 12px;
}

/* =========================================
   LOADING
   ========================================= */
.go2s-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    color: #888;
    font-size: 14px;
}

.go2s-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid #FFE0B2;
    border-top-color: #F7941D;
    border-radius: 50%;
    animation: go2s-spin 0.6s linear infinite;
}

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

/* =========================================
   ERROR
   ========================================= */
.go2s-error {
    padding: 16px;
    text-align: center;
    color: #C62828;
    font-size: 14px;
}

/* =========================================
   FOOTER
   ========================================= */
.go2s-footer {
    display: block;
    padding: 12px 16px;
    text-align: center;
    background: #FAFAFA;
    color: #F7941D;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border-top: 1px solid #eee;
    border-radius: 0 0 12px 12px;
    transition: background 0.15s;
}

.go2s-footer:hover {
    background: #FFF3E0;
    color: #E65100;
}

/* =========================================
   RESPONSIVE
   ========================================= */
@media (max-width: 768px) {
    .go2s-dropdown {
        position: fixed;
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        max-height: 70vh;
        border-radius: 16px 16px 0 0;
        border-top: 3px solid #F7941D;
    }

    .go2s-item {
        padding: 12px 16px;
    }

    .go2s-product-img {
        width: 44px;
        height: 44px;
    }

    .go2s-product-name {
        font-size: 13px;
    }
}

/* =========================================
   ACCESSIBILITY
   ========================================= */
.go2s-item:focus-visible {
    outline: 2px solid #F7941D;
    outline-offset: -2px;
}

@media (prefers-reduced-motion: reduce) {
    .go2s-dropdown.go2s-show {
        animation: none;
    }
    .go2s-spinner {
        animation-duration: 1.5s;
    }
}

/* =========================================
   HIGH CONTRAST / ACCESSIBILITY MODE
   ========================================= */
body.accessibility-mode .go2s-dropdown {
    font-size: 16px;
}

body.accessibility-mode .go2s-product-name {
    font-size: 16px;
}

body.accessibility-mode .go2s-product-price {
    font-size: 18px;
}

body.accessibility-mode .go2s-item {
    padding: 14px 16px;
    min-height: 56px;
}
