﻿.search-button {
    display: flex;
    align-items: center;
    background: var(--primary-color);
    border: 0;
    border-radius: 20px;
    padding: 5px 5px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 13px;
    gap: 8px;
    justify-content: space-between;
}

.search-button:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}

.search-button-text {
    flex: 1;
    text-align: left;
    opacity: 0.8;
}

.search-button-icon {
    font-size: 16px;
    opacity: 0.9;
    order: -1;
}

@media (max-width: 1124px) {
    .search-button {
        background: rgba(0, 0, 0, 0.05);
        border: 1px solid rgba(0, 0, 0, 0.1);
        color: #666;
        border-radius: 25px;
        padding: 12px 16px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
        justify-content: center;
        gap: 10px;
    }

    .search-button:hover {
        background: #f8f9fa;
        border-color: #ccc;
    }

    .search-button-text {
        opacity: 1;
        color: #999;
        text-align: left;
        font-weight: normal;
    }

    .search-button-icon {
        opacity: 1;
        color: #666;
        order: -1;
        font-size: 18px;
    }
}

.search-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.search-popup-overlay.active {
    display: flex;
    opacity: 1;
}

.search-popup {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 90%;
    height: 500px;
    max-width: 1200px;
    max-height: 90vh;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.search-popup-overlay.active .search-popup {
    transform: scale(1) translateY(0);
}

@media (max-width: 1124px) {
    .search-popup {
        width: 100vw;
        height: 100vh;
        max-width: none;
        max-height: none;
        border-radius: 0;
        transform: translateY(100%);
    }

    .search-popup-overlay.active .search-popup {
        transform: translateY(0);
    }
}

.search-popup-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8f9fa;
    flex-shrink: 0;
}

.search-popup-title {
    font-size: 18px;
    font-weight: var(--font-weight-semibold);
    color: #2c3e50;
    margin: 0;
}

.search-popup-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #6c757d;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: all 0.2s ease;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-popup-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #495057;
}

.search-popup-content {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

@media (max-width: 1124px) {
    .search-popup-content {
        max-height: calc(100vh - 80px);
        padding: 20px;
    }
}

.search-input-section {
    margin-bottom: 24px;
}

.search-input-container {
    position: relative;
    margin-bottom: 16px;
}

.search-popup-input {
    width: 100%;
    padding: 16px 50px 16px 20px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 16px;
    outline: none;
    transition: all 0.3s ease;
    background: white;
}

.search-popup-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(23, 52, 112, 0.1);
}

.search-popup-input::placeholder {
    color: #6c757d;
}

.search-input-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    font-size: 18px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.search-input-icon:hover {
    color: var(--primary-color);
}

.search-filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.search-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    color: #495057;
}

.search-filter:hover {
    border-color: var(--primary-color);
    background: rgba(23, 52, 112, 0.05);
}

.search-filter.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.search-filter-icon {
    font-size: 16px;
}

.date-filter-dropdown {
    position: relative;
}

.date-filter-content {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 16px;
    min-width: 280px;
    z-index: 1000;
    display: none;
}

.date-filter-dropdown.active .date-filter-content {
    display: block;
}

.date-input-group {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.date-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    font-size: 14px;
}

.date-filter-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.date-filter-btn {
    padding: 6px 12px;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.date-filter-btn.primary {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.date-filter-btn:hover {
    background: #f8f9fa;
}

.date-filter-btn.primary:hover {
    background: #0f2654;
}

.department-filter-dropdown {
    position: relative;
}

.department-filter-content {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-width: 300px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.department-filter-dropdown.active .department-filter-content {
    display: block;
}

.department-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid #f8f9fa;
    color: var(--primary-color);
}

.department-option:hover {
    background: #f8f9fa;
}

.department-option:last-child {
    border-bottom: none;
}

.department-option.selected {
    background: rgba(23, 52, 112, 0.1);
    color: var(--primary-color);
    }

.department-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.department-name {
    flex: 1;
    font-size: 14px;
}

.department-count {
    font-size: 12px;
    color: #6c757d;
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 10px;
}

.popular-topics-section {
    margin-bottom: 24px;
}

.popular-topics-title {
    font-size: 16px;
    font-weight: var(--font-weight-semibold);
    color: #2c3e50;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.popular-topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

@media (max-width: 1124px) {
    .popular-topics-grid {
        grid-template-columns: 1fr;
    }
}

.popular-topic-item {
    padding: 12px 16px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    font-size: 14px;
    color: #495057;
}

.popular-topic-item:hover {
    border-color: var(--primary-color);
    background: rgba(23, 52, 112, 0.05);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.search-results-section {
    display: none;
}

.search-results-section.active {
    display: block;
}

.search-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e9ecef;
}

.search-results-info {
    font-size: 14px;
    color: #6c757d;
}

.search-results-sort {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.sort-select {
    padding: 4px 8px;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    font-size: 12px;
}

.search-result-item {
    padding: 16px 0;
    border-bottom: 1px solid #f8f9fa;
}

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

.search-result-title {
    font-size: 16px;
    font-weight: var(--font-weight-semibold);
    color: var(--primary-color);
    text-decoration: none;
    margin-bottom: 8px;
    display: block;
    line-height: 1.4;
}

.search-result-title:hover {
    text-decoration: underline;
}

.search-result-snippet {
    font-size: 14px;
    color: #495057;
    line-height: 1.5;
    margin-bottom: 8px;
}

.search-result-snippet mark {
    background: #fff3cd;
    padding: 1px 2px;
    border-radius: 2px;
}

.search-result-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: #6c757d;
}

.search-result-date,
.search-result-department {
    display: flex;
    align-items: center;
    gap: 4px;
}

.search-loading {
    display: none;
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.search-loading.active {
    display: block;
}

.search-loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.search-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
    display: none;
}

.search-empty-state.active {
    display: block;
}

.search-empty-icon {
    font-size: 48px;
    color: #e9ecef;
    margin-bottom: 16px;
}

.search-error-state {
    text-align: center;
    padding: 40px 20px;
    color: #dc3545;
    display: none;
}

.search-error-state.active {
    display: block;
}

.search-error-icon {
    font-size: 48px;
    color: #dc3545;
    margin-bottom: 16px;
}

.retry-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    margin-top: 16px;
    transition: background 0.2s ease;
}

.retry-btn:hover {
    background: #0f2654;
}

.search-user-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 16px;
    max-width: 300px;
    z-index: 10000;
    display: none;
}

.search-user-message.active {
    display: block;
}

.search-user-message.info {
    border-left: 4px solid #17a2b8;
}

.search-user-message.warning {
    border-left: 4px solid #ffc107;
}

.search-user-message.error {
    border-left: 4px solid #dc3545;
}

.message-content {
    font-size: 14px;
    color: #495057;
    margin-bottom: 8px;
}

.message-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    font-size: 18px;
    color: #6c757d;
    cursor: pointer;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.message-close:hover {
    color: #495057;
}

.search-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #e9ecef;
}

.pagination-btn {
    padding: 8px 12px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    text-decoration: none;
    color: #495057;
}

.pagination-btn:hover {
    background: #f8f9fa;
    border-color: var(--primary-color);
}

.pagination-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.search-input-button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: var(--font-weight-medium);
    transition: all 0.3s ease;
}

.search-input-button:hover {
    background: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}
.search-input-button:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}
.date-input-label {
    color: var(--primary-color);
}
.label {
    color: var(--primary-color);
}

[dir="rtl"] .search-button-text {
    text-align: right;
}

[dir="rtl"] .date-filter-content,
[dir="rtl"] .department-filter-content {
    left: auto;
    right: 0;
}

@media (max-width: 1124px) {
    [dir="rtl"] .search-button {
        justify-content: flex-end;
    }

    [dir="rtl"] .search-button-text {
        text-align: right;
    }
}

@media (max-width: 480px) {
    .search-popup-content {
        padding: 16px;
    }

    .search-filters {
        gap: 8px;
    }

    .search-filter {
        padding: 6px 12px;
        font-size: 13px;
    }

    .popular-topics-grid {
        gap: 8px;
    }

    .popular-topic-item {
        padding: 10px 12px;
        font-size: 13px;
    }

    .search-user-message {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }

    .search-button {
        padding: 10px 14px;
        font-size: 14px;
    }

    .search-button-icon {
        font-size: 16px;
    }
}

.search-popup-input:focus,
.search-filter:focus,
.popular-topic-item:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.search-popup-overlay {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}
