/* Advanced Search Pro Styles */

.advanced-search-wrapper {
    max-width: 100%;
    margin: 20px auto;
    padding: 0 10px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Form tìm kiếm chính */
.advanced-search-form {
    position: relative;
    margin-bottom: 30px;
}

.search-input-wrapper {
    display: flex;
    align-items: stretch; /* Căn chỉnh theo chiều cao */
    max-width: 100%;
    margin: 0 auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    overflow: hidden;
    background: white;
    border: 1px solid #ddd;
    transition: all 0.3s ease;
}

.search-input-wrapper:focus-within {
    border-color: #0073aa;
    box-shadow: 0 2px 12px rgba(0, 115, 170, 0.2);
}

.advanced-search-input {
    flex: 1;
    padding: 12px 15px;
    border: none;
    font-size: 16px;
    outline: none;
    background: transparent;
    color: #333;
    line-height: 1.4;
    vertical-align: top;
}

.advanced-search-input::placeholder {
    color: #999;
}

.advanced-search-button {
    padding: 12px 20px;
    background: #0073aa;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
    min-width: 100px;
    line-height: 1.4;
    vertical-align: top;
    align-self: stretch; /* Căn chỉnh theo container */
}

.advanced-search-button:hover {
    background: #e1e1e1;
}

.advanced-search-button:active {
    background: #e0e0e0;
}

.advanced-search-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Suggestions dropdown */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
    margin-top: 1px;
}

.suggestions-header {
    padding: 10px 15px;
    background: #f8f9fa;
    font-weight: 600;
    color: #666;
    font-size: 13px;
    border-bottom: 1px solid #e0e0e0;
}

.suggestions-list {
    max-height: 350px;
    overflow-y: auto;
}

.suggestion-item {
    display: flex;
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: all 0.2s ease;
    align-items: flex-start;
}

.suggestion-item:hover,
.suggestion-item.active {
    background: #f8f9fa;
    border-left: 3px solid #0073aa;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-rank {
    width: 24px;
    height: 24px;
    background: #0073aa;
    color: white;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 12px;
    margin-right: 12px;
    flex-shrink: 0;
}

.suggestion-content {
    flex: 1;
    min-width: 0;
}

.suggestion-title {
    font-weight: 600;
    color: #1a0dab;
    margin-bottom: 4px;
    font-size: 15px;
    line-height: 1.3;
}

.suggestion-excerpt {
    color: #666;
    font-size: 13px;
    line-height: 1.4;
    margin-bottom: 6px;
}

.suggestion-meta {
    display: flex;
    gap: 12px;
    font-size: 11px;
    color: #999;
}

.suggestion-type {
    background: #e3f2fd;
    color: #1976d2;
    padding: 1px 6px;
    border-radius: 8px;
    font-weight: 500;
}

.suggestion-score {
    color: #4caf50;
    font-weight: 500;
}

.suggestions-footer {
    padding: 10px 15px;
    background: #f8f9fa;
    text-align: center;
    font-size: 12px;
    color: #666;
    border-top: 1px solid #e0e0e0;
}

.search-loading, .no-suggestions, .search-error {
    padding: 15px;
    text-align: center;
    color: #666;
    font-style: italic;
    font-size: 14px;
}

.search-error {
    color: #f44336;
}

/* Highlight trong suggestions */
.suggestion-item mark {
    background: #ffeb3b;
    color: #333;
    padding: 1px 2px;
    border-radius: 2px;
    font-weight: 600;
}

