/* Enhanced Bottom Navigation Styles with Sub-Menu Support */
.bottom-nav-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    max-width: 500px;
    width: 90%;
    display: none !important;
}

.bottom-nav {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 50px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
}

/* Navigation Items */
.nav-item-container {
    position: relative;
}

.bottom-nav-container .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #00427f;
    padding: 12px 16px;
    border-radius: 25px;
    transition: all 0.3s ease;
    position: relative;
    min-width: 60px;
    text-align: center;
}

.bottom-nav-container .nav-item:nth-of-type(1):not(.bottom-nav-container .nav-item[data-has-submenu=true]) {
    background: #00aeff;
    color: white;
    transform: translateY(-2px);
}

.bottom-nav-container .nav-item:hover:not(.active) {
    color: #374151;
    transform: translateY(-1px);
    text-decoration: none;
}

.bottom-nav-container .nav-item.active {
    background: #00aeff;
    color: white;
    transform: translateY(-2px);
}

.bottom-nav-container .nav-item:focus {
    outline: none;
    box-shadow: 0 0 0 2px #00aeff;
}

.bottom-nav-container .nav-icon {
    font-size: 20px;
    margin-bottom: 4px;
    transition: all 0.3s ease;
}

.bottom-nav-container .nav-text {
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    line-height: 1;
    text-transform: uppercase;
}

/* Submenu Arrow */
.submenu-arrow {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 8px !important;
    opacity: 0.7;
    transition: transform 0.3s ease;
}

.nav-item[data-has-submenu="true"]:hover .submenu-arrow {
    transform: rotate(180deg);
}

/* Sub-menu Styles */
.nav-submenu {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2);
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 10000;
    max-height: 60vh;
    overflow-y: auto;
    display:none;
    transition:all ease-in-out 0.3s;
}

.nav-submenu.show {
    transform: translateY(0);
    display:block;
    transition:all ease-in-out 0.3s;
}

.submenu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 20px 10px;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
    border-radius: 20px 20px 0 0;
}

.submenu-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.submenu-close {
    background: none;
    border: none;
    font-size: 18px;
    color: #666;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.submenu-close:hover {
    background: #e9ecef;
    color: #333;
}

.submenu-content {
    padding: 10px 0 20px;
}

.submenu-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    text-decoration: none;
    color: #333;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.submenu-item:hover {
    background: #f8f9fa;
    color: #00aeff;
    text-decoration: none;
    border-left-color: #00aeff;
}

.submenu-item.current {
    background: #e3f2fd;
    color: #00aeff;
    border-left-color: #00aeff;
    font-weight: 600;
}

.submenu-icon {
    font-size: 16px;
    margin-right: 15px;
    width: 20px;
    text-align: center;
}

.submenu-text {
    font-size: 16px;
    font-weight: 500;
}

/* Submenu Overlay */
.submenu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 9998;
}

.submenu-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Badge styles for cart/notifications */
.bottom-nav-container .nav-item .badge {
    position: absolute;
    top: 8px;
    right: 12px;
    background: #f59e0b;
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: bold;
    min-width: 16px;
    text-align: center;
    line-height: 1.2;
}

.bottom-nav-container .nav-item .sale-badge {
    position: absolute;
    top: 4px;
    right: 8px;
    background: #ec4899;
    color: white;
    border-radius: 8px;
    padding: 1px 4px;
    font-size: 8px;
    font-weight: bold;
    text-transform: uppercase;
    line-height: 1;
}

/* Dropdown Menu Styles (for overflow items) */
.dropdown-container {
    position: relative;
}

.bottom-nav-container .dropdown-menu {
    position: absolute;
    bottom: calc(100% + 15px);
    right: 0;
    background: white;
    border-radius: 20px;
    padding: 8px;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.1);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
}

.bottom-nav-container .dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    display: block !important;
}

.bottom-nav-container .dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    text-decoration: none;
    color: #374151;
    border-radius: 15px;
    transition: all 0.2s ease;
    margin-bottom: 4px;
    position: relative;
}

.bottom-nav-container .dropdown-item:hover {
    background: #f3f4f6;
    color: #00aeff;
    text-decoration: none;
}

.dropdown-arrow {
    font-size: 12px;
    opacity: 0.6;
}

