/**
 * Custom Mobile Navbar - Optimized Styles
 * Clean, modern mobile navigation with comprehensive compatibility
 *
 * @package Custom_Mobile_Navbar
 * @version 1.1.0
 * @author Ronen Zubkov
 * @license MIT
 */

/* ========================================
   MAIN NAVBAR STYLES
   ======================================== */

.cmn-mobile-navbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 0;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(0, 0, 0, 0.04);
    padding: 8px 0 12px 0;
    min-height: 60px;
    z-index: 999999;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.08);
    direction: rtl;
    font-family: Assistant, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    overflow: hidden;
    contain: layout style;
    margin: 0;
    box-sizing: border-box;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.cmn-mobile-navbar::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(190, 148, 255, 0.3), transparent);
}

/* Hide on desktop */
@media (min-width: 769px) {
    .cmn-mobile-navbar,
    .cmn-search-overlay {
        display: none;
    }
}

/* Mobile visibility */
@media (max-width: 768px) {
    .cmn-mobile-navbar {
        display: flex;
    }

    body {
        padding-bottom: 80px;
    }
}

/* ========================================
   NAVBAR ITEM STYLES
   ======================================== */

.cmn-navbar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #777;
    padding: 6px 0;
    transition: all 0.25s ease;
    position: relative;
    min-height: 65px;
    border-radius: 0;
    margin: 0;
    overflow: visible;
    word-break: break-word;
    min-width: 48px;
    flex: 1;
    /* Touch optimization */
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(190, 148, 255, 0.1);
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    background: transparent;
}

/* Stronger specificity to override theme styles - EXCEPT :active */
.cmn-mobile-navbar .cmn-navbar-item,
.cmn-mobile-navbar .cmn-navbar-item:link,
.cmn-mobile-navbar .cmn-navbar-item:visited,
.cmn-mobile-navbar .cmn-navbar-item:hover,
.cmn-mobile-navbar .cmn-navbar-item:focus {
    background: transparent !important;
    color: #777;
}

.cmn-navbar-item:hover .cmn-icon-wrapper i,
.cmn-navbar-item:hover .cmn-text-wrapper {
    color: #be94ff;
}

.cmn-navbar-item:hover .cmn-icon-wrapper {
    transform: translateY(-2px);
}

.cmn-navbar-item.current-page .cmn-icon-wrapper i,
.cmn-navbar-item.current-page .cmn-text-wrapper {
    color: #be94ff;
}

.cmn-navbar-item.current-page::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background-color: #be94ff;
    border-radius: 3px;
    opacity: 0.8;
}

.cmn-navbar-item:focus {
    outline: none;
    background: transparent;
}

/* Touch device optimizations */
@media (pointer: coarse) {
    .cmn-navbar-item:hover .cmn-icon-wrapper {
        transform: none !important;
    }

    .cmn-navbar-item:active {
        transform: scale(0.95) !important;
    }
}

/* Active state with circle animation - light purple on tap */
.cmn-mobile-navbar .cmn-navbar-item:active {
    background: rgba(190, 148, 255, 0.08) !important;
    color: #be94ff;
}

.cmn-mobile-navbar .cmn-navbar-item:active .cmn-icon-wrapper i,
.cmn-mobile-navbar .cmn-navbar-item:active .cmn-text-wrapper {
    color: #be94ff;
}

.cmn-navbar-item:active::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    background: rgba(190, 148, 255, 0.15);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    z-index: -1;
    animation: tapCircle 0.6s forwards;
}

@keyframes tapCircle {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0;
    }
}

.cmn-icon-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
    height: 22px;
    margin-bottom: 3px;
}
.cmn-icon-wrapper i {
    font-size: 19px;
    color: #777;
    transition: all 0.25s ease;
}

.cmn-text-wrapper {
    font-size: 11px;
    font-weight: 500;
    transition: all 0.25s ease;
    margin-top: 2px;
    color: #777;
    font-family: Assistant, sans-serif;
    text-align: center;
    line-height: 1.2;
    justify-content: center;
    display: flex;
    align-items: center;
}

/* ========================================
   BADGE STYLES (Cart/Wishlist counters)
   ======================================== */