/* Kết quả tìm kiếm */
.results-header {
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.results-header h2 {
    color: #333;
    font-size: 20px;
    margin: 0 0 6px 0;
    font-weight: 600;
}

.results-header p {
    color: #666;
    margin: 0;
    font-size: 13px;
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.search-result-item {
    padding: 15px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.search-result-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-color: #0073aa;
}

.result-rank {
    display: none; /* Ẩn số thứ tự tròn */
}

.result-content {
    width: 100%;
}

.result-title {
    margin: 0 0 8px 0;
    font-size: 18px;
    line-height: 1.3;
    position: relative;
}

.result-title::before {
    content: counter(result-counter) ". ";
    counter-increment: result-counter;
    color: #666;
    font-weight: normal;
    font-size: 16px;
}

.results-list {
    counter-reset: result-counter;
}

.result-title a {
    text-decoration: none;
    color: #1a0dab;
    transition: color 0.2s ease;
}

.result-title a:hover {
    color: #0073aa;
    text-decoration: underline;
}

.result-excerpt {
    color: #555;
    line-height: 1.5;
    margin-bottom: 8px;
    font-size: 14px;
}

.result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 12px;
    color: #777;
    align-items: center;
}

.result-url {
    color: #4caf50;
    text-decoration: none;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.relevance-score {
    background: #e8f5e8;
    color: #2e7d32;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
    font-size: 11px;
}

/* Highlight trong kết quả */
.highlight {
    background: #ffeb3b;
    color: #333;
    padding: 1px 2px;
    border-radius: 2px;
    font-weight: 600;
}

/* Không có kết quả */
.no-results {
    text-align: center;
    padding: 40px 20px;
    background: white;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.no-results h2 {
    color: #333;
    margin-bottom: 12px;
    font-size: 20px;
}

.no-results p {
    color: #666;
    margin-bottom: 15px;
    font-size: 15px;
}

.search-tips {
    text-align: left;
    max-width: 400px;
    margin: 0 auto;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    border-left: 3px solid #0073aa;
}

.search-tips ul {
    margin: 8px 0 0 0;
    padding-left: 18px;
}

.search-tips li {
    margin-bottom: 4px;
    color: #555;
    font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    .advanced-search-wrapper {
        padding: 0 5px;
    }
    
    .search-input-wrapper {
        flex-direction: row; /* Giữ ngang trên mobile */
        border-radius: 4px;
    }
    
    .advanced-search-input {
        padding: 10px 12px;
        font-size: 16px;
        height: 44px;
    }
    
    .advanced-search-button {
        padding: 10px 15px;
        font-size: 15px;
        min-width: 80px;
        height: 44px;
    }
    
    .search-suggestions {
        left: 5px;
        right: 5px;
    }
    
    .search-result-item {
        padding: 12px;
        margin: 0 -5px;
    }
    
    .result-title {
        font-size: 16px;
    }
    
    .result-excerpt {
        font-size: 13px;
    }
    
    .result-meta {
        flex-direction: column;
        gap: 6px;
        align-items: flex-start;
    }
    
    .results-header h2 {
        font-size: 18px;
    }
    
    .results-header p {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .advanced-search-wrapper {
        padding: 0 2px;
    }
    
    .search-result-item {
        margin: 0 -2px;
        padding: 10px;
    }
    
    .result-title {
        font-size: 15px;
    }
    
    .result-excerpt {
        font-size: 12px;
    }
    
    .advanced-search-input {
        padding: 8px 10px;
        height: 40px;
    }
    
    .advanced-search-button {
        padding: 8px 12px;
        font-size: 14px;
        min-width: 70px;
        height: 40px;
    }
}

/* Animation khi load */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-result-item {
    animation: fadeInUp 0.3s ease-out;
}

.search-result-item:nth-child(1) { animation-delay: 0.05s; }
.search-result-item:nth-child(2) { animation-delay: 0.1s; }
.search-result-item:nth-child(3) { animation-delay: 0.15s; }
.search-result-item:nth-child(4) { animation-delay: 0.2s; }
.search-result-item:nth-child(5) { animation-delay: 0.25s; }

/* Scrollbar tùy chỉnh */
.search-suggestions::-webkit-scrollbar,
.suggestions-list::-webkit-scrollbar {
    width: 4px;
}

.search-suggestions::-webkit-scrollbar-track,
.suggestions-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.search-suggestions::-webkit-scrollbar-thumb,
.suggestions-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

.search-suggestions::-webkit-scrollbar-thumb:hover,
.suggestions-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}