/* Dropdown Submenu */
.dropdown-submenu {
    margin-left: 20px;
    padding-left: 20px;
    border-left: 2px solid #e5e7eb;
    margin-top: 4px;
}

.dropdown-subitem {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    text-decoration: none;
    color: #6b7280;
    border-radius: 10px;
    transition: all 0.2s ease;
    margin-bottom: 2px;
    font-size: 14px;
}

.dropdown-subitem:hover {
    background: #f9fafb;
    color: #4f46e5;
    text-decoration: none;
}

.dropdown-subicon {
    font-size: 12px;
    margin-right: 8px;
    width: 16px;
    text-align: center;
    opacity: 0.7;
}

.bottom-nav-container.hidden {
    display: none !important;
}

.bottom-nav-container .dropdown-icon {
    font-size: 16px;
    margin-right: 12px;
    width: 20px;
    text-align: center;
}

/* Menu Toggle Button */
.bottom-nav-container .menu-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 12px;
    border-radius: 25px;
    color: #6b7280;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
}

.bottom-nav-container .menu-toggle:hover {
    background: #f3f4f6;
    color: #374151;
}

.bottom-nav-container .menu-toggle.active {
    background: #00aeff;
    color: white;
    transform: rotate(180deg);
}

.bottom-nav-container .menu-toggle:focus {
    outline: none;
    box-shadow: 0 0 0 2px #00aeff;
}

/* Hamburger Icon */
.hamburger {
    width: 20px;
    height: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
}

.hamburger span {
    width: 100%;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
    transition: all 0.3s ease;
    display: block;
}

.menu-toggle.active .hamburger span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.menu-toggle.active .hamburger span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active .hamburger span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* Hide on specific pages */
.page-id-123 .bottom-nav-container {
    display: none;
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    .bottom-nav {
        background: rgba(31, 41, 55, 0.95);
        border: 1px solid rgba(75, 85, 99, 0.3);
    }
    
    .bottom-nav-container .nav-item {
        color: #d1d5db;
    }
    
    .bottom-nav-container .nav-item:hover:not(.active) {
        color: #f9fafb;
    }
    
    .nav-submenu {
        background: #374151;
        border-top: 1px solid #4b5563;
    }
    
    .submenu-header {
        background: #4b5563;
        border-bottom-color: #6b7280;
    }
    
    .submenu-title {
        color: #f9fafb;
    }
    
    .submenu-close {
        color: #d1d5db;
    }
    
    .submenu-close:hover {
        background: #6b7280;
        color: #f9fafb;
    }
    
    .submenu-item {
        color: #d1d5db;
    }
    
    .submenu-item:hover {
        background: #4b5563;
        color: #60a5fa;
    }
    
    .submenu-item.current {
        background: #1e3a8a;
        color: #60a5fa;
    }
    
    .bottom-nav-container .dropdown-menu {
        background: #374151;
        border: 1px solid #4b5563;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3);
    }
    
    .bottom-nav-container .dropdown-item {
        color: #d1d5db;
    }
    
    .bottom-nav-container .dropdown-item:hover {
        background: #4b5563;
        color: #a5b4fc;
    }
    
    .dropdown-submenu {
        border-left-color: #4b5563;
    }
    
    .dropdown-subitem {
        color: #9ca3af;
    }
    
    .dropdown-subitem:hover {
        background: #4b5563;
        color: #a78bfa;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .bottom-nav-container {
        width: 95%;
        bottom: 15px;
        display: block !important;
    }
    
    .bottom-nav-container .dropdown-menu.show {
        display: block !important;
    }
    
    .back-to-top-wrap {
        right: 10px !important;
        bottom: 100px !important;
    }
    
    .mobile-property-contact.visible-on-mobile {
        /* bottom: 60px; */
        /* z-index: 999; */
        display: none;
    }
    
    .bottom-nav-container.hidden {
        display: block !important;
    }
    
    .bottom-nav-container .nav-item {
        padding: 10px 12px;
        min-width: 50px;
    }
    
    .bottom-nav-container .nav-text {
        font-size: 11px;
    }
    
    .bottom-nav-container .nav-icon {
        font-size: 18px;
    }
    
    .nav-submenu {
        max-height: 70vh;
    }
    
    .submenu-header {
        padding: 15px 15px 8px;
    }
    
    .submenu-title {
        font-size: 16px;
    }
    
    .submenu-item {
        padding: 12px 15px;
    }
    
    .submenu-text {
        font-size: 15px;
    }
    
    .bottom-nav-container .dropdown-menu {
        right: -10px;
        min-width: 180px;
    }
    html[dir=rtl] .bottom-nav-container .dropdown-menu.show {
        transform: translateY(-215px);
        display: block !important;
        height: fit-content;
    }
}

