/**
 * Enhanced Header Search Styles
 * Perfect autocomplete results with beautiful UI
 */

/* Autocomplete Results Container */
.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    max-height: 500px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    margin-top: -1px;
}

.autocomplete-results.show,
.autocomplete-results:not(:empty) {
    display: block;
}

/* Loading State */
.autocomplete-loading {
    padding: 20px;
    text-align: center;
    color: #666;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.15em;
}

.text-orange {
    color: #ff5a00 !important;
}

/* Group Label */
.autocomplete-group-label {
    padding: 12px 20px 8px;
    font-size: 12px;
    font-weight: 700;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.autocomplete-group-label:first-child {
    border-top: none;
}

.autocomplete-group-label i {
    font-size: 14px;
}

/* Autocomplete Item */
.autocomplete-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 20px;
    text-decoration: none;
    color: #333;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
}

.autocomplete-item:last-of-type {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background: #f8f9fa;
    padding-left: 25px;
}

.autocomplete-item.active {
    background: #fff5f0;
    border-left: 3px solid #ff5a00;
}

/* Icon */
.ac-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
}

/* Content */
.ac-content {
    flex: 1;
    min-width: 0;
}

.ac-title {
    font-size: 15px;
    font-weight: 600;
    color: #002147;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ac-title mark {
    background: #fff3cd;
    color: #ff5a00;
    font-weight: 700;
    padding: 2px 4px;
    border-radius: 3px;
}

.ac-subtitle {
    font-size: 13px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Arrow */
.ac-arrow {
    color: #ccc;
    font-size: 16px;
    transition: all 0.2s ease;
}

.autocomplete-item:hover .ac-arrow,
.autocomplete-item.active .ac-arrow {
    color: #ff5a00;
    transform: translateX(3px);
}

/* View All Link */
.autocomplete-view-all {
    display: block;
    padding: 15px 20px;
    text-align: center;
    background: linear-gradient(135deg, #ff5a00, #ff7a30);
    color: white;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    border-radius: 0 0 12px 12px;
    transition: all 0.3s ease;
}

.autocomplete-view-all:hover {
    background: linear-gradient(135deg, #ff7a30, #ff5a00);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 90, 0, 0.3);
}

.autocomplete-view-all i {
    transition: transform 0.3s ease;
}

.autocomplete-view-all:hover i {
    transform: translateX(3px);
}

/* No Results */
.autocomplete-no-results {
    padding: 40px 20px;
    text-align: center;
    color: #666;
}

.autocomplete-no-results i {
    display: block;
    margin-bottom: 15px;
    opacity: 0.5;
}

.autocomplete-no-results p {
    margin: 0;
    line-height: 1.6;
}

.autocomplete-no-results strong {
    color: #002147;
}

/* Error State */
.autocomplete-error {
    padding: 20px;
    text-align: center;
    color: #dc3545;
    font-size: 14px;
}

.autocomplete-error i {
    margin-right: 8px;
}

/* Scrollbar */
.autocomplete-results::-webkit-scrollbar {
    width: 8px;
}

.autocomplete-results::-webkit-scrollbar-track {
    background: #f0f0f0;
}

.autocomplete-results::-webkit-scrollbar-thumb {
    background: #ff5a00;
    border-radius: 4px;
}

.autocomplete-results::-webkit-scrollbar-thumb:hover {
    background: #e55000;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .autocomplete-results {
        max-height: 400px;
        border-radius: 0 0 8px 8px;
    }

    .autocomplete-item {
        padding: 10px 15px;
    }

    .autocomplete-item:hover,
    .autocomplete-item.active {
        padding-left: 20px;
    }

    .ac-icon {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }

    .ac-title {
        font-size: 14px;
    }

    .ac-subtitle {
        font-size: 12px;
    }

    .autocomplete-group-label {
        padding: 10px 15px 6px;
        font-size: 11px;
    }

    .autocomplete-view-all {
        padding: 12px 15px;
        font-size: 13px;
    }
}

/* Animation */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.autocomplete-results.show {
    animation: slideDown 0.2s ease;
}
