/* Custom Search Widget Styles */
/* Save as: assets/css/custom-search-widget.css */

.custom-search-widget {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

/* Remove hardcoded styles that should be controlled by Elementor */
.custom-search-container {
    /* Background, padding, border-radius now controlled by Elementor */
    position: relative;
    transition: padding 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                box-shadow 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow: hidden;
    /* Enable hardware acceleration to prevent layout shifts */
    transform: translateZ(0);
    backface-visibility: hidden;
    will-change: padding, transform;
}

/* Keep the overlay pattern but make it optional */
.custom-search-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="75" cy="75" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="50" cy="10" r="0.5" fill="rgba(255,255,255,0.05)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
    pointer-events: none;
}

.no-results-found {
    max-width: 990px;
    padding: 0 20px;
    margin: 0 auto;
}

/* Default fallback styles */
.custom-search-container:not([style*="background"]) {
    background: linear-gradient(135deg, #E53E3E 0%, #C53030 100%);
}

.custom-search-container:not([style*="padding"]) {
    padding: 40px;
}

.custom-search-container.expanded:not([style*="padding"]) {
    padding: 50px 40px;
}

.custom-search-container:not([style*="border-radius"]) {
    border-radius: 20px;
}

.custom-search-field {
    position: relative;
    display: flex;
    align-items: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
    /* Hardware acceleration */
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Default fallback styles */
.custom-search-field:not([style*="background"]) {
    background: white;
}

.custom-search-field:not([style*="border-radius"]) {
    border-radius: 50px;
}

.custom-search-field:hover {
    transform: translateY(-2px);
}

.custom-search-field.focused {
    transform: translateY(-3px);
}

.custom-search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    font-weight: 400;
    background: transparent;
    transition: all 0.3s ease;
}

/* Default fallback styles */
.custom-search-input:not([style*="padding"]) {
    padding: 20px 25px;
}

.custom-search-input:not([style*="border-radius"]) {
    border-radius: 50px;
}

.custom-search-input:not([style*="color"]) {
    color: #333;
    border: none;
}

.custom-search-input::placeholder {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.custom-search-input:not([style*="color"])::placeholder {
    color: #999;
}

.custom-search-input:focus::placeholder {
    opacity: 0.6;
}

.custom-search-button {
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-right: 0;
    transition: all 0.3s ease;
}

/* Default fallback styles */
.custom-search-button:not([style*="background"]) {
    background: #E53E3E;
}

.custom-search-button:not([style*="color"]) {
    color: white;
}

.custom-search-button:not([style*="width"]):not([style*="height"]) {
    width: 50px;
    height: 50px;
}

.custom-search-button:not([style*="border-radius"]) {
    border-radius: 50%;
}

.custom-search-button:hover {
    transform: scale(1.05);
}

.custom-search-button:not([style*="background"]):hover {
    background: #C53030;
}

.custom-search-button:active {
    transform: scale(0.95);
}

.suggestions-container {
    margin-top: 25px;
    opacity: 0;
    transform: translateY(15px) translateZ(0);
    transition: opacity 0.3s ease,
                transform 0.3s ease,
                max-height 0.3s ease,
                visibility 0.3s ease;
    pointer-events: none;
    visibility: hidden;
    max-height: 0;
    overflow: hidden;
    /* Hardware acceleration to prevent layout shift */
    backface-visibility: hidden;
    will-change: opacity, transform, max-height;
}

.custom-search-container.expanded .suggestions-container {
    opacity: 1;
    transform: translateY(0) translateZ(0);
    pointer-events: auto;
    visibility: visible;
    max-height: 300px;
}

.suggestions-container-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.suggestion-item {
    display: inline-block;
    vertical-align: top;
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    line-height: 24px;
    border-bottom-style: solid;
    transition: padding 0.3s ease, transform 0.3s ease, color 0.3s ease;
    position: relative;
    /* Hardware acceleration */
    transform: translateZ(0);
    backface-visibility: hidden;
    /* overflow: hidden; */
}

/* Default fallback styles */
.suggestion-item:not([style*="color"]) {
    color: white;
}

.suggestion-item:not([style*="padding"]) {
    padding: 15px 0;
}

.suggestion-item:not([style*="border"]) {
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

/* .suggestion-item::before {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 2px;
    background: currentColor;
    transition: width 0.3s ease;
} */

.suggestion-item:hover {
    padding-left: 10px;
    transform: translateX(5px);
}

.suggestion-item:not([style*="color"]):hover {
    color: rgba(255, 255, 255, 0.9);
}

/* .suggestion-item:hover::before {
    width: 100%;
} */

/* Responsive Design */
@media (max-width: 768px) {
    .custom-search-container {
        padding: 30px 25px;
        margin: 0 15px;
    }
    
    .custom-search-container.expanded {
        padding: 40px 25px;
    }
    
    .custom-search-input {
        padding: 18px 20px;
        font-size: 15px;
    }
    
    .custom-search-button {
        width: 45px;
        height: 45px;
        margin-right: 5px;
    }
    
    .suggestion-item {
        font-size: 15px;
        padding: 12px 0;
    }
}

@media (max-width: 480px) {
    .custom-search-container {
        padding: 25px 20px;
        margin: 0 10px;
        border-radius: 15px;
    }
    
    .custom-search-input {
        padding: 16px 18px;
        font-size: 14px;
    }
    
    .custom-search-button {
        width: 42px;
        height: 42px;
    }
    
    .suggestion-item {
        font-size: 14px;
        padding: 10px 0;
    }
}

/* Animation for smooth expansion */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.suggestions-container.animating {
    animation: fadeInUp 0.3s ease both;
}

/* Loading spinner animation */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.loading-spinner {
    animation: spin 1s linear infinite;
}

.custom-search-button.loading {
    pointer-events: none;
    opacity: 0.7;
}

.custom-search-button.loading svg {
    animation: spin 1s linear infinite;
}

/* Scroll-triggered expansion styles */
.custom-search-container.scroll-expanded {
    animation: scrollExpansion 0.5s ease-out;
}

.custom-search-container.scroll-expanded.expanded {
    box-shadow: 0 15px 40px rgba(229, 62, 62, 0.25);
}

@keyframes scrollExpansion {
    from {
        transform: translateY(-10px) scale(0.98);
        opacity: 0.8;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Subtle pulsing animation for scroll-triggered expansion */
.custom-search-container.scroll-expanded .custom-search-field {
    animation: subtlePulse 2s ease-in-out;
}

@keyframes subtlePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
}

/* Enhanced focus state for scroll-expanded widget */
.custom-search-container.scroll-expanded .custom-search-input {
    transition: all 0.3s ease;
}

.custom-search-container.scroll-expanded .custom-search-input::placeholder {
    color: rgba(153, 153, 153, 0.8);
    transition: all 0.3s ease;
}