/* Override .text-muted for dark mode */
html[data-theme="dark"] .text-muted {
    color: #e0eafc !important;
}
html[data-theme="dark"] .search-info {
    color: #f8f9fa !important;
}
/* Lighten 'Searching in:' text in dark mode */
html[data-theme="dark"] .search-info {
    color: #e0eafc;
}
/* Ensure last result is visible above sticky footer */
/* Ensure last result is fully visible above sticky footer */
.server-search-results .search-results-container .search-result-item:last-child {
    margin-bottom: 6rem;
}
}
/* Modern Pagination Controls */
.modern-pagination {
    background: var(--pagination-bg, #f8f9fa);
    border-radius: 1.5rem;
    padding: 0.5rem 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    position: relative;
    z-index: 20;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* Ensure pagination controls are flush right */
.pagination-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    right: 20px;
    position: absolute;
    bottom: 10px;
}

.modern-btn {
    background-color: var(--pagination-btn-bg, #007ac3);
    color: var(--pagination-btn-color, #fff);
    border: none;
    border-radius: 1.5rem;
    padding: 0.4rem 1.1rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.modern-btn:disabled {
    background-color: var(--pagination-btn-disabled-bg, #e0e0e0);
    color: var(--pagination-btn-disabled-color, #aaa);
    cursor: not-allowed;
}
.modern-btn:hover:not(:disabled) {
    background-color: var(--pagination-btn-hover-bg, #005a8b);
    color: var(--pagination-btn-hover-color, #fff);
}

.modern-dropdown {
    border-radius: 1.5rem;
    border: 1px solid var(--pagination-dropdown-border, #007ac3);
    padding: 0.3rem 1rem;
    font-size: 1rem;
    background: var(--pagination-dropdown-bg, #fff);
    color: var(--pagination-dropdown-color, #007ac3);
    font-weight: 500;
    outline: none;
    transition: border 0.2s;
}
.modern-dropdown:focus {
    border-color: var(--pagination-dropdown-focus, #005a8b);
}

/* Dark Theme Support for Pagination */
html[data-theme="dark"] .modern-pagination {
    background: var(--pagination-bg-dark, #495057);
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
html[data-theme="dark"] .modern-btn {
    background-color: var(--pagination-btn-bg-dark, #17a2b8);
    color: var(--pagination-btn-color-dark, #fff);
}
html[data-theme="dark"] .modern-btn:disabled {
    background-color: var(--pagination-btn-disabled-bg-dark, #343a40);
    color: var(--pagination-btn-disabled-color-dark, #888);
}
html[data-theme="dark"] .modern-btn:hover:not(:disabled) {
    background-color: var(--pagination-btn-hover-bg-dark, #20c997);
    color: var(--pagination-btn-hover-color-dark, #fff);
}
html[data-theme="dark"] .modern-dropdown {
    background: var(--pagination-dropdown-bg-dark, #343a40);
    color: var(--pagination-dropdown-color-dark, #17a2b8);
    border-color: var(--pagination-dropdown-border-dark, #17a2b8);
}
html[data-theme="dark"] .modern-dropdown:focus {
    border-color: var(--pagination-dropdown-focus-dark, #20c997);
}
/* Server-Side Search Styling */

/* Server Search Form Styling */
.server-search-form {
    margin-top: 1rem;
    /* padding-top: 1rem; */
    /* border-top: 1px solid #e0e0e0; */
}

.server-search-label {
    margin-bottom: 0.5rem;
}

.server-search-label label {
    font-weight: 600;
    color: #007ac3;
    font-size: 0.9rem;
}

/* Search Status Styling */
.search-status {
    margin-top: 0.5rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.8rem;
    display: none;
}

.search-status.info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
    display: block;
}

.search-status.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f1b0b7;
    display: block;
}

/* Wait Message Styling */
.search-wait-msg {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
}

.search-wait-msg .spinner-border {
    width: 1rem;
    height: 1rem;
    margin-right: 0.5rem;
}

/* Server Search Results Container */
.server-search-results {
    right: 0;
    top: 0;
    width: 45%;
    height: 100vh;
    position: fixed;
    background: white;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    z-index: 1050;
    /* overflow-y: auto; */
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
}

.server-search-results[style*="block"] {
    transform: translateX(0);
}

/* Results Header Styling */
.server-search-results .search-results-header {
    background: linear-gradient(135deg, #007ac3 0%, #005a8b 100%);
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.server-search-results .search-results-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #fff !important;
    text-shadow: 0 1px 4px rgba(0,0,0,0.18);
}

.search-type-indicator .badge {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
}

/* Results Content */
.server-search-results .search-results-container {
    padding: 1rem;
}

/* Results Summary */
.results-summary {
    background-color: #f8f9fa;
    padding: 0.75rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
    border-left: 4px solid #007ac3;
}

.results-summary p {
    margin: 0;
    font-weight: 500;
}

/* Individual Result Items */
.search-result-item {
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
    background: white;
    transition: box-shadow 0.2s ease;
}

.search-result-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.result-header {
    margin-bottom: 0.75rem;
}

.result-title {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
}

.result-title a {
    color: #007ac3;
    text-decoration: none;
    font-weight: 600;
}

.result-title a:hover {
    text-decoration: underline;
    color: #005a8b;
}

/* Result Meta Information */
.result-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.product-badge,
.section-badge,
.score-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-weight: 500;
}

.product-badge {
    background-color: #007ac3;
    color: white;
}

.section-badge {
    background-color: #6c757d;
    color: white;
}

.score-badge {
    background-color: #28a745;
    color: white;
}

/* Result Content */
.result-content {
    /* color: #6c757d; */
    line-height: 1.5;
}

.result-content p {
    margin: 0;
}

/* Search Highlighting */
.search-highlight {
    background-color: #fff3cd;
    color: #856404;
    padding: 0.1rem 0.2rem;
    border-radius: 0.2rem;
    font-weight: 600;
}

/* No Results Styling */
.no-results {
    text-align: center;
    padding: 1rem;
    padding-bottom: 4.5rem; /* Restore original padding */
}
.no-results h4 {
    color: #495057;
    margin-bottom: 1rem;
}

/* Search Info */
.search-info {
    padding: 1rem;
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
    position: sticky;
    bottom: 0;
}

/* Dark Theme Support */
html[data-theme="dark"] .server-search-form {
    border-top-color: #495057;
}

html[data-theme="dark"] .server-search-label label {
    color: #17a2b8;
}

html[data-theme="dark"] .search-status.info {
    background-color: #1e3a47;
    color: #bee5eb;
    border-color: #0c5460;
}

html[data-theme="dark"] .search-wait-msg {
    background-color: #343a40;
    border-color: #495057;
    color: #f8f9fa;
}

html[data-theme="dark"] .server-search-results {
    background: #343a40;
    color: #f8f9fa;
}

html[data-theme="dark"] .search-result-item {
    background: #495057;
    border-color: #6c757d;
    color: #f8f9fa;
}

html[data-theme="dark"] .result-title a {
    color: #17a2b8;
}

html[data-theme="dark"] .result-title a:hover {
    color: #20c997;
}

html[data-theme="dark"] .results-summary {
    background-color: #495057;
    color: #f8f9fa;
}

html[data-theme="dark"] .search-info {
    background-color: #495057;
    border-top-color: #6c757d;
    color: #f8f9fa;
}

/* Responsive Design */
@media (max-width: 768px) {
    .server-search-results {
        width: 100%;
        right: 0;
    }
    
    .server-search-results .search-results-header {
        padding: 0.75rem;
    }
    
    .server-search-results .search-results-header h2 {
        font-size: 1.1rem;
    }
    
    .search-result-item {
        padding: 0.75rem;
    }
    
    .result-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
}

/* Animation for smooth slide-in */
@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

.server-search-results.show {
    animation: slideInFromRight 0.3s ease-out;
}

/* Close button styling */
.server-search-results .close-results-btn {
    color: white;
    font-size: 1.2rem;
    border: none;
    background: none;
    padding: 0.25rem;
}

.server-search-results .close-results-btn:hover {
    color: #e9ecef;
    background-color: rgba(255,255,255,0.1);
    border-radius: 0.25rem;
}

/* Enhanced input styling to differentiate from client search */
.server-search-form .form-control {
    border: 2px solid #007ac3;
    border-radius: 0.375rem;
}

.server-search-form .form-control:focus {
    border-color: #005a8b;
    box-shadow: 0 0 0 0.2rem rgba(0, 122, 195, 0.25);
}

.server-search-form .btn-primary {
    background-color: #007ac3;
    border-color: #007ac3;
}

.server-search-form .btn-primary:hover {
    background-color: #005a8b;
    border-color: #005a8b;
}