/* Search Overlay Styles */
/* Define header height variables */
:root {
    --topbar-height: 40px; /* Adjust based on your actual top bar height */
    --main-header-height: 80px; /* Adjust based on your actual header height */
    --header-height: calc(var(--topbar-height) + var(--main-header-height));
}

.search-toggle {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-icon {
    transition: all 0.3s ease;
}

.search-toggle:hover .search-icon {
    stroke: var(--primary-color, #8957FF);
}

/* Search Overlay - Enhanced specificity with 80px professional height */
html body .dropdown-menu.dropdown-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 80px;
    background-color: #fff;
    z-index: 9999999;
    display: none;
    padding: 0;
    margin: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.2s ease-out;
    border-bottom: 1px solid #eee;
    transform: none;
}

/* Enhanced specificity for active dropdown menu - with fallback !important for display */
html body .dropdown-menu.dropdown-menu.active {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

/* Search Input Container - Professional 50% Width */
.pos-search__container {
    display: flex;
    align-items: center;
    width: 50%;
    padding: 0 30px;
    height: 60px; /* Fixed height for better vertical alignment */
    justify-content: center; /* Center horizontally */
    margin: 0 auto; /* Center the container */
    position: relative;
}

.search-input-container {
    flex: 1;
    position: relative;
    height: 100%; /* Take full height of container */
    display: flex;
    align-items: center;
}

.pos-search__input {
    width: 100%;
    height: 40px;
    border: 1px solid #ddd;
    border-right: none;
    border-radius: 5px 0 0 5px;
    padding: 0 15px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s;
    box-shadow: none;
    vertical-align: middle;
    box-sizing: border-box;
}

.pos-search__input:focus {
    border-color: #ddd;
    box-shadow: none;
}

.search-clear {
    position: absolute;
    right: 60px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #999;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-clear.unvisible {
    display: none;
}

/* Search Button - Enhanced CSS Specificity with Professional Text */
html body .dropdown-menu form .pos-search__container .pos-search__submit {
    background-color: var(--header-text-color-scroll, #000000);
    color: #fff;
    border: none;
    height: 40px;
    min-width: 100px;
    padding: 0 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.3s;
    flex-shrink: 0;
    position: relative;
    overflow: visible;
    border-radius: 0 5px 5px 0;
    font-size: 14px;
    font-weight: 500;
    box-sizing: border-box;
}

html body .dropdown-menu form .pos-search__container .pos-search__submit:hover {
    background-color: var(--header-text-color-scroll, #000000);
    opacity: 0.8;
}

/* Desktop: Show text, hide icon */
html body .dropdown-menu .search-text-desktop {
    display: block;
    font-size: 14px;
    font-weight: 500;
}

/* Desktop: Hide search icon, show text only - Enhanced specificity */
html body .dropdown-menu .search-icon-mobile,
html body .dropdown-menu .search-icon-submit {
    display: none;
}

/* Base icon styles for when it's shown */
.search-icon-submit {
    stroke: #fff;
    width: 22px;
    height: 22px;
    stroke-width: 2;
}

.search-icon-submit {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Professional Logo Branding in Search Overlay */
.search-overlay-logo {
    position: absolute;
    left: 30px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1002;
}

.search-logo-image {
    max-height: 40px;
    width: auto;
    display: block;
}

/* Form Wrapper - Full Width Professional Design */
.dropdown-menu form {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    position: relative;
}

/* Universal Browser-Style Close Button - All Devices */
.dialog-lightbox-close-button {
    cursor: pointer;
    position: fixed; /* Fixed to viewport like browser close buttons */
    top: 20px; /* Consistent top positioning */
    right: 20px; /* Consistent right positioning */
    transform: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px; /* Slightly larger for better accessibility */
    height: 30px;
    background-color: rgb(247, 247, 247);
    border: none;
    border-radius: 50%;
    color: #333;
    transition: all 0.3s ease;
    z-index: 10000; /* Very high z-index to appear above everything */
    outline: none;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
    font-size: 16px; /* Larger font for better visibility */
    font-weight: bold;
}

/* Close button interactions removed for static behavior */

/* Professional close icon styling - Compact Size */
.close-icon {
    font-size: 14px;
    font-weight: bold;
    line-height: 1;
    color: #333;
    user-select: none;
}

/* Style the SVG icon inside the close button - static behavior */
.dialog-lightbox-close-button svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

/* Search Results */
.pos-search__result {
    margin-top: 15px;
    max-height: 300px;
    overflow-y: auto;
}

.pos-search__result.unvisible {
    display: none;
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Body class when search is open */
body.search-open {
    overflow: auto;
}



/* Responsive Adjustments - Following Development Recommendations */
/* Mobile/Tablet: max-width: 991px (tablets >991px treated as desktop) */
@media (max-width: 991px) {
    :root {
        --topbar-height: 30px; /* Smaller top bar on mobile */
        --main-header-height: 60px; /* Smaller header on mobile */
        --header-height: calc(var(--topbar-height) + var(--main-header-height));
    }
    
    /* Enhanced specificity for mobile dropdown menu - 80px height */
    html body .dropdown-menu.dropdown-menu {
        top: 0;
        height: 80px;
    }
    
    /* Hide logo on mobile for space efficiency */
    .search-overlay-logo {
        display: none;
    }
    
    /* Mobile close button - Enhanced specificity with proper positioning */
    html body .dropdown-menu .dialog-lightbox-close-button.dialog-close-button {
        display: flex;
        position: fixed;
        top: 5px; /* Compact positioning for mobile */
        right: 5px; /* Compact positioning for mobile */
        width: 20px; /* Smaller size for mobile */
        height: 20px;
        z-index: 10001;
        background-color: rgb(247, 247, 247);
        border-radius: 50%;
        color: #333;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        font-size: 18px; /* Larger font for mobile visibility */
        font-weight: bold;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
        border: none;
        outline: none;
    }
    
    .pos-search__container {
        padding: 0 10px;
        height: 50px;
    }
    
    .pos-search__input {
        height: 40px;
        font-size: 14px;
        padding: 0 10px;
    }
    
    /* Enhanced specificity for mobile search submit button */
    html body .dropdown-menu form .pos-search__container .pos-search__submit {
        height: 40px;
        width: 40px;
        min-width: 40px;
        padding: 0;
        font-size: 12px;
    }
    
    /* Mobile: Hide text, show icon - Enhanced specificity */
    html body .dropdown-menu .search-text-desktop {
        display: none;
    }
    
    html body .dropdown-menu .search-icon-mobile,
    html body .dropdown-menu .search-icon-submit {
        display: block;
    }
    
    .pos-search__submit svg {
        width: 16px;
        height: 16px;
        stroke-width: 2.5;
    }
    
    .dialog-lightbox-close-button {
        top: 5px;
        right: -8px;
        transform: none;
        width: 20px;
        height: 20px;
        background-color: #dd3333;
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
        z-index: 1002;
    }
    
    .dialog-lightbox-close-button svg {
        width: 12px;
        height: 12px;
        stroke-width: 2.5;
    }
    
    /* Ensure mobile container has overflow visible for close button */
    .pos-search__container {
        overflow: visible;
    }
    
    .dialog-lightbox-close-button svg {
        width: 22px;
        height: 22px;
        stroke-width: 2.5;
    }
    
    .dialog-lightbox-close-button:hover {
        background-color: rgba(255, 255, 255, 1);
        transform: scale(1.05);
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.25);
    }
    
    .pos-search__container {
        max-width: 95%;
        width: 95%;
        padding: 0 30px;
    }
    
    .search-input-container {
        width: 100%;
    }
}
