/* ==========================================================================
   BİMTES Search Modal Styles
   FIX: Resolved text jumping/layout shift caused by flex justify-content on .result-title
   FIX: Added mobile responsiveness, smooth scrollbar, and keyboard navigation styling
   ========================================================================== */

.search-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 80px;
    padding-left: 16px;
    padding-right: 16px;
    padding-bottom: 24px;
    box-sizing: border-box;
}

.search-modal.is-active {
    display: flex;
}

.search-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(13, 27, 42, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.search-container {
    position: relative;
    width: 100%;
    max-width: 780px;
    z-index: 1;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 120px);
}

.search-header {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #ffffff;
    padding: 16px 24px;
    border-radius: var(--radius, 12px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    flex-shrink: 0;
}

.search-input-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray, #64748b);
    flex-shrink: 0;
}

#search-input {
    flex-grow: 1;
    border: none;
    font-size: 1.25rem;
    font-family: inherit;
    outline: none;
    color: var(--navy, #0d1b2a);
    background: transparent;
    min-width: 0;
}

#search-input::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

#close-search {
    background: #f1f5f9;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    color: #64748b;
    line-height: 1;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

#close-search:hover {
    background: var(--red, #d61f30);
    color: #ffffff;
    transform: rotate(90deg);
}

.search-results {
    margin-top: 14px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 4px;
    /* Custom thin scrollbar */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.search-results::-webkit-scrollbar {
    width: 6px;
}

.search-results::-webkit-scrollbar-track {
    background: transparent;
}

.search-results::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.search-results::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* FIX: Search Result Item - Clean flex row with stable text layout */
.search-result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
    padding: 14px 20px;
    border-radius: var(--radius, 10px);
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    border-left: 4px solid transparent;
    gap: 14px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.search-result-item:hover,
.search-result-item.is-selected {
    background: #ffffff;
    transform: translateX(6px);
    border-left-color: var(--red, #d61f30);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.search-result-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.search-result-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}

/* FIX: .result-title is now display: inline (not flex justify-between) to prevent word splitting */
.result-title {
    font-weight: 700;
    color: var(--navy, #0d1b2a);
    font-size: 1.05rem;
    line-height: 1.35;
    display: inline;
    word-break: break-word;
}

/* FIX: .result-title mark retains inline flow without shifting layout */
.result-title mark {
    background: rgba(214, 31, 48, 0.14);
    color: var(--red, #d61f30);
    font-weight: 800;
    padding: 0 4px;
    border-radius: 4px;
    display: inline;
}

.result-desc {
    display: inline-flex;
    align-items: center;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--red, #d61f30);
    background: rgba(214, 31, 48, 0.08);
    padding: 2px 8px;
    border-radius: 6px;
    white-space: nowrap;
    line-height: 1.4;
}

.search-result-arrow {
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
}

.search-result-item:hover .search-result-arrow,
.search-result-item.is-selected .search-result-arrow {
    color: var(--red, #d61f30);
    transform: translateX(4px);
}

.search-no-results {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    padding: 24px 28px;
    border-radius: var(--radius, 10px);
    text-align: center;
    font-size: 0.95rem;
    font-weight: 500;
    border: 1px dashed rgba(255, 255, 255, 0.2);
}

/* Suggestions */
.search-suggestions-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.search-suggestions-label {
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
}

.suggestions-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.suggestion-tag {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    padding: 8px 18px;
    border-radius: 999px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.suggestion-tag:hover {
    background: #ffffff;
    color: var(--navy, #0d1b2a);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .search-modal {
        padding-top: 40px;
        padding-left: 12px;
        padding-right: 12px;
    }

    .search-header {
        padding: 12px 16px;
        gap: 10px;
    }

    #search-input {
        font-size: 1.1rem;
    }

    .search-result-item {
        padding: 12px 16px;
        gap: 10px;
    }

    .result-title {
        font-size: 0.95rem;
    }

    .result-desc {
        font-size: 0.68rem;
        padding: 2px 6px;
    }
}