/* Search functionality styles */

/* ---------- Search ---------- */
.search-container {
    margin: 4px 0 0px 0;
    padding: 0 4px;
}

.search-box {
    width: 100%;
    padding: 6px 5px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 14px;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.search-box:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.1);
}

.search-results {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    bottom: 0;
    background: var(--bg-color);
    z-index: 1000;
    max-width: var(--content-max-width);
    width: calc(100% - var(--sidebar-width));
    padding: 32px 48px;
    overflow-y: auto;
    display: none;
    animation: slideIn 0.2s ease;
    box-sizing: border-box;
}

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

.search-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.search-results-title {
    font-size: 20px;
    font-weight: 600;
    flex: 1;
    text-align: center;
    padding: 0 40px;
}

.search-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-close {
    padding: 8px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-color);
    border-radius: 4px;
    transition: all 0.2s ease;
}

/* For RTL languages, position close button on the left */
[dir="rtl"] .search-close {
    right: auto;
    left: 0;
}

.search-close svg,
.return-to-search svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.search-close:hover,
.return-to-search:hover {
    background: var(--hover-bg);
}

.search-result-item {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

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

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

.search-result-path {
    font-size: 12px;
    color: var(--breadcrumb-color);
    margin-bottom: 8px;
    word-break: break-all;
}

.search-result-excerpt {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-color);
    word-wrap: break-word;
}

.search-result-highlight {
    background: #DB983E;
    color: #000000;
    padding: 1px 4px;
    margin: 0 2px;
    border-radius: 3px;
    font-weight: 500;
    display: inline-block;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Mobile search results */
@media (max-width: 950px) {
    .search-results {
        left: 0;
        padding: 16px;
        padding-top: 60px;
        width: 100%;
    }

    .search-results-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        background: var(--bg-color);
        padding: 16px;
        z-index: 1001;
        height: 48px;
        box-sizing: border-box;
        margin-bottom: 0;
    }

    .search-result-item {
        padding-bottom: 16px;
        margin-bottom: 16px;
    }

    .search-result-title {
        font-size: 16px;
        line-height: 1.5;
    }

    .search-result-excerpt {
        line-height: 1.5;
    }

    .search-result-highlight {
        padding: 2px 4px;
        margin: 0 1px;
    }
}