.cmn-navbar-item-badge {
    position: absolute;
    top: 2px;
    left: 20%;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    min-width: 18px;
    animation: fadeInBounce 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    max-width: 30px;
    max-height: 30px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@keyframes fadeInBounce {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    70% {
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ========================================
   FULL-SCREEN SEARCH OVERLAY (New)
   Replaces the broken YITH overlay approach
   ======================================== */

/* ========== CMN Search Overlay — full-screen on mobile ========== */
.cmn-search-fullscreen {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999999;
    display: none;
    flex-direction: column;
    background: #fff;
    direction: rtl;
    font-family: Assistant, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.cmn-search-fullscreen.cmn-open {
    display: flex !important;
}

/* No separate backdrop needed — bg is solid white */
.cmn-search-fullscreen__backdrop { display: none; }

/* Header row: title + close button */
.cmn-search-fullscreen__content {
    flex: 1 1 auto;
    padding: 16px 16px 100px;
    display: flex;
    flex-direction: column;
}

.cmn-search-fullscreen__close {
    position: absolute;
    top: 12px;
    left: 12px;
    background: #f5f5f5;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: #666;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    touch-action: manipulation;
    z-index: 2;
}

.cmn-search-fullscreen__close:active {
    background: #e0e0e0;
}

.cmn-search-fullscreen__title {
    margin: 0 0 16px;
    padding-top: 4px;
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.cmn-search-fullscreen__form {
    direction: rtl;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
}

/* YITH search inside overlay */
.cmn-search-fullscreen__form .wp-block-yith-search-block {
    width: 100% !important;
    max-width: 100% !important;
}

.cmn-search-fullscreen__form .ywcas-input-field input,
.cmn-search-fullscreen__form input.ywcas-input {
    font-size: 16px !important; /* Prevent iOS zoom */
    direction: rtl !important;
}

.cmn-search-fullscreen__form .ywcas-classic-search {
    width: 100% !important;
}

/* Search results — fill remaining space */
.cmn-search-fullscreen__form .ywcas-search-results,
.cmn-search-fullscreen__form .ywcas-results {
    position: relative !important;
    width: 100% !important;
    max-height: none !important;
    overflow-y: auto;
    direction: rtl !important;
}

/* Submit button */
.cmn-search-fullscreen__form .ywcas-submit-wrapper {
    background: #be94ff !important;
    border-radius: 8px !important;
    padding: 6px 10px !important;
}

.cmn-search-fullscreen__form .ywcas-submit-wrapper svg,
.cmn-search-fullscreen__form .ywcas-submit-icon {
    color: white !important;
}

/* Hide YITH header search on mobile — our navbar overlay replaces it */
@media (max-width: 768px) {
    .html_topbar_right .wp-block-yith-search-block,
    .header-top .wp-block-yith-search-block {
        display: none !important;
    }
}

/* When our overlay is open, contain the YITH popover inside it */
#cmnSearchOverlay.cmn-open ~ .ywcas-popover-results,
body.cmn-search-active .ywcas-popover-results {
    position: absolute !important;
    top: 100px !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-height: calc(100vh - 120px) !important;
    overflow-y: auto !important;
    background: #fff !important;
    z-index: 99999999 !important;
}

/* Hide the hidden YITH container - use clip-path so YITH React can still render */
#cmnHiddenYithSearch {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip-path: inset(50%) !important;
    pointer-events: none !important;
    opacity: 0 !important;
}

/* ========================================
   SEARCH OVERLAY STYLES (Legacy)
   ======================================== */

.cmn-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 9999999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: max(80px, env(safe-area-inset-top, 20px));
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow: hidden;
    contain: layout style;
}

.cmn-search-overlay.active {
    opacity: 1;
    visibility: visible;
}

.cmn-search-overlay-content {
    background: white !important;
    z-index: 10000000 !important;
    border-radius: 12px;
    padding: 20px;
    width: min(90%, 500px);
    max-width: 500px;
    max-height: 70vh;
    position: relative;
    transform: translateY(-50px);
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    direction: rtl;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    overflow: auto;
    contain: layout style;
}

.cmn-search-overlay.active .cmn-search-overlay-content {
    transform: translateY(0);
}

.cmn-search-close {
    position: absolute;
    top: 15px;
    left: 15px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: color 0.2s ease, transform 0.2s ease;
    overflow: hidden;
    touch-action: manipulation;
}

.cmn-search-close:hover,
.cmn-search-close:focus {
    background: #f5f5f5;
    color: #333;
}

.cmn-search-title {
    margin-top: 0;
    margin-bottom: 20px;
    text-align: center;
    color: #333;
    font-size: 18px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========================================
   SEARCH FORM STYLES
   ======================================== */

.cmn-search-overlay form {
    display: flex;
    gap: 10px;
    margin-bottom: 0;
    overflow: hidden;
}

.cmn-search-overlay input[type="search"],
.cmn-search-overlay input[type="text"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e1e1;
    border-radius: 8px;
    font-size: max(16px, 1rem); /* Prevent zoom on iOS */
    direction: rtl;
    transition: border-color 0.2s ease;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cmn-search-overlay input[type="search"]:focus,
.cmn-search-overlay input[type="text"]:focus {
    outline: none;
    border-color: #be94ff;
    box-shadow: 0 0 0 3px rgba(190, 148, 255, 0.1);
}

.cmn-search-overlay button[type="submit"] {
    background: #be94ff;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s ease;
    overflow: hidden;
    white-space: nowrap;
    touch-action: manipulation;
}

.cmn-search-overlay button[type="submit"]:hover,
.cmn-search-overlay button[type="submit"]:focus {
    background: #a67ae6;
}

/* ========================================
   YITH SEARCH INTEGRATION
   ======================================== */

.cmn-search-overlay .yith-ajaxsearchform-container {
    margin: 0;
}

.cmn-search-overlay .yith-ajaxsearchform-wide {
    border: none;
    box-shadow: none;
    direction: rtl;
}

.cmn-search-overlay .yith-ajaxsearch-filters {
    direction: rtl;
    gap: 10px;
}

.cmn-search-overlay .yith-ajaxsearchform-select {
    margin-bottom: 10px;
}

/* YITH Overlay Search Styling for Mobile */
@media (max-width: 768px) {
    /* Make YITH overlay mobile-friendly - MINIMAL styling */
    .wp-block-yith-overlay-search-block .wp-block-yith-overlay-block {
        direction: rtl !important;
    }

    /* YITH search input styling - MINIMAL */
    .wp-block-yith-overlay-block input[type="search"],
    .wp-block-yith-overlay-block input[type="text"] {
        font-size: 16px !important; /* Prevent iOS zoom */
        direction: rtl !important;
    }

    /* YITH search results - MINIMAL */
    .wp-block-yith-overlay-block .wp-block-yith-overlay-filled-block,
    .wp-block-yith-overlay-block .ywcas-results {
        direction: rtl !important;
        text-align: right !important;
    }

    /* ========================================
       SEARCH BUTTON & ICON STYLING
       ======================================== */

    /* Style the search submit icon wrapper - Make it look like a button */
    .lapilliUI-Modal__paper .ywcas-submit-wrapper,
    .lapilliUI-Modal__paper .lapilliUI-Input__endAdornment,
    .ywcas-input-field .ywcas-submit-wrapper {
        background: #be94ff !important;
        border: 2px solid #be94ff !important;
        border-radius: 8px !important;
        padding: 8px 12px !important;
        cursor: pointer !important;
        transition: all 0.3s ease !important;
        box-shadow: 0 2px 8px rgba(190, 148, 255, 0.3) !important;
        margin-left: 8px !important;
        margin-right: 0 !important;
    }

    /* Icon inside the button wrapper */
    .lapilliUI-Modal__paper .ywcas-submit-wrapper svg,
    .lapilliUI-Modal__paper .ywcas-submit-icon {
        color: white !important;
        filter: none !important;
    }

    /* Hover state for search button */
    .lapilliUI-Modal__paper .ywcas-submit-wrapper:hover,
    .ywcas-input-field .ywcas-submit-wrapper:hover {
        background: #a67ae6 !important;
        border-color: #a67ae6 !important;
        box-shadow: 0 4px 12px rgba(190, 148, 255, 0.5) !important;
        transform: translateY(-2px) scale(1.05) !important;
    }

    /* Make it obvious it's clickable */
    .lapilliUI-Modal__paper .ywcas-submit-wrapper::before {
        content: '' !important;
        position: absolute !important;
        inset: -4px !important;
        border: 2px dashed #be94ff !important;
        border-radius: 10px !important;
        opacity: 0 !important;
        transition: opacity 0.3s ease !important;
    }

    .lapilliUI-Modal__paper .ywcas-submit-wrapper:hover::before {
        opacity: 0.5 !important;
        animation: pulse 1.5s ease-in-out infinite !important;
    }

    @keyframes pulse {
        0%, 100% { opacity: 0.3; transform: scale(1); }
        50% { opacity: 0.6; transform: scale(1.05); }
    }

    /* Move magnifying glass icon to RIGHT side (RTL) - AGGRESSIVE targeting */
    div.lapilliUI-Modal__paper div.lapilliUI-Input__startAdornment,
    div.lapilliUI-Modal__paper .ywcas-submit-wrapper,
    .ywcas-input-field.lapilliUI-Input--sizeXl .lapilliUI-Input__startAdornment,
    .ywcas-simple-input-field-wrapper .lapilliUI-Input__startAdornment {
        order: 2 !important;
        margin-right: 0 !important;
        margin-left: 10px !important;
    }

    /* Ensure input field is on left when icon moves right */
    div.lapilliUI-Modal__paper div.lapilliUI-Input__field,
    div.lapilliUI-Modal__paper input[type="text"],
    .ywcas-input-field.lapilliUI-Input--sizeXl .lapilliUI-Input__field,
    .ywcas-simple-input-field-wrapper input[type="text"] {
        order: 1 !important;
        flex: 1 !important;
    }

    /* Input wrapper should be flex for RTL icon positioning - STRONGEST */
    div.lapilliUI-Modal__paper div.lapilliUI-Input__root,
    div.lapilliUI-Modal__paper .ywcas-input-field,
    .ywcas-input-field.lapilliUI-Input--sizeXl,
    .ywcas-simple-input-field-wrapper .ywcas-input-field,
    .ywcas-input-field.lapilliUI-Input--sizeXl.lapilliUI-Input--fullWidth,
    .css-12vuiz4.lapilliUI-Input__root {
        display: flex !important;
        flex-direction: row-reverse !important;
        align-items: center !important;
        gap: 10px !important;
    }

    /* Target the exact hash class from your modal */
    .css-18epoci .ywcas-input-field.lapilliUI-Input--sizeXl,
    .css-18epoci .css-12vuiz4 {
        flex-direction: row-reverse !important;
    }

    .css-18epoci .lapilliUI-Input__startAdornment,
    .css-12vuiz4 .lapilliUI-Input__startAdornment {
        order: 2 !important;
    }

    .css-18epoci .lapilliUI-Input__field,
    .css-12vuiz4 .lapilliUI-Input__field {
        order: 1 !important;
    }

    /* Nuclear option - target by multiple classes */
    .lapilliUI-Input--outlined.lapilliUI-Input--sizeXl.lapilliUI-Input--fullWidth {
        flex-direction: row-reverse !important;
    }

    /* Add prominent border to main search input to show where to click */
    .lapilliUI-Modal__paper .ywcas-input-field.lapilliUI-Input--sizeXl,
    .lapilliUI-Modal__paper .lapilliUI-Input--sizeXl,
    .css-18epoci .ywcas-input-field.lapilliUI-Input--sizeXl {
        border: 2px solid #be94ff !important;
        border-radius: 12px !important;
        padding: 10px !important;
        box-shadow: 0 2px 8px rgba(190, 148, 255, 0.2) !important;
        transition: all 0.2s ease !important;
        background: white !important;
    }

    /* Hover state for search input - subtle glow */
    .lapilliUI-Modal__paper .ywcas-input-field.lapilliUI-Input--sizeXl:hover,
    .lapilliUI-Modal__paper .lapilliUI-Input--sizeXl:hover {
        border-color: #a67ae6 !important;
        box-shadow: 0 2px 12px rgba(190, 148, 255, 0.3) !important;
    }

    /* Active/pressed state for search input - clean press effect */
    .lapilliUI-Modal__paper .ywcas-input-field.lapilliUI-Input--sizeXl:active,
    .lapilliUI-Modal__paper .lapilliUI-Input--sizeXl:active {
        border-color: #9c6fd9 !important;
        box-shadow: 0 1px 4px rgba(190, 148, 255, 0.3) inset !important;
        transform: scale(0.99) !important;
    }

    /* Focus state for search input - when typing */
    .lapilliUI-Modal__paper .ywcas-input-field.lapilliUI-Input--sizeXl:focus-within,
    .lapilliUI-Modal__paper .lapilliUI-Input--sizeXl:focus-within {
        border-color: #be94ff !important;
        box-shadow: 0 0 0 4px rgba(190, 148, 255, 0.15), 0 4px 12px rgba(190, 148, 255, 0.25) !important;
        transform: none !important;
    }

    /* Translate "Popular Products" to Hebrew - STRONGER */
    div.lapilliUI-Modal__paper h2.wp-block-heading,
    .wp-block-yith-overlay-empty-block h2.wp-block-heading,
    .css-18epoci h2.wp-block-heading,
    .lapilliUI-ModalContent__root h2 {
        font-size: 0 !important;
        line-height: 0 !important;
        visibility: hidden !important;
        min-height: 40px !important;
        padding-bottom: 10px !important;
        overflow: visible !important;
    }

    div.lapilliUI-Modal__paper h2.wp-block-heading::after,
    .wp-block-yith-overlay-empty-block h2.wp-block-heading::after,
    .css-18epoci h2.wp-block-heading::after,
    .lapilliUI-ModalContent__root h2::after {
        content: "מוצרים פופולריים" !important;
        font-size: 18px !important;
        font-weight: 600 !important;
        display: block !important;
        line-height: 1.5 !important;
        color: #333 !important;
        visibility: visible !important;
        margin-top: 5px !important;
        padding-bottom: 5px !important;
    }

    /* Hide mobile navbar when YITH search modal is open */
    body.lapilliUI-Modal--open .cmn-mobile-navbar,
    body:has(.lapilliUI-Modal--open) .cmn-mobile-navbar {
        opacity: 0 !important;
        pointer-events: none !important;
        visibility: hidden !important;
        transform: translateY(100%) !important;
        transition: all 0.3s ease !important;
    }

    /* Hide mobile navbar when Flatsome off-canvas cart/drawer is open */
    html.mfp-ready .cmn-mobile-navbar,
    body:has(.mfp-wrap) .cmn-mobile-navbar {
        transform: translateY(100%) !important;
        opacity: 0 !important;
        pointer-events: none !important;
        transition: transform 0.3s ease, opacity 0.3s ease !important;
    }

    /* YITH close button - Just the X icon, no background */
    .wp-block-yith-overlay-block .lapilliUI-Modal__close,
    .lapilliUI-Modal__close,
    button.lapilliUI-Modal__close {
        background: transparent !important;
        border-radius: 0 !important;
        border: none !important;
        box-shadow: none !important;
        position: fixed !important;
        top: 42px !important;
        left: 16px !important;
        right: auto !important;
        z-index: 10000001 !important;
        padding: 8px !important;
        width: auto !important;
        height: auto !important;
        min-width: 32px !important;
        min-height: 32px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        cursor: pointer !important;
        transition: all 0.15s ease !important;
    }

    /* X button hover state - just scale */
    .lapilliUI-Modal__close:hover {
        background: transparent !important;
        box-shadow: none !important;
        transform: scale(1.1) !important;
    }

    /* X button active/pressed state */
    .lapilliUI-Modal__close:active {
        background: transparent !important;
        box-shadow: none !important;
        transform: scale(0.95) !important;
    }

    /* Remove any oval/circle pseudo-elements from close button */
    .lapilliUI-Modal__close::before,
    .lapilliUI-Modal__close::after,
    button.lapilliUI-Modal__close::before,
    button.lapilliUI-Modal__close::after {
        display: none !important;
        content: none !important;
    }

    /* X icon styling - bigger and clearer */
    .wp-block-yith-overlay-block .lapilliUI-Modal__close svg,
    .lapilliUI-Modal__close svg {
        width: 24px !important;
        height: 24px !important;
        color: #333 !important;
        stroke-width: 2.5 !important;
        transition: color 0.2s ease !important;
    }

    /* Hover state for X button */
    .wp-block-yith-overlay-block .lapilliUI-Modal__close:hover svg {
        color: #333 !important;
    }

    /* Ensure modal content doesn't overlap with X button */
    .wp-block-yith-overlay-block .lapilliUI-Modal__paper {
        padding-top: 70px !important;
    }

    /* ========================================
       CUSTOM CLASS: mobile-navbar-search
       For bottom-search preset only
       ======================================== */

    /* Fix close button position for RTL - only for mobile navbar search */
    .mobile-navbar-search .lapilliUI-Modal__close,
    .mobile-navbar-search button[class*="Modal__close"] {
        left: 15px !important;
        right: auto !important;
    }

    /* Remove any positioning that conflicts */
    .mobile-navbar-search .lapilliUI-Modal__paper {
        direction: rtl !important;
    }

    /* Make sure images display properly */
    .mobile-navbar-search img {
        display: block !important;
        max-width: 100% !important;
        height: auto !important;
    }

    /* Ensure search results are visible */
    .mobile-navbar-search .wp-block-yith-overlay-filled-block,
    .mobile-navbar-search .ywcas-results {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    /* Hide the hidden YITH container - use clip-path so YITH React can still render */
    #cmnHiddenYithSearch {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 1px !important;
        height: 1px !important;
        overflow: hidden !important;
        clip-path: inset(50%) !important;
        pointer-events: none !important;
        opacity: 0 !important;
    }
}

/* ========================================
   RESPONSIVE BREAKPOINTS (Simplified)
   ======================================== */

/* Small phones adjustments */
@media (max-width: 360px) {
    .cmn-navbar-item {
        padding: 6px 2px !important;
    }

    .cmn-icon-wrapper i {
        font-size: 17px !important;
    }

    .cmn-text-wrapper {
        font-size: 10px !important;
    }
}

/* Landscape orientation */
@media (max-width: 768px) and (orientation: landscape) and (max-height: 500px) {
    .cmn-mobile-navbar {
        padding: 6px 0 10px 0 !important;
        min-height: 50px !important;
    }

    .cmn-navbar-item {
        min-height: 50px !important;
        padding: 4px 2px !important;
    }

    .cmn-icon-wrapper i {
        font-size: 16px !important;
    }

    .cmn-text-wrapper {
        font-size: 9px !important;
    }
}

/* Removed iOS safe-area-inset for better compatibility */

/* ========================================
   ACCESSIBILITY IMPROVEMENTS
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    .cmn-mobile-navbar,
    .cmn-navbar-item,
    .cmn-search-overlay,
    .cmn-search-overlay-content,
    .cmn-navbar-item-badge {
        transition: none !important;
        animation: none !important;
    }
}

@media (prefers-contrast: high) {
    .cmn-mobile-navbar {
        background: white !important;
        border-top: 2px solid black !important;
    }

    .cmn-navbar-item {
        color: black !important;
        border: 1px solid #ccc !important;
    }

    .cmn-navbar-item:hover,
    .cmn-navbar-item:focus,
    .cmn-navbar-item.current-page {
        background: #be94ff !important;
        color: white !important;
    }

    .cmn-navbar-item:active {
        transform: scale(0.95) !important;
        background: rgba(190, 148, 255, 0.2) !important;
        transition: none !important;
    }
}
/* Dark mode disabled - always use light theme */
/*
@media (prefers-color-scheme: dark) {
    .cmn-mobile-navbar {
        background: rgba(30, 30, 30, 0.95) !important;
        border-top-color: rgba(255, 255, 255, 0.2) !important;
    }

    .cmn-navbar-item {
        color: #e0e0e0 !important;
    }

    .cmn-search-overlay-content {
    background: white !important;
    z-index: 10000000 !important;
        background: #2d2d2d !important;
        color: #e0e0e0 !important;
    }

    .cmn-search-title {
        color: #e0e0e0 !important;
    }
}
*/

/* ========================================
   RTL SUPPORT
   ======================================== */

[dir="rtl"] .cmn-navbar-item-badge {
    left: auto;
    right: 20%;
}

[dir="rtl"] .cmn-search-close {
    left: auto;
    right: 15px;
}

/* ========================================
   FORCE VISIBILITY & PREVENT CONFLICTS
   ======================================== */

/* Force visibility - prevent hiding by external scripts
   BUT allow hiding when off-canvas cart or search modal is open */
html:not(.mfp-ready) .cmn-mobile-navbar.hidden,
html:not(.mfp-ready) .cmn-mobile-navbar[style*="translateY"],
html:not(.mfp-ready) .cmn-mobile-navbar[style*="transform"],
html:not(.mfp-ready) body.scrolling-down .cmn-mobile-navbar,
html:not(.mfp-ready).scroll-down .cmn-mobile-navbar,
html:not(.mfp-ready) .cmn-mobile-navbar.bnav_scroll_hide_menu,
html:not(.mfp-ready) .cmn-mobile-navbar.bnav_hide_menu_onscroll_mobile,
html:not(.mfp-ready) body .cmn-mobile-navbar[class*="bnav_"],
html:not(.mfp-ready) body .cmn-mobile-navbar[class*="scroll"],
html:not(.mfp-ready) body .cmn-mobile-navbar[class*="hide"] {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: fixed !important;
    bottom: 0 !important;
    z-index: 999999 !important;
    transform: translateY(0) !important;
    transition: none !important;
}

/* Hide conflicting plugins */
.bnav_bottom_nav_wrapper,
.bottom-nav-wrapper {
    display: none !important;
}

/* Prevent YITH search conflicts - STRONGER RULES */
body.custom-search-active .yith-wcas-overlay,
body.custom-search-active .yith-ajaxsearchform-container:not(.cmn-search-overlay *),
body.custom-search-active .yith-search-trigger,
body.custom-search-active .yith-ajaxsearchform-modal,
.cmn-search-overlay.active ~ .yith-wcas-overlay {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    z-index: -99999 !important;
    pointer-events: none !important;
    position: absolute !important;
    left: -9999px !important;
}

/* Hide ALL competing search overlays - STRONG rules */
body.custom-search-active .mfp-bg,
body.custom-search-active .mfp-wrap:not(.cmn-search-overlay),
body.custom-search-active [class*="search-overlay"]:not(.cmn-search-overlay),
body.custom-search-active [class*="search-lightbox"],
body.custom-search-active [class*="SearchOverlay"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    z-index: -99999 !important;
}

/* ========================================
   CSS CUSTOM PROPERTIES FOR THEMING
   ======================================== */

:root {
    --cmn-bg-color: rgba(255, 255, 255, 0.95);
    --cmn-text-color: #4a4a4a;
    --cmn-active-color: #be94ff;
    --cmn-badge-color: #ff4757;
    --cmn-border-color: rgba(0, 0, 0, 0.1);
}

.cmn-mobile-navbar {
    background: var(--cmn-bg-color);
    border-top-color: var(--cmn-border-color);
}

.cmn-navbar-item {
    color: var(--cmn-text-color);
}

.cmn-navbar-item:hover,
.cmn-navbar-item:focus,
.cmn-navbar-item.current-page {
    color: var(--cmn-active-color);
}

.cmn-navbar-item:focus {
    outline-color: var(--cmn-active-color);
}

.cmn-navbar-item-badge {
    background: var(--cmn-badge-color);
}

.cmn-search-overlay input:focus {
    border-color: var(--cmn-active-color);
    box-shadow: 0 0 0 3px rgba(190, 148, 255, 0.1);
}

.cmn-search-overlay button[type="submit"] {
    background: var(--cmn-active-color);
}
/* ========================================
   CRITICAL OVERRIDES - PREVENT BLACK FLASH
   ======================================== */

/* Force transparent/light backgrounds on all states */

/* Force transparent for all other states */
nav.cmn-mobile-navbar a.cmn-navbar-item,
nav#cmnMobileNavbar a.cmn-navbar-item,
.cmn-mobile-navbar a.cmn-navbar-item[href],
body .cmn-mobile-navbar .cmn-navbar-item {
    background-color: transparent !important;
    background-image: none !important;
}

/* ========================================
   FINAL OVERRIDES - STRONGEST SPECIFICITY
   Must be at END of file to override Flatsome
   ======================================== */

/* Override Flatsome a:active with STRONGEST specificity */
nav.cmn-mobile-navbar a.cmn-navbar-item:active,
nav#cmnMobileNavbar a.cmn-navbar-item:active,
.cmn-mobile-navbar a.cmn-navbar-item:active[href],
body .cmn-mobile-navbar .cmn-navbar-item:active,
html body .cmn-mobile-navbar a.cmn-navbar-item:active {
    background-color: rgba(190, 148, 255, 0.08) !important;
    background-image: none !important;
    background: rgba(190, 148, 255, 0.08) !important;
    color: #be94ff !important;
    box-shadow: none !important;
}


/* New badge for assistant navbar item */
.cmn-new-badge {
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 8px;
    white-space: nowrap;
    line-height: 1.3;
    box-shadow: 0 2px 6px rgba(238, 90, 36, 0.4);
    animation: cmn-badge-pulse 2s ease-in-out infinite;
    z-index: 5;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.cmn-new-badge.badge-hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(8px);
    pointer-events: none;
    animation: none;
}

@keyframes cmn-badge-pulse {
    0%, 100% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(1.08); }
}