@media (max-width: 480px) {
    .bottom-nav-container {
        width: 98%;
        bottom: 0;
    }
    
    .bottom-nav {
        padding: 6px 8px;
    }
    
    .bottom-nav-container .nav-item {
        padding: 8px 10px;
        min-width: 45px;
    }
    
    .bottom-nav-container .nav-text {
        font-size: 10px;
    }
    
    .bottom-nav-container .nav-icon {
        font-size: 16px;
        margin-bottom: 2px;
    }
    
    .nav-submenu {
        max-height: 75vh;
    }
    
    .submenu-header {
        padding: 12px 12px 6px;
    }
    
    .submenu-title {
        font-size: 15px;
    }
    
    .submenu-item {
        padding: 10px 12px;
    }
    
    .submenu-text {
        font-size: 14px;
    }
    
    .submenu-icon {
        font-size: 14px;
        margin-right: 12px;
    }
    
    .bottom-nav-container .dropdown-menu {
        right: -20px;
        min-width: 160px;
        max-height: 250px;
    }
    
    html[dir=rtl] .bottom-nav-container .dropdown-menu {
        right: -140px;
        direction: rtl;
    }
    
    .bottom-nav-container .dropdown-item {
        padding: 10px 12px;
    }
    
    .dropdown-subitem {
        padding: 6px 10px;
        font-size: 13px;
    }
    
    .bottom-nav-container .menu-toggle {
        width: 40px;
        height: 40px;
        padding: 8px;
    }
    
    .hamburger {
        width: 16px;
        height: 12px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .bottom-nav {
        border: 2px solid #000;
        background: #fff;
    }
    
    .bottom-nav-container .nav-item.active {
        background: #000;
        color: #fff;
    }
    
    .nav-submenu {
        border: 2px solid #000;
    }
    
    .bottom-nav-container .dropdown-menu {
        border: 2px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .bottom-nav-container .nav-item,
    .bottom-nav-container .dropdown-menu,
    .bottom-nav-container .menu-toggle,
    .hamburger span,
    .nav-submenu,
    .submenu-overlay,
    .submenu-arrow {
        transition: none;
    }
    
    .bottom-nav-container .nav-item:hover,
    .bottom-nav-container .nav-item.active {
        transform: none;
    }
    
    .nav-item[data-has-submenu="true"]:hover .submenu-arrow {
        transform: none;
    }
}

/* Print styles - hide navigation */
@media print {
    .bottom-nav-container {
        display: none;
    }
}

/* Animation for smooth entrance */
.bottom-nav-container {
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(100px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Loading states */
.bottom-nav.loading {
    opacity: 0.7;
    pointer-events: none;
}

.nav-item.loading {
    opacity: 0.5;
}

.nav-item.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Smooth scrolling when navigation is clicked */
html {
    scroll-behavior: smooth;
}

/* Focus management for accessibility */
.nav-item:focus-visible,
.submenu-item:focus-visible,
.dropdown-item:focus-visible {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}

/* Animation for submenu items */
.submenu-item {
    opacity: 0;
    transform: translateX(-20px);
    animation: slideInLeft 0.3s ease forwards;
}

.submenu-item:nth-child(1) { animation-delay: 0.1s; }
.submenu-item:nth-child(2) { animation-delay: 0.15s; }
.submenu-item:nth-child(3) { animation-delay: 0.2s; }
.submenu-item:nth-child(4) { animation-delay: 0.25s; }
.submenu-item:nth-child(5) { animation-delay: 0.3s; }

@keyframes slideInLeft {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Custom scrollbar for submenu */
.nav-submenu::-webkit-scrollbar {
    width: 4px;
}

.nav-submenu::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.nav-submenu::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

.nav-submenu::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}