/* Modern Navbar Design for Ahdjez */

.modern-navbar {
    background-color: #ffffff;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
                0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: 0.75rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all 0.3s ease;
    font-family: 'Tajawal', sans-serif;
}

.modern-navbar.scrolled {
padding: 0.5rem 1.5rem;
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
            0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.navbar-container {
display: flex;
justify-content: space-between;
align-items: center;
max-width: 1280px;
margin: 0 auto;
position: relative;
}

.navbar-brand {
display: flex;
align-items: center;
z-index: 1002;
}

.navbar-brand img {
height: 40px;
transition: all 0.3s ease;
}

.scrolled .navbar-brand img {
height: 35px;
}

.navbar-menu-container {
display: flex;
align-items: center;
flex: 1;
justify-content: space-between;
margin-left: 2rem;
}

.menu-header,
.mobile-brand {
display: none;
}

.navbar-menu {
display: flex;
align-items: center;
margin: 0;
padding: 0;
list-style: none;
}


.nav-right {
    margin-right: 5px; /* adjust spacing as needed */
  }

.navbar-item {
margin: 0 0.75rem;
position: relative;
}

.navbar-link {
color: #4b5563;
text-decoration: none;
font-weight: 500;
font-size: 1rem;
padding: 0.5rem 0;
transition: all 0.3s ease;
position: relative;
display: flex;
align-items: center;
}

.navbar-link:hover,
.navbar-link.active {
color: #3b82f6;
}

.navbar-link i {
margin: 0 0.25rem;
font-size: 0.75rem;
transition: transform 0.3s ease;
}

.navbar-link::after {
content: '';
position: absolute;
bottom: 0;
left: 0;
width: 0;
height: 2px;
background-color: #3b82f6;
transition: width 0.3s ease;
}

.navbar-link:hover::after,
.navbar-link.active::after {
width: 100%;
}

.navbar-link.active {
font-weight: 600;
}

.navbar-dropdown {
position: relative;
}


/* .dropdown-menu {
position: absolute;
top: 110%;
left: 0;
background-color: #ffffff;
border-radius: 0.5rem;
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
min-width: 220px;
padding: 0.75rem 0;
transform: translateY(5px);
transition: all 0.5s ease;
z-index: 1;
list-style: none;
display: none;
} */

  
/****** *****************************************************/

.dropdown-item:hover {
    background-color: #f3f4f6;
    color: #3b82f6;
}

/* Desktop only: show dropdown on hover. On mobile, JS .active class handles it */
@media (min-width: 993px) {
    .navbar-dropdown:hover > .dropdown-menu {
        display: block;
    }
}

/* Nested dropdowns */
.navbar-dropdown .navbar-dropdown {
    position: relative;
}

.navbar-dropdown .navbar-dropdown > .dropdown-menu {
    top: 0;
    right: 100%; /* for RTL */
}

.dropdown-divider {
    height: 1px;
    margin: 0.5rem 0;
    background-color: #e5e7eb;
}
/***** ********************************************************/


.navbar-actions {
display: flex;
align-items: center;
}

.navbar-cta {
display: flex;
align-items: center;
margin-left: 1.5rem;
}

.navbar-button {
background-color: #3b82f6;
color: #ffffff;
border: none;
border-radius: 0.375rem;
padding: 0.5rem 1.25rem;
font-size: 0.95rem;
font-weight: 500;
cursor: pointer;
transition: all 0.3s ease;
text-decoration: none;
display: inline-block;
}

.navbar-button:hover {
background-color: #2563eb;
transform: translateY(-2px);
box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.5);
}

.navbar-button-outline {
background-color: transparent;
border: 1px solid #3b82f6;
color: #3b82f6;
margin-left: 0.5rem;
}

.navbar-button-outline:hover {
background-color: #3b82f6;
color: #ffffff;
}

.navbar-toggle,
.menu-close {
display: none;
background: none;
border: none;
color: #4b5563;
font-size: 1.5rem;
cursor: pointer;
padding: 0.25rem;
z-index: 1002;
}

.menu-close {
font-size: 1.25rem;
}

.navbar-toggle:focus,
.menu-close:focus {
outline: none;
}

.language-switcher {
display: flex;
align-items: center;
margin-left: 1.5rem;
}

.language-button {
background: none;
border: 1px solid #e5e7eb;
border-radius: 0.375rem;
padding: 0.375rem 0.75rem;
font-size: 0.875rem;
color: #4b5563;
cursor: pointer;
display: flex;
align-items: center;
transition: all 0.3s ease;
}

.language-button:hover {
border-color: #3b82f6;
color: #3b82f6;
}

.language-button i {
margin-right: 0.375rem;
font-size: 1rem;
}

.navbar-search {
position: relative;
margin-left: 1.5rem;
}

.navbar-search {
    position: relative;
    display: flex;
    align-items: center;
}

/* Hide form by default */
.search-form {
    display: none;
}

/* Show form when navbar-search or its children are focused */
.navbar-search:focus-within .search-form {
    display: block;
    position: absolute;
    top: 100%;
    right: 0;
    background: #fff;
    padding: 5px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    z-index: 1000;
}

