/**
 * AP Search Bar CSS
 * Version: 1.0.0
 */

/* Base styles */
.ap-search-bar-wrapper {
    position: relative;
    display: inline-block;
    z-index: 9999;
}

.ap-search-bar {
    position: relative;
    display: inline-flex;
    align-items: center;
}

/* Search icon button */
.ap-search-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.ap-search-icon:hover {
    transform: scale(1.1);
}

.ap-search-icon svg {
    width: 24px;
    height: 24px;
}

/* Search form */
.ap-search-form {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 0;
    border: none;
    overflow: hidden;
}

/* With border radius option */
.ap-search-bar-wrapper.with-border-radius .ap-search-form {
    border-radius: 25px;
}

/* Kadence transparent header support */
.transparent-header .ap-search-bar-wrapper.transparent-mode .ap-search-form,
.mobile-transparent-header .ap-search-bar-wrapper.transparent-mode .ap-search-form {
    background: rgba(255, 255, 255, 0.95);
    border: none;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Minimal mode for transparent headers */
.transparent-header .ap-search-bar-wrapper.minimal-transparent .ap-search-form,
.mobile-transparent-header .ap-search-bar-wrapper.minimal-transparent .ap-search-form {
    background: rgba(255, 255, 255, 1);
    border: none;
}

/* Sticky header dark mode */
.item-is-fixed .ap-search-bar-wrapper.sticky-dark-mode .ap-search-form,
.item-is-stuck .ap-search-bar-wrapper.sticky-dark-mode .ap-search-form,
.kadence-sticky-header .ap-search-bar-wrapper.sticky-dark-mode .ap-search-form {
    background: #2a2a2a;
    border: none;
}

.item-is-fixed .ap-search-bar-wrapper.sticky-dark-mode .ap-search-input,
.item-is-stuck .ap-search-bar-wrapper.sticky-dark-mode .ap-search-input,
.kadence-sticky-header .ap-search-bar-wrapper.sticky-dark-mode .ap-search-input {
    color: #fff;
}

.item-is-fixed .ap-search-bar-wrapper.sticky-dark-mode .ap-search-input::placeholder,
.item-is-stuck .ap-search-bar-wrapper.sticky-dark-mode .ap-search-input::placeholder,
.kadence-sticky-header .ap-search-bar-wrapper.sticky-dark-mode .ap-search-input::placeholder {
    color: #999;
}

.item-is-fixed .ap-search-bar-wrapper.sticky-dark-mode .ap-search-icon,
.item-is-stuck .ap-search-bar-wrapper.sticky-dark-mode .ap-search-icon,
.kadence-sticky-header .ap-search-bar-wrapper.sticky-dark-mode .ap-search-icon,
.item-is-fixed .ap-search-bar-wrapper.sticky-dark-mode .ap-search-submit,
.item-is-stuck .ap-search-bar-wrapper.sticky-dark-mode .ap-search-submit,
.kadence-sticky-header .ap-search-bar-wrapper.sticky-dark-mode .ap-search-submit {
    color: #fff !important;
}

/* Override background when in sticky state */
.item-is-fixed .ap-search-bar-wrapper.transparent-mode .ap-search-form,
.item-is-stuck .ap-search-bar-wrapper.transparent-mode .ap-search-form,
.kadence-sticky-header .ap-search-bar-wrapper.transparent-mode .ap-search-form,
.item-is-fixed .ap-search-bar-wrapper.minimal-transparent .ap-search-form,
.item-is-stuck .ap-search-bar-wrapper.minimal-transparent .ap-search-form,
.kadence-sticky-header .ap-search-bar-wrapper.minimal-transparent .ap-search-form {
    background: #fff;
    border: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

/* Search input */
.ap-search-input {
    border: none;
    outline: none;
    padding: 10px 20px;
    background: transparent;
    min-width: 250px;
}

.ap-search-input:focus {
    outline: none;
}

/* Search submit button */
.ap-search-submit {
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.ap-search-submit:hover {
    opacity: 0.7;
}

/* Submit button with background */
.ap-search-submit[style*="background"] {
    margin-right: -1px;
}

.ap-search-submit svg {
    width: 20px;
    height: 20px;
}

/* Mode 1: Expandable search */
.ap-search-mode-1 .ap-search-form {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    visibility: hidden;
    width: 0;
    transition: all 0.3s ease;
}

.ap-search-mode-1.active .ap-search-form {
    opacity: 1;
    visibility: visible;
    width: 300px;
}

.ap-search-mode-1.active .ap-search-icon {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Mode 2: Full search bar */
.ap-search-mode-2 .ap-search-form {
    position: relative;
    opacity: 1;
    visibility: visible;
}

/* Responsive */
@media (max-width: 768px) {
    .ap-search-input {
        min-width: 200px;
        padding: 8px 15px;
    }
    
    .ap-search-mode-1.active .ap-search-form {
        width: 250px;
    }
}

@media (max-width: 480px) {
    .ap-search-bar-wrapper {
        width: 100%;
    }
    
    .ap-search-mode-1.active .ap-search-form {
        width: calc(100vw - 40px);
        max-width: 300px;
    }
    
    .ap-search-input {
        min-width: 150px;
    }
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    .ap-search-form {
        background: #2a2a2a;
        border: none;
    }
    
    .ap-search-input {
        color: #fff;
    }
    
    .ap-search-input::placeholder {
        color: #999;
    }
}

/* AJAX search results */
.ap-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 4px;
    border: none;
    margin-top: 5px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 10000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.ap-search-result {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
}

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

.ap-search-result a {
    text-decoration: none;
    color: #333;
    display: block;
    transition: color 0.2s ease;
}

.ap-search-result a:hover {
    color: #0073aa;
}

.ap-search-no-results {
    padding: 15px;
    text-align: center;
    color: #666;
}

/* Loading state - removed spinner */
.ap-search-loading {
    position: relative;
}

/* Header integration */
.site-header .ap-search-bar-wrapper {
    margin-left: 20px;
}

/* Widget area support */
.widget .ap-search-bar-wrapper {
    width: 100%;
}

.widget .ap-search-form {
    width: 100%;
}

.widget .ap-search-input {
    width: 100%;
    min-width: auto;
}