/* Container */
#category-search-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: none;
}

/* Overlay */
.category-search-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(2px);
}

/* Modal */
.category-search-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.category-search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
}

.category-search-header h2 {
    margin: 0;
    font-size: 24px;
    color: #333;
}

.category-search-close {
    background: none;
    border: none;
    font-size: 32px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    line-height: 1;
    transition: color 0.3s;
}

.category-search-close:hover {
    color: #000;
}

/* Body */
.category-search-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

/* Input */
#category-search-input {
    width: 100%;
    padding: 15px;
    font-size: 18px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 20px;
    box-sizing: border-box;
    transition: border-color 0.3s;
    direction: rtl;
    text-align: right;
}

#category-search-input:focus {
    outline: none;
    border-color: #0073aa;
}

/* Results */
#category-search-results {
    min-height: 200px;
}

.search-loading {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 18px;
}

.search-message,
.search-error {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 16px;
}

.search-error {
    color: #d63638;
}

/* Results Wrapper */
.search-results-wrapper {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Category Group */
.category-group {
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 20px;
}

.category-group:last-child {
    border-bottom: none;
}

.category-title {
    margin: 0 0 15px 0;
    font-size: 20px;
    color: #0073aa;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
    direction: rtl;
    text-align: right;
}

/* Posts List */
.posts-list {
    list-style: none;
    padding: 0;
    margin: 0;
    direction: rtl;
}

.post-item {
    margin-bottom: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    transition: background-color 0.3s;
}

.post-item:hover {
    background: #e9ecef;
}

.post-link {
    display: block;
    text-decoration: none;
    color: #333;
    margin-bottom: 8px;
}

.post-title {
    font-size: 16px;
    font-weight: 600;
    display: block;
}

.post-excerpt {
    margin: 8px 0 0 0;
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    direction: rtl;
    text-align: right;
}

/* Search Button */
.category-search-button,
#open-category-search {
    padding: 10px 20px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
    direction: rtl;
}

.category-search-button:hover,
#open-category-search:hover {
    background: #005a87;
}

/* שדה חיפוש קבוע */
.category-search-field-wrapper {
    margin: 20px 0;
    direction: rtl;
    max-width: 100%;
}

.category-search-form {
    width: 100%;
}

.search-field-container {
    display: flex;
    align-items: stretch;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #e0e0e0;
    direction: rtl;
}

.category-search-field {
    flex: 1;
    padding: 12px 15px;
    font-size: 16px;
    border: none;
    border-radius: 0;
    box-sizing: border-box;
    transition: all 0.3s;
    direction: rtl;
    text-align: right;
    background: transparent;
}

.category-search-field:focus {
    outline: none;
}

.category-search-field::placeholder {
    color: #999;
}

.category-search-submit {
    padding: 12px 20px;
    background: #40e0d0;
    color: #fff;
    border: none;
    border-radius: 0;
    font-size: 18px;
    cursor: pointer;
    transition: background-color 0.3s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 50px;
    flex-shrink: 0;
}

.category-search-submit:hover {
    background: #3dd0c0;
}

.category-search-submit:active {
    background: #35c0b0;
}

.category-search-submit svg {
    width: 20px;
    height: 20px;
    stroke-width: 2.5;
}

/* תוצאות חיפוש מוצגות מתחת לשדה */
.category-search-inline-results {
    margin-top: 20px;
    display: none;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    max-height: 600px;
    overflow-y: auto;
    direction: rtl;
}

.category-search-inline-results .search-results-wrapper {
    gap: 20px;
}

.category-search-inline-results .category-group {
    padding-bottom: 15px;
}

.category-search-inline-results .category-title {
    font-size: 18px;
    margin-bottom: 12px;
}

.category-search-inline-results .post-item {
    padding: 12px;
    margin-bottom: 10px;
}

.category-search-inline-results .post-title {
    font-size: 15px;
}

/* קישור להצגת כל התוצאות */
.view-all-results {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #0073aa;
    text-align: center;
}

.view-all-link {
    display: inline-block;
    padding: 10px 20px;
    background: #0073aa;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 600;
    transition: background-color 0.3s;
}

.view-all-link:hover {
    background: #005a87;
}

/* עמוד תוצאות חיפוש */
.category-search-results-page {
    direction: rtl;
    text-align: right;
    margin: 30px 0;
}

.search-results-title {
    font-size: 28px;
    margin-bottom: 30px;
    color: #333;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

.no-results {
    text-align: center;
    padding: 40px;
    font-size: 18px;
    color: #666;
}

.category-search-results-page .search-results-wrapper {
    margin-top: 20px;
}

.category-search-results-page .category-group {
    margin-bottom: 40px;
}

.category-search-results-page .category-title {
    font-size: 22px;
    margin-bottom: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .category-search-modal {
        width: 95%;
        max-height: 95vh;
    }
    
    .category-search-header h2 {
        font-size: 20px;
    }
    
    #category-search-input {
        font-size: 16px;
    }
    
    .category-title {
        font-size: 18px;
    }
    
    .post-link {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .post-date {
        margin-top: 5px;
    }
    
    .search-field-container {
        flex-direction: row-reverse;
    }
    
    .category-search-field {
        width: 100%;
    }
    
    .category-search-submit {
        min-width: 50px;
        padding: 12px 15px;
    }
    
    .category-search-inline-results {
        max-height: 400px;
        padding: 15px;
    }
    
    .search-results-title {
        font-size: 22px;
    }
    
    .category-search-results-page .category-title {
        font-size: 18px;
    }
}

