/**
 * AJAX Product Filters - Search Box Styles
 * Modern, clean search input next to title
 */

/* Title wrapper with search - COMPACT */
.apf-title-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.apf-page-title {
    margin: 0;
    flex: 0 1 auto;
}

/* Search wrapper */
.apf-search-wrapper {
    position: relative;
    max-width: 350px;
    min-width: 200px;
}

/* Search input - COMPACT with magnifier icon INSIDE on LEFT */
.apf-search-wrapper .search-field {
    width: 100%;
    padding: 10px 15px 10px 38px !important;
    background-color: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.09);
    border-radius: 99px;
    box-shadow: none !important;
    color: currentColor;
    font-size: 14px;
    line-height: 1.5;
    height: 40px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.apf-search-wrapper .search-field:focus {
    outline: none;
    background-color: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.18);
    box-shadow: 0 0 0 2px rgba(6, 147, 227, 0.2);
}

.apf-search-wrapper .search-field::placeholder {
    opacity: 1;
    color: rgba(0, 0, 0, 0.45);
}

/* Magnifier icon - INSIDE search bar on LEFT */
.apf-search-wrapper::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 12px;
    width: 16px;
    height: 16px;
    pointer-events: none;
    transform: translateY(-50%);
    background-repeat: no-repeat;
    background-size: 16px 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' stroke='%2380BEF3' stroke-width='2.5' fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='16.65' y1='16.65' x2='21' y2='21'/%3E%3C/svg%3E");
    z-index: 1;
}

/* Keep magnifier visible always */
.apf-search-wrapper.has-content::before {
    opacity: 1;
}

/* Search clear button */
.apf-search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: #999;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    color: #fff;
    font-size: 18px;
    line-height: 1;
}

.apf-search-clear {
    display: none !important;
}

.apf-search-clear:hover {
    background: #666;
    transform: translateY(-50%) scale(1.1);
}

.apf-search-clear span {
    display: block;
    line-height: 1;
}

/* Show clear button when search has content */
.apf-search-wrapper.has-content .apf-search-clear,
.apf-search-clear:not([style*="display: none"]) {
    display: flex;
}

/* Mobile responsive - CONSISTENT 12px SPACING */
@media (max-width: 768px) {
    .apf-title-wrapper {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-bottom: 0;
    }
    
    .apf-search-wrapper {
        max-width: 100%;
        min-width: 100%;
        position: relative;
        margin-bottom: 12px;
    }
    
    .apf-search-wrapper .search-field {
        height: 40px;
        font-size: 14px;
        padding: 10px 15px 10px 40px !important;
    }
    
    .apf-search-wrapper::before {
        position: absolute !important;
        top: 50% !important;
        left: 13px !important;
        width: 16px !important;
        height: 16px !important;
        transform: translateY(-50%) !important;
        background-size: 16px 16px !important;
    }
    
    .apf-page-title {
        text-align: center;
        font-size: 17px;
        margin: 0 0 12px 0;
        padding: 0;
    }
}

@media (max-width: 480px) {
    .apf-title-wrapper {
        gap: 12px;
        margin-bottom: 0;
    }
    
    .apf-search-wrapper {
        margin-bottom: 12px;
    }
    
    .apf-search-wrapper .search-field {
        font-size: 13px;
        padding: 9px 15px 9px 38px !important;
        height: 38px;
    }
    
    .apf-search-wrapper::before {
        position: absolute !important;
        left: 12px !important;
        width: 15px !important;
        height: 15px !important;
        background-size: 15px 15px !important;
    }
    
    .apf-search-clear {
        width: 18px;
        height: 18px;
        font-size: 12px;
        right: 9px;
    }
    
    .apf-page-title {
        font-size: 15px;
        margin: 0 0 12px 0;
    }
}

/* Loading state */
.apf-search-input.loading {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20"><circle cx="10" cy="10" r="8" fill="none" stroke="%230693e3" stroke-width="2" stroke-dasharray="12 8" transform="rotate(0 10 10)"><animateTransform attributeName="transform" type="rotate" from="0 10 10" to="360 10 10" dur="1s" repeatCount="indefinite"/></circle></svg>');
    background-repeat: no-repeat;
    background-position: right 45px center;
    background-size: 18px 18px;
}

/* Dark theme support (if needed) */
@media (prefers-color-scheme: dark) {
    .apf-search-input {
        background: #2a2a2a;
        color: #fff;
        border-color: #444;
    }
    
    .apf-search-input::placeholder {
        color: #888;
    }
    
    .apf-search-input:focus {
        border-color: #0693e3;
        background: #333;
    }
}

/* Brand Quick Search Links - Clean minimal style */
.apf-brand-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    padding: 12px 0 8px;
    font-size: 13px;
}

.apf-brand-label {
    font-size: 12px;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-right: 4px;
}

.apf-brand-list {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

.apf-brand-link {
    font-size: 13px;
    font-weight: 500;
    color: #666;
    text-decoration: none;
    transition: all 0.2s ease;
    padding: 2px 0;
    position: relative;
}

.apf-brand-link:hover {
    color: #0693e3;
}

.apf-brand-link.active {
    color: #0693e3;
    font-weight: 600;
}

.apf-brand-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: #0693e3;
}

.apf-brand-separator {
    color: #ddd;
    font-size: 12px;
    margin: 0 2px;
    user-select: none;
}

/* Mobile responsive for brand links */
@media (max-width: 768px) {
    .apf-brand-links {
        justify-content: center;
        text-align: center;
    }
    
    .apf-brand-label {
        width: 100%;
        text-align: center;
        margin-bottom: 6px;
    }
    
    .apf-brand-list {
        justify-content: center;
    }
    
    .apf-brand-link {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .apf-brand-link {
        font-size: 11px;
    }
    
    .apf-brand-separator {
        font-size: 10px;
    }
}

/* Animation for search results */
@keyframes searchPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.apf-search-active #apf-products-container {
    animation: searchPulse 0.3s ease-in-out;
}

/* Smooth transition when brand links appear */
.apf-brand-links {
    animation: fadeInDown 0.3s ease-out;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Search icon (optional - can be added with ::before pseudo-element) */
.apf-search-input:not(:focus):not(:placeholder-shown) {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="%23999"><path d="M11.7 10.3l3.6 3.6c.4.4.4 1 0 1.4-.4.4-1 .4-1.4 0l-3.6-3.6c-1 .8-2.2 1.3-3.6 1.3-3.3 0-6-2.7-6-6s2.7-6 6-6 6 2.7 6 6c0 1.4-.5 2.6-1.3 3.6zM6.7 2c-2.6 0-4.7 2.1-4.7 4.7s2.1 4.7 4.7 4.7 4.7-2.1 4.7-4.7S9.3 2 6.7 2z"/></svg>');
    background-repeat: no-repeat;
    background-position: 18px center;
    background-size: 16px 16px;
    padding-left: 45px;
}

