/* Main Wrapper */
.sajax-header-search-wrapper {
    position: relative;
    display: flex;
    width: 100%;
}
.sajax-search-trigger-container {
    position: relative;
    display: flex;
    width: 100%;
}
.elementor-widget-sajax_header_search .elementor-widget-container {
    display: flex;
}

/* Body class to prevent scrolling */
body.sajax-results-open, body.sajax-popup-open {
    overflow: hidden;
}

/* Form Styling */
.sajax-header-search-form {
    display: flex;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    background-color: #fff;
    width: 100%;
}
.sajax-header-search-input {
    flex-grow: 1;
    border: none;
    padding: 10px 15px;
    font-size: 14px;
    background: transparent;
    min-width: 0;
}
.sajax-header-search-input:focus {
    outline: none;
}

/* Icon Button Styling */
.sajax-header-search-submit, .sajax-popup-trigger {
    background-color: #f7f7f7;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
}
.sajax-header-search-submit {
    padding: 0 15px;
}
.sajax-popup-trigger {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}
.sajax-search-icon {
    display: flex;
    align-items: center;
}
.sajax-search-icon i, .sajax-search-icon svg {
    font-size: 16px;
    width: 1em;
    height: 1em;
}

/* Icon Position */
.sajax-icon-align-right .sajax-search-trigger-container {
    justify-content: flex-end;
}
.sajax-icon-align-left .sajax-search-trigger-container {
    justify-content: flex-start;
}
.sajax-icon-align-right .sajax-header-search-form {
    flex-direction: row;
}
.sajax-icon-align-left .sajax-header-search-form {
    flex-direction: row-reverse;
}

/* Results Dropdown (Inline Mode) */
.sajax-inline-mode .sajax-results-container {
    position: fixed;
    top: 15vh;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    z-index: 99998;
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
    display: none;
    max-height: 70vh;
    overflow-y: auto;
    border-radius: 5px;
    padding: 20px;
    box-sizing: border-box;
}
.sajax-results-container.active {
    display: flex;
    flex-direction: column;
}

/* Results Content */
.sajax-loader-bar {
    height: 4px;
    width: 100%;
    background: #eee;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}
.sajax-loader-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 50%;
    background: #5d3dfd;
    animation: sajax-loading-bar 1.5s infinite;
}
@keyframes sajax-loading-bar {
    0% { left: -50%; }
    100% { left: 100%; }
}
.sajax-result-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #f5f5f5;
    text-decoration: none;
    color: #333;
    border-radius: 3px;
}
.sajax-result-item:last-child {
    border-bottom: none;
}
.sajax-result-item:hover {
    background-color: #f9f9f9;
}
.sajax-result-thumb {
    width: 50px;
    height: 50px;
    object-fit: cover;
    margin-right: 15px;
    flex-shrink: 0;
    border-radius: 3px;
}
.sajax-result-content h4 {
    margin: 0 0 5px;
    font-size: 15px;
    font-weight: 600;
}
.sajax-result-content p {
    margin: 0;
    font-size: 13px;
    color: #777;
}
.sajax-no-results {
    padding: 20px;
    text-align: center;
    color: #888;
}
.sajax-view-all {
    display: block;
    padding: 12px;
    text-align: center;
    background: #f7f7f7;
    color: #333;
    font-weight: 600;
    text-decoration: none;
    margin: 20px -20px -20px;
    border-top: 1px solid #eee;
}
.sajax-view-all:hover {
    background: #eee;
}

/* Popup / Modal Styles */
.sajax-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 99999;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 10vh 5%;
    opacity: 0;
    transition: opacity 0.3s ease;
    box-sizing: border-box;
}
.sajax-popup-overlay.active {
    display: flex;
    opacity: 1;
}
.sajax-popup-content {
    background: #fff;
    padding: 20px;
    border-radius: 5px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}
.sajax-popup-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #aaa;
    line-height: 1;
}
.sajax-popup-mode .sajax-results-container {
    position: static;
    box-shadow: none;
    margin-top: 15px;
    flex-grow: 1;
    overflow-y: auto;
}
.sajax-popup-mode .sajax-results-container .sajax-view-all {
    margin: 10px 0 0;
}