/**
 * SEARCH AUTOCOMPLETE - Našeptávač vyhledávání
 * GISHOP.CZ - Live search s miniaturami produktů
 */

/* ============================================
   SEARCH WRAPPER
   ============================================ */
.search-wrapper {
    position: relative;
    width: 100%;
    display: flex;
}

.search-wrapper .search-input {
    flex: 1;
    padding: 14px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 12px 0 0 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #fff;
}

.search-wrapper .search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-wrapper .search-btn {
    padding: 14px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 0 12px 12px 0;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.1rem;
}

.search-wrapper .search-btn:hover {
    background: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);
    transform: scale(1.02);
}

/* ============================================
   AUTOCOMPLETE DROPDOWN
   ============================================ */
.search-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    margin-top: 8px;
    display: none;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    max-height: 480px;
    overflow-y: auto;
}

.search-autocomplete.active {
    display: block;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   LOADING STATE
   ============================================ */
.autocomplete-loading {
    display: none;
    padding: 20px;
    text-align: center;
    color: #718096;
    font-size: 0.95rem;
}

.autocomplete-loading i {
    margin-right: 8px;
    color: #667eea;
}

.search-autocomplete.loading .autocomplete-loading {
    display: block;
}

.search-autocomplete.loading .autocomplete-results,
.search-autocomplete.loading .autocomplete-footer {
    display: none;
}

/* ============================================
   RESULTS LIST
   ============================================ */
.autocomplete-results {
    padding: 8px 0;
}

.autocomplete-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
    gap: 15px;
    border-bottom: 1px solid #f1f5f9;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
}

.autocomplete-item:hover .item-name {
    color: #667eea;
}

/* ============================================
   PRODUCT IMAGE
   ============================================ */
.autocomplete-item .item-image {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.autocomplete-item .item-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.autocomplete-item:hover .item-image img {
    transform: scale(1.1);
}

/* ============================================
   PRODUCT INFO
   ============================================ */
.autocomplete-item .item-info {
    flex: 1;
    min-width: 0;
}

.autocomplete-item .item-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1a202c;
    margin: 0 0 4px 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s ease;
}

.autocomplete-item .item-brand {
    font-size: 0.8rem;
    color: #667eea;
    margin: 0 0 4px 0;
    font-weight: 500;
}

.autocomplete-item .item-sku {
    font-size: 0.75rem;
    color: #a0aec0;
    margin: 0;
}

/* ============================================
   PRODUCT PRICE
   ============================================ */
.autocomplete-item .item-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: #667eea;
    white-space: nowrap;
    text-align: right;
}

/* ============================================
   FOOTER - SHOW ALL
   ============================================ */
.autocomplete-footer {
    padding: 12px 16px;
    background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
    border-top: 1px solid #e2e8f0;
    display: none;
}

.autocomplete-footer.has-more {
    display: block;
}

.autocomplete-show-all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.autocomplete-show-all:hover {
    color: #764ba2;
}

.autocomplete-show-all i {
    transition: transform 0.2s ease;
}

.autocomplete-show-all:hover i {
    transform: translateX(4px);
}

/* ============================================
   NO RESULTS
   ============================================ */
.autocomplete-no-results {
    padding: 30px 20px;
    text-align: center;
    color: #718096;
}

.autocomplete-no-results i {
    font-size: 2.5rem;
    color: #cbd5e0;
    margin-bottom: 12px;
    display: block;
}

.autocomplete-no-results p {
    margin: 0;
    font-size: 0.95rem;
}

/* ============================================
   HIGHLIGHT MATCHED TEXT
   ============================================ */
.autocomplete-item .item-name mark {
    background: rgba(102, 126, 234, 0.2);
    color: inherit;
    padding: 0 2px;
    border-radius: 2px;
}

/* ============================================
   KEYBOARD NAVIGATION
   ============================================ */
.autocomplete-item.selected {
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
}

.autocomplete-item.selected .item-name {
    color: #667eea;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .search-autocomplete {
        position: fixed;
        top: auto;
        left: 10px;
        right: 10px;
        margin-top: 10px;
        max-height: 60vh;
    }
    
    .autocomplete-item {
        padding: 10px 12px;
        gap: 12px;
    }
    
    .autocomplete-item .item-image {
        width: 50px;
        height: 50px;
    }
    
    .autocomplete-item .item-name {
        font-size: 0.9rem;
    }
    
    .autocomplete-item .item-price {
        font-size: 1rem;
    }
}

/* ============================================
   CHRISTMAS THEME
   ============================================ */
.christmas-mode .search-wrapper .search-btn {
    background: linear-gradient(135deg, #c41e3a 0%, #8b0000 100%);
}

.christmas-mode .search-wrapper .search-input:focus {
    border-color: #c41e3a;
    box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.1);
}

.christmas-mode .autocomplete-item:hover {
    background: linear-gradient(135deg, #fff5f5 0%, #fed7d7 100%);
}

.christmas-mode .autocomplete-item .item-price {
    color: #c41e3a;
}

.christmas-mode .autocomplete-show-all {
    color: #c41e3a;
}
