/* Header */
header {
    background-color: var(--white-color);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05); /* Softer shadow */
    position: sticky;
    top: 0;
    z-index: 3000; /* Keep header and its children above page content */
    padding: 10px 0; /* Add some padding */
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo img {
    max-height: 50px; /* Adjust as needed */
    width: auto;
    vertical-align: middle;
    filter: brightness(0) saturate(100%) invert(14%) sepia(93%) saturate(3015%) hue-rotate(325deg) brightness(68%) contrast(118%);
}

nav ul {
    display: flex;
    align-items: center;
}

nav ul li {
    margin-right: 20px; /* Standardized spacing */
    position: relative;
}

nav ul li a {
    color: var(--text-color); /* Changed to text color for better contrast */
    font-weight: bold;
    padding: 15px 0; /* Increased padding for larger click area */
    transition: color 0.3s ease;
    position: relative;
}

nav ul li a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 5px;
    right: 0;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

nav ul li a:hover::after,
nav ul li a.active::after {
    width: 100%;
}

.language-switch-wrapper {
    display: flex;
    align-items: center;
    margin-left: 20px; /* Default for LTR */
}

html[dir="rtl"] .language-switch-wrapper {
    margin-left: 0;
    margin-right: 20px;
}

/* The switch - the box around the slider */
.language-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
}

/* Hide default HTML checkbox */
.language-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

/* The slider */
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--accent-color);
  -webkit-transition: .4s;
  transition: .4s;
  border-radius: 28px;
}

.slider:before {
  position: absolute;
  content: "UR";
  color: var(--primary-color);
  font-weight: bold;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  -webkit-transition: .4s;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--primary-color);
}

input:checked + .slider:before {
  content: "EN";
  -webkit-transform: translateX(22px);
  -ms-transform: translateX(22px);
  transform: translateX(22px);
}

/* Dropdown Menu */
.dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--white-color);
    min-width: 200px; /* Wider dropdown */
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    z-index: 3500; /* Above page content, below mobile nav */
    border-radius: 5px;
    right: 0;
    border-top: 3px solid var(--primary-color); /* Add accent */
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.dropdown-content a {
    color: var(--text-color);
    padding: 12px 16px;
    display: block;
    text-align: left;
}

html[dir="rtl"] .dropdown-content a {
    text-align: right;
}

.dropdown-content a:hover {
    background-color: var(--light-color);
    color: var(--primary-color);
}

.dropdown:hover .dropdown-content {
    display: block;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Dropdown toggle button - hidden on desktop */
.dropdown-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    font-size: 10px;
    line-height: 1;
    padding: 0;
    transition: transform 0.3s ease;
}

/* Navigation Styles */
.main-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
}

.main-nav ul li {
    position: relative;
    margin-right: 20px; /* Standardized spacing for RTL */
}

.main-nav ul li a {
    color: var(--text-color); /* Changed to text color for better contrast */
    text-decoration: none;
    padding: 10px 15px;
    display: block;
    transition: background-color 0.3s ease;
}

.main-nav ul li a:hover {
    background-color: var(--light-color); /* Changed to light color for better contrast */
    border-radius: 5px;
}

/* Hamburger Menu Styles */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    cursor: pointer;
    padding: 5px;
    z-index: 20;
    background-color: var(--light-color); /* Added background for better visibility */
}

.menu-toggle .bar {
    width: 100%;
    height: 3px;
    background-color: var(--primary-color); /* Changed to primary color for better contrast */
    border-radius: 5px;
    transition: all 0.3s ease-in-out;
    transform-origin: center;
}

/* Hamburger menu animation */
.menu-toggle.active .bar:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle.active .bar:nth-child(2) {
    opacity: 0;
    transform: scale(0);
}

.menu-toggle.active .bar:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Responsive Styles */
@media (max-width: 768px) {
    header .container {
        justify-content: center;
        position: relative;
    }

    .menu-toggle {
        display: flex;
        position: absolute;
        left: 20px;
        top: 50%;
        transform: translateY(-50%);
    }

    .main-nav {
        display: none;
        flex-direction: column;
        width: 100%;
        position: absolute;
        top: 60px; /* Adjust based on header height */
        left: 0;
        background-color: var(--white-color);
        padding: 10px 0;
        box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
        z-index: 4000; /* Ensure mobile nav overlays all content */
    }

    .main-nav.active {
        display: flex;
        z-index: 4000; /* Explicitly ensure active menu is on top */
    }

    .main-nav ul {
        flex-direction: column;
        width: 100%;
    }

    .main-nav ul li {
        margin: 0;
        text-align: center;
    }

    .main-nav ul li a {
        color: var(--text-color);
        padding: 15px;
        border-bottom: 1px solid #eee;
    }

    .main-nav ul li:last-child a {
        border-bottom: none;
    }

    .language-switch-wrapper {
        display: none;
    }

    .dropdown {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        border-bottom: 1px solid #eee;
    }

    .dropdown > a {
        flex: 1;
        text-align: left;
        border-bottom: none;
        cursor: pointer;
    }

    html[dir="rtl"] .dropdown > a {
        text-align: right;
    }

    .dropdown-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
    }

    .dropdown.open .dropdown-toggle {
        transform: rotate(180deg);
    }

    .dropdown-content {
        display: none;
        position: static;
        background-color: var(--white-color);
        color: var(--text-color);
        width: 100%;
        box-shadow: none;
        border-radius: 0;
        border: none;
        opacity: 1;
        visibility: visible;
        transform: none;
        transition: none;
    }

    .main-nav .dropdown.open .dropdown-content {
        display: block;
    }

    .dropdown-content a {
        padding: 12px 30px;
        border-bottom: 1px solid #eee;
    }

    .dropdown-content a:last-child {
        border-bottom: none;
    }

    .dropdown:hover .dropdown-content {
        display: none; /* Disable hover on mobile */
    }
}

@media (max-width: 768px) {
    .container {
        width: 95%;
    }
}

/* Footer */
footer {
    background-color: var(--dark-color);
    color: var(--text-light);
    padding: 40px 0 20px;
    text-align: center;
    width: 100%;
    margin: 0;
}

footer .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

footer .container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.footer-links {
    margin-bottom: 20px;
}

.footer-links a {
    color: var(--text-light);
    margin: 0 15px;
    font-size: 1rem;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: var(--accent-color);
}

.social-icons {
    margin-bottom: 20px;
}

.social-icons a {
    color: var(--text-light);
    margin: 0 10px;
    font-size: 1.5rem;
    transition: color 0.3s ease, transform 0.3s ease;
}

.social-icons a:hover {
    color: var(--accent-color);
    transform: translateY(-3px);
}

footer .copyright {
    font-size: 0.9rem;
    opacity: 0.8;
}