.search-input {
    background-color: #f3f4f6;
    border: none;
    border-radius: 9999px;
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    font-size: 0.875rem;
    width: 200px;
    transition: all 0.3s ease;
    visibility: hidden; /* Hide by default */
    opacity: 0;
    width: 0;
}

.search-input.show {
    visibility: visible;
    opacity: 1;
    width: 200px; /* Width when shown */
}

.search-input:focus {
    outline: none;
    background-color: #ffffff;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
    width: 250px;
}

.search-icon-button {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-icon {
    color: #9ca3af;
    font-size: 1.2rem;
    transition: color 0.3s ease;
}

.search-icon-button:hover .search-icon {
    color: #3b82f6;
}

/* RTL Support */
[dir="rtl"] .navbar-menu-container {
margin-left: 0;
margin-right: 2rem;
}

[dir="rtl"] .navbar-link::after {
left: auto;
right: 0;
}

[dir="rtl"] .dropdown-menu {
left: auto;
right: 0;
}

[dir="rtl"] .navbar-cta,
[dir="rtl"] .language-switcher,
[dir="rtl"] .navbar-search {
margin-left: 0;
margin-right: 1.5rem;
}

[dir="rtl"] .language-button i {
margin-left: 0.375rem;
margin-right: 0;
}

[dir="rtl"] .search-icon {
left: auto;
right: 0.75rem;
}

[dir="rtl"] .search-input {
padding: 0.5rem 2.5rem 0.5rem 1rem;
}

[dir="rtl"] .navbar-button-outline {
margin-left: 0;
margin-right: 0.5rem;
}

/* Mobile Overlay */
.navbar-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 999;
opacity: 0;
visibility: hidden;
transition: opacity 0.3s ease;
}

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

/* Responsive Design */
@media (max-width: 1200px) {
    .search-input {
        width: 180px;
    }
    
    .search-input:focus {
        width: 220px;
    }
    
    .navbar-item {
        margin: 0 0.5rem;
    }
}

@media (max-width: 992px) {
    .navbar-container {
        flex-wrap: wrap;
    }
    
    .navbar-toggle {
        display: block;
    }
    
    .menu-close {
        display: block;
    }
    
    .menu-header {
        display: flex;
    }
    
    .mobile-brand {
        display: block;
    }
    
    .navbar-menu-container {
        position: fixed;
        top: 0;
        left: -320px;
        width: 320px;
        height: 100vh;
        background-color: #ffffff;
        box-shadow: 4px 0 10px rgba(0, 0, 0, 0.1);
        transition: all 0.3s ease;
        z-index: 1001;
        overflow-y: auto;
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
        margin-left: 0;
        padding-bottom: 2rem;
    }
    
    [dir="rtl"] .navbar-menu-container {
        left: auto;
        right: -320px;
        margin-right: 0;
    }
    
    .navbar-menu-container.active {
        left: 0;
    }
    
    [dir="rtl"] .navbar-menu-container.active {
        right: 0;
    }
    
    .navbar-menu {
        flex-direction: column;
        align-items: flex-start;
        padding: 1rem;
        width: 100%;
    }
    
    .navbar-item {
        margin: 0.5rem 0;
        width: 100%;
    }
    
    .navbar-link {
        padding: 0.75rem 0;
        width: 100%;
        justify-content: space-between;
        font-size: 1.1rem;
    }
    
    .navbar-link::after {
        display: none;
    }
    
    .dropdown-menu {
        position: static;
        box-shadow: none;
        opacity: 1;
        visibility: visible;
        transform: none;
        padding: 0;
        margin: 0.25rem 0 0.25rem 1.5rem;
        display: none;
        width: 100%;
        border-left: 2px solid #e5e7eb;
    }
    
    .navbar-dropdown.active .dropdown-menu {
        display: block;
    }
    
    .dropdown-item {
        padding: 0.75rem 1rem;
    }
    
    .navbar-actions {
        flex-direction: column;
        width: 100%;
        padding: 1rem;
        border-top: 1px solid #e5e7eb;
    }
    
    .navbar-search,
    .language-switcher,
    .navbar-cta {
        margin: 0.75rem 0;
        width: 100%;
    }
    
    .navbar-search {
        order: -1;
    }
    
    .search-input,
    .search-input:focus {
        width: 100%;
    }
    
    .navbar-cta {
        flex-direction: column;
    }
    
    .navbar-button {
        width: 100%;
        text-align: center;
        margin-bottom: 0.5rem;
    }
    
    .navbar-button-outline {
        margin-left: 0;
        margin-top: 0.5rem;
    }
    
    [dir="rtl"] .navbar-button-outline {
        margin-right: 0;
    }
}

@media (max-width: 576px) {
    .modern-navbar {
        padding: 0.5rem 1rem;
    }
    
    .navbar-menu-container {
        width: 280px;
        left: -280px;
    }
    
    [dir="rtl"] .navbar-menu-container {
        right: -280px;
    }
    
    .navbar-brand img {
        height: 35px;
    }
}
