/**
 * TIW Smart Search — Dropdown Styles
 * Clean, modern design compatible with Flatsome theme.
 *
 * @package TIW_Smart_Search
 */

/* =============================================
   WRAPPER
   ============================================= */
.tiw-search-wrapper {
    position: relative;
    width: 100%;
}

/* =============================================
   DROPDOWN CONTAINER
   ============================================= */
.tiw-search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 99999;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    max-height: 440px;
    overflow-y: auto;
    overflow-x: hidden;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.tiw-search-dropdown.tiw-open {
    opacity: 1;
    transform: translateY(0);
}

/* Scrollbar */
.tiw-search-dropdown::-webkit-scrollbar {
    width: 5px;
}
.tiw-search-dropdown::-webkit-scrollbar-track {
    background: transparent;
}
.tiw-search-dropdown::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

/* =============================================
   RESULT ITEMS
   ============================================= */
.tiw-results-list {
    padding: 4px 0;
}

.tiw-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    text-decoration: none !important;
    color: inherit !important;
    border-bottom: 1px solid #f5f5f5;
    transition: background-color 0.15s ease;
    cursor: pointer;
}

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

.tiw-result-item:hover,
.tiw-result-item.tiw-active {
    background-color: #f8f9fa;
}

/* Product Image */
.tiw-result-image {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    border-radius: 6px;
    overflow: hidden;
    background: #f5f5f5;
}

.tiw-result-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Product Info */
.tiw-result-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tiw-result-title {
    font-size: 13.5px;
    line-height: 1.35;
    color: #1a1a1a;
    font-weight: 400;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tiw-result-title strong {
    color: #e63946;
    font-weight: 600;
}

.tiw-result-price {
    font-size: 13px;
    font-weight: 600;
    color: #2d6a4f;
}

.tiw-result-price del {
    color: #999;
    font-weight: 400;
    font-size: 12px;
}

.tiw-result-price ins {
    text-decoration: none;
    color: #e63946;
}

/* =============================================
   NO RESULTS
   ============================================= */
.tiw-no-results {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 16px;
    color: #888;
    font-size: 14px;
}

.tiw-no-results svg {
    opacity: 0.4;
    flex-shrink: 0;
}

/* =============================================
   VIEW ALL LINK
   ============================================= */
.tiw-view-all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 500;
    color: #4361ee !important;
    text-decoration: none !important;
    border-top: 1px solid #eee;
    transition: background-color 0.15s ease;
}

.tiw-view-all:hover {
    background-color: #f0f4ff;
}

.tiw-view-all svg {
    transition: transform 0.15s ease;
}

.tiw-view-all:hover svg {
    transform: translateX(3px);
}

/* =============================================
   LOADING INDICATOR
   ============================================= */
.tiw-search-loader {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 99998;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    font-size: 13px;
    color: #888;
}

.tiw-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid #e0e0e0;
    border-top-color: #4361ee;
    border-radius: 50%;
    animation: tiw-spin 0.6s linear infinite;
}

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

/* =============================================
   TRENDING SEARCHES
   ============================================= */
.tiw-trending {
    padding: 12px 16px 8px;
}

.tiw-trending-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    margin-bottom: 8px;
}

.tiw-trending-label svg {
    color: #f59e0b;
}

.tiw-trending-list {
    display: flex;
    flex-direction: column;
}

.tiw-trending-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 8px;
    font-size: 13.5px;
    color: #333 !important;
    text-decoration: none !important;
    border-radius: 6px;
    transition: background-color 0.15s ease;
    cursor: pointer;
}

.tiw-trending-item:hover {
    background-color: #f8f9fa;
}

.tiw-trending-item svg {
    opacity: 0.3;
    flex-shrink: 0;
}

/* =============================================
   MOBILE RESPONSIVE
   ============================================= */
@media (max-width: 768px) {
    .tiw-search-dropdown {
        max-height: 380px;
        border-radius: 0 0 8px 8px;
        border: 1px solid #e0e0e0;
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    }

    .tiw-trending-list {
        max-height: 145px !important;
        overflow-y: auto !important;
    }

    .tiw-result-item {
        padding: 12px 14px;
    }

    .tiw-result-image {
        width: 48px;
        height: 48px;
    }

    .tiw-result-title {
        font-size: 13px;
    }
}

/* =============================================
   DARK MODE (Flatsome dark header)
   ============================================= */
.dark .tiw-search-dropdown,
.nav-dark .tiw-search-dropdown,
[data-theme="dark"] .tiw-search-dropdown {
    background: #1a1a2e;
    border-color: #333;
}

.dark .tiw-result-item:hover,
.nav-dark .tiw-result-item:hover,
[data-theme="dark"] .tiw-result-item:hover {
    background-color: #262640;
}

.dark .tiw-result-title,
.nav-dark .tiw-result-title,
[data-theme="dark"] .tiw-result-title {
    color: #e8e8e8;
}

.dark .tiw-trending-item,
.nav-dark .tiw-trending-item,
[data-theme="dark"] .tiw-trending-item {
    color: #ccc !important;
}
