/* ============================================
   Search Module Styles
   ============================================ */

/* Search Module Widget */
.search-module {
    margin: 0;
    padding: 0;
}

.search-form {
    display: flex;
    width: 100%;
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    position: relative;
    max-width: 100%;
}

.search-input {
    flex: 1;
    height: 32px;
    padding: 0 16px;
    border: 2px solid var(--border-color, #dee2e6);
    border-radius: 8px 0 0 8px;
    background: var(--card-bg, #ffffff);
    color: var(--text-color, #2c3e50);
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    min-width: 0;
}

.search-input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.search-input::placeholder {
    color: var(--text-muted, #6c757d);
    opacity: 1;
}

.search-button {
    height: 32px;
    padding: 0 18px;
    border: 2px solid #6366f1;
    border-left: none;
    border-radius: 0 8px 8px 0;
    background: #6366f1;
    color: #ffffff;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.search-button:hover {
    background: #4f46e5;
    border-color: #4f46e5;
}

.search-button:active {
    background: #4338ca;
    border-color: #4338ca;
}

/* Button hidden mode - no button, rounded input */
.search-input-wrapper:not(:has(.search-button)) .search-input,
.search-input-wrapper.no-button .search-input {
    border-radius: 8px;
}

/* ============================================
   Search Results Page
   ============================================ */

.search-results-page {
    padding: 0;
}

.search-results-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color, #dee2e6);
}

.search-results-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-color, #2c3e50);
    margin-bottom: 4px;
}

.search-results-header h1 .search-query-highlight {
    color: #6366f1;
}

.search-results-header .search-results-count {
    font-size: 0.9rem;
    color: var(--text-muted, #6c757d);
    margin: 0;
}

/* Section titles */
.search-results-section {
    margin-bottom: 32px;
}

.search-results-section-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-color, #2c3e50);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #6366f1;
    display: inline-block;
}

.search-results-section-title .result-count {
    font-weight: 400;
    color: var(--text-muted, #6c757d);
    font-size: 0.9rem;
    margin-left: 6px;
}

/* Individual result item */
.search-result-item {
    display: block !important;
    padding: 16px 20px;
    margin-bottom: 12px;
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 8px;
    background: var(--card-bg, #ffffff);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.search-result-item:hover {
    border-color: #6366f1;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.1);
}

.search-result-title {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    color: #6366f1;
    text-decoration: none;
    margin-bottom: 6px;
    line-height: 1.4;
}

.search-result-title:hover {
    color: #4f46e5;
    text-decoration: underline;
}

.search-result-excerpt {
    font-size: 0.9rem;
    color: var(--text-muted, #6c757d);
    margin-bottom: 8px;
    line-height: 1.5;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* No results */
.search-no-results {
    text-align: center;
    padding: 48px 20px;
}

.search-no-results-icon {
    font-size: 3rem;
    color: var(--text-muted, #6c757d);
    margin-bottom: 16px;
    opacity: 0.5;
}

.search-no-results h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color, #2c3e50);
    margin-bottom: 8px;
}

.search-no-results p {
    color: var(--text-muted, #6c757d);
    font-size: 0.95rem;
    margin-bottom: 0;
}

.search-no-results .search-query-highlight {
    color: #6366f1;
    font-weight: 600;
}

/* Min chars warning */
.search-min-chars {
    text-align: center;
    padding: 32px 20px;
    color: var(--text-muted, #6c757d);
}

.search-min-chars i {
    font-size: 2rem;
    margin-bottom: 12px;
    display: block;
    opacity: 0.5;
}

/* Highlight matched text */
.search-highlight {
    background: rgba(99, 102, 241, 0.2);
    color: inherit;
    padding: 0 2px;
    border-radius: 2px;
}

/* ============================================
   RTL (Right-to-Left) Support
   ============================================ */

html[dir="rtl"] .search-input {
    border-radius: 0 8px 8px 0;
    text-align: right;
}

html[dir="rtl"] .search-button {
    border-left: 2px solid #6366f1;
    border-right: none;
    border-radius: 8px 0 0 8px;
}

html[dir="rtl"] .search-input-wrapper:not(:has(.search-button)) .search-input,
html[dir="rtl"] .search-input-wrapper.no-button .search-input {
    border-radius: 8px;
}

html[dir="rtl"] .search-results-section-title .result-count {
    margin-left: 0;
    margin-right: 6px;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 576px) {
    .search-input {
        height: 38px;
        font-size: 14px;
        padding: 0 12px;
    }

    .search-button {
        height: 38px;
        padding: 0 14px;
        font-size: 14px;
    }

    .search-results-header h1 {
        font-size: 1.25rem;
    }

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

    .search-result-title {
        font-size: 1rem;
    }

    .search-no-results {
        padding: 32px 16px;
    }
}
