/* ============================================
   Elementor Custom Header Widget - Styles
   Pixel-perfect conversion from React/Tailwind
   ============================================ */

/* CSS Variables for theming */
:root {
    --ehw-bg: #ffffff;
    --ehw-bg-secondary: #f9fafb;
    --ehw-text: #111827;
    --ehw-text-muted: #6b7280;
    --ehw-border: #e5e7eb;
    --ehw-accent: #3b82f6;
    --ehw-accent-hover: #2563eb;
    --ehw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
    --ehw-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

.dark {
    --ehw-bg: #030712;
    --ehw-bg-secondary: #111827;
    --ehw-text: #f9fafb;
    --ehw-text-muted: #9ca3af;
    --ehw-border: #374151;
    --ehw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.3);
    --ehw-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5);
}

/* ============================================
   Container
   ============================================ */
.ehw-container {
    max-width: 80rem;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

/* ============================================
   Top Bar
   ============================================ */
.ehw-top-bar {
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid rgba(var(--ehw-border), 0.4);
    background-color: var(--ehw-bg);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
}

.ehw-top-bar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    height: 100%;
}

.ehw-org-name {
    color: var(--ehw-text-muted);
    display: none;
}

@media (min-width: 640px) {
    .ehw-org-name {
        display: block;
    }
}

.ehw-top-bar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
}

.ehw-top-social {
    display: none;
    gap: 0.75rem;
}

@media (min-width: 768px) {
    .ehw-top-social {
        display: flex;
    }
}

.ehw-social-icon {
    color: var(--ehw-text-muted);
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
}

.ehw-social-icon:hover {
    color: var(--ehw-text);
}

.ehw-social-icon svg,
.ehw-social-icon i {
    width: 14px;
    height: 14px;
}

.ehw-divider {
    width: 1px;
    height: 1rem;
    background-color: var(--ehw-border);
}

.ehw-lang-toggle,
.ehw-theme-toggle {
    color: var(--ehw-text-muted);
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: color 0.2s ease;
    padding: 0;
    display: flex;
    align-items: center;
}

.ehw-lang-toggle:hover,
.ehw-theme-toggle:hover {
    color: var(--ehw-text);
}

.ehw-sun-icon,
.ehw-moon-icon {
    font-size: 1rem;
    line-height: 1;
}

/* ============================================
   Main Header
   ============================================ */
.ehw-main-header {
    position: sticky;
    z-index: 40;
    background-color: rgba(255, 255, 255, 0.5);
    transition: all 0.2s ease;
}

.ehw-main-header.ehw-sticky {
    position: sticky;
}

.ehw-main-header.ehw-scrolled {
    border-bottom: 1px solid rgba(var(--ehw-border), 0.4);
    background-color: var(--ehw-bg);
    backdrop-filter: blur(8px);
    box-shadow: var(--ehw-shadow);
}

/* Position main header below top bar */
.ehw-header-wrapper .ehw-main-header {
    top: 40px;
}

.ehw-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

/* ============================================
   Logo
   ============================================ */
.ehw-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
}

.ehw-logo-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
}

.ehw-logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--ehw-bg-secondary);
    color: var(--ehw-text);
    font-size: 1.125rem;
    font-weight: 700;
}

.ehw-logo-image {
    height: 40px;
    width: auto;
}

.ehw-logo-text {
    display: none;
}

@media (min-width: 640px) {
    .ehw-logo-text {
        display: block;
    }
}

.ehw-logo-title {
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1.2;
}

.ehw-logo-subtitle {
    font-size: 0.625rem;
    font-weight: 500;
    color: var(--ehw-text-muted);
    letter-spacing: 0.05em;
    line-height: 1.2;
}

/* ============================================
   Desktop Navigation
   ============================================ */
.ehw-desktop-nav {
    display: none;
    margin-left: 2rem;
    margin-right: auto;
}

@media (min-width: 1024px) {
    .ehw-desktop-nav {
        display: flex;
        align-items: center;
        gap: 0.25rem;
    }
}

.ehw-nav-menu {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.ehw-nav-menu li {
    position: relative;
}

.ehw-nav-menu li a,
.ehw-nav-menu li .ehw-nav-link {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--ehw-text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
    white-space: nowrap;
}

.ehw-nav-menu li a:hover,
.ehw-nav-menu li .ehw-nav-link:hover {
    color: var(--ehw-text);
}

/* Dropdown Arrow */
.ehw-nav-menu li > a .ehw-chevron,
.ehw-nav-menu li > a::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid currentcolor;
    margin-left: 4px;
    opacity: 0.6;
}

/* Dropdown Menu */
.ehw-nav-menu li .ehw-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    padding-top: 0.5rem;
    min-width: 240px;
    width: max-content;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all 0.15s ease;
    z-index: 100;
}

.ehw-nav-menu li:hover > .ehw-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.ehw-dropdown-inner {
    background-color: var(--ehw-bg);
    border: 1px solid var(--ehw-border);
    border-radius: 0.5rem;
    box-shadow: var(--ehw-shadow-lg);
    padding: 0.5rem;
}

.ehw-dropdown a {
    display: block;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: var(--ehw-text-muted);
    text-decoration: none;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
}

.ehw-dropdown a:hover {
    color: var(--ehw-text);
    background-color: rgba(var(--ehw-accent), 0.1);
}

/* Sub-dropdown (3rd level) */
.ehw-dropdown .ehw-sub-dropdown {
    position: relative;
}

.ehw-dropdown .ehw-sub-dropdown-menu {
    position: absolute;
    left: 100%;
    top: 0;
    padding-left: 0.5rem;
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-4px);
    transition: all 0.15s ease;
}

.ehw-dropdown .ehw-sub-dropdown:hover > .ehw-sub-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.ehw-sub-dropdown-menu-inner {
    background-color: var(--ehw-bg);
    border: 1px solid var(--ehw-border);
    border-radius: 0.5rem;
    box-shadow: var(--ehw-shadow-lg);
    padding: 0.5rem;
}

.ehw-sub-dropdown-menu a {
    display: block;
    padding: 0.375rem 1rem;
    font-size: 0.75rem;
    color: var(--ehw-text-muted);
    text-decoration: none;
    border-radius: 0.25rem;
}

.ehw-sub-dropdown-menu a::before {
    content: '• ';
}

/* ============================================
   Actions
   ============================================ */
.ehw-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ehw-search-btn {
    padding: 0.5rem;
    color: var(--ehw-text-muted);
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
}

.ehw-search-btn:hover {
    color: var(--ehw-text);
}

.ehw-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: var(--ehw-accent);
    color: white;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.5rem;
    text-decoration: none;
    transition: background-color 0.2s ease;
    border: none;
    cursor: pointer;
    white-space: nowrap;
}

.ehw-btn-primary:hover {
    background-color: var(--ehw-accent-hover);
}

.ehw-mobile-menu-btn {
    display: flex;
    padding: 0.5rem;
    color: var(--ehw-text-muted);
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s ease;
}

@media (min-width: 1024px) {
    .ehw-mobile-menu-btn {
        display: none;
    }
}

@media (min-width: 1024px) {
    .ehw-login-btn,
    .ehw-profile-btn {
        display: flex;
    }
}

@media (max-width: 1023px) {
    .ehw-login-btn,
    .ehw-profile-btn {
        display: none;
    }
}

/* ============================================
   Search Overlay
   ============================================ */
.ehw-search-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.dark .ehw-search-overlay {
    background-color: rgba(3, 7, 18, 0.95);
}

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

.ehw-search-close {
    position: absolute;
    right: 1.5rem;
    top: 1.5rem;
    padding: 0.5rem;
    color: var(--ehw-text-muted);
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s ease;
}

.ehw-search-close:hover {
    color: var(--ehw-text);
}

.ehw-search-content {
    width: 100%;
    max-width: 42rem;
}

.ehw-search-input {
    width: 100%;
    border: none;
    border-bottom: 2px solid var(--ehw-border);
    background: transparent;
    padding-bottom: 1rem;
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--ehw-text);
    outline: none;
    transition: border-color 0.2s ease;
}

.ehw-search-input::placeholder {
    color: rgba(var(--ehw-text-muted), 0.4);
}

.ehw-search-input:focus {
    border-bottom-color: var(--ehw-accent);
}

.ehw-search-hint {
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--ehw-text-muted);
}

/* ============================================
   Mobile Menu
   ============================================ */
.ehw-mobile-menu {
    position: fixed;
    inset: 0;
    z-index: 90;
    background-color: var(--ehw-bg);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

@media (min-width: 1024px) {
    .ehw-mobile-menu {
        display: none;
    }
}

.ehw-mobile-menu.ehw-active {
    opacity: 1;
    visibility: visible;
}

.ehw-mobile-menu-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1.5rem;
    position: relative;
}

.ehw-mobile-close {
    position: absolute;
    right: 1.5rem;
    top: 1.5rem;
    padding: 0.5rem;
    color: var(--ehw-text-muted);
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s ease;
    z-index: 10;
}

.ehw-mobile-close:hover {
    color: var(--ehw-text);
}

.ehw-mobile-nav {
    margin-top: 4rem;
    flex: 1;
    overflow-y: auto;
}

.ehw-mobile-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ehw-mobile-nav-list > li {
    margin-bottom: 0.5rem;
}

.ehw-mobile-nav-list > li > a,
.ehw-mobile-nav-list > li > .ehw-mobile-nav-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--ehw-text);
    text-decoration: none;
    border-radius: 0.5rem;
    transition: background-color 0.2s ease;
}

.ehw-mobile-nav-list > li > a:hover,
.ehw-mobile-nav-list > li > .ehw-mobile-nav-btn:hover {
    background-color: rgba(var(--ehw-accent), 0.1);
}

.ehw-mobile-nav-btn {
    background: none;
    border: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
    font-family: inherit;
}

.ehw-mobile-chevron {
    transition: transform 0.2s ease;
}

.ehw-mobile-chevron.ehw-rotated {
    transform: rotate(180deg);
}

/* Mobile Submenu */
.ehw-mobile-submenu {
    margin-right: 1rem;
    margin-top: 0.5rem;
    padding-right: 1rem;
    border-right: 2px solid var(--ehw-border);
    list-style: none;
}

.ehw-mobile-submenu li {
    margin-bottom: 0.25rem;
}

.ehw-mobile-submenu a {
    display: block;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: var(--ehw-text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

.ehw-mobile-submenu a:hover {
    color: var(--ehw-text);
}

/* Mobile Footer */
.ehw-mobile-footer {
    border-top: 1px solid var(--ehw-border);
    padding-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ehw-mobile-social-section {}

.ehw-mobile-social-title {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--ehw-text-muted);
    margin-bottom: 0.75rem;
}

.ehw-mobile-social-icons {
    display: flex;
    gap: 0.75rem;
    padding: 0 1rem;
}

.ehw-mobile-social-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border: 1px solid var(--ehw-border);
    border-radius: 0.5rem;
    color: var(--ehw-text-muted);
    text-decoration: none;
    transition: all 0.2s ease;
}

.ehw-mobile-social-icon:hover {
    border-color: var(--ehw-accent);
    background-color: rgba(var(--ehw-accent), 0.1);
    color: var(--ehw-accent);
}

.ehw-mobile-social-icon svg,
.ehw-mobile-social-icon i {
    width: 20px;
    height: 20px;
}

.ehw-mobile-login-btn,
.ehw-mobile-profile-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    background-color: var(--ehw-accent);
    color: white;
    font-size: 1.125rem;
    font-weight: 500;
    border-radius: 0.5rem;
    text-decoration: none;
    transition: background-color 0.2s ease;
    width: 100%;
}

.ehw-mobile-login-btn:hover,
.ehw-mobile-profile-btn:hover {
    background-color: var(--ehw-accent-hover);
}

/* ============================================
   Elementor Editor Mode Styles
   ============================================ */
.ehw-nav-placeholder {
    padding: 1rem;
    background: #f3f4f6;
    border-radius: 0.5rem;
    text-align: center;
}

/* ============================================
   Responsive Adjustments
   ============================================ */
@media (max-width: 639px) {
    .ehw-container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* Ensure proper z-index stacking */
.ehw-header-wrapper {
    position: relative;
}

/* ============================================
   WordPress Nav Menu Override
   ============================================ */
.ehw-nav-menu .sub-menu {
    position: absolute;
    right: 0;
    top: 100%;
    padding-top: 0.5rem;
    min-width: 240px;
    width: max-content;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all 0.15s ease;
    z-index: 100;
}

.ehw-nav-menu li:hover > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.ehw-nav-menu .sub-menu .sub-menu {
    position: absolute;
    left: 100%;
    top: 0;
    padding-left: 0.5rem;
    right: auto;
}

.ehw-nav-menu .menu-item {
    position: relative;
}

.ehw-nav-menu .menu-item > a {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--ehw-text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
    white-space: nowrap;
}

.ehw-nav-menu .menu-item > a:hover {
    color: var(--ehw-text);
}

.ehw-nav-menu .menu-item-has-children > a::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid currentcolor;
    margin-left: 4px;
    opacity: 0.6;
}

/* Mobile Nav WordPress Menu Override */
.ehw-mobile-nav-list .sub-menu {
    margin-right: 1rem;
    margin-top: 0.5rem;
    padding-right: 1rem;
    border-right: 2px solid var(--ehw-border);
    list-style: none;
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    display: none;
}

.ehw-mobile-nav-list .menu-item-has-children.ehw-expanded > .sub-menu {
    display: block;
}

.ehw-mobile-nav-list .menu-item > a {
    display: block;
    padding: 0.75rem 1rem;
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--ehw-text);
    text-decoration: none;
    border-radius: 0.5rem;
    transition: background-color 0.2s ease;
}

.ehw-mobile-nav-list .menu-item > a:hover {
    background-color: rgba(var(--ehw-accent), 0.1);
}

.ehw-mobile-nav-list .menu-item-has-children > a {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ============================================
   Dark Mode Support
   ============================================ */
.dark .ehw-top-bar {
    background-color: rgba(3, 7, 18, 0.95);
    border-bottom-color: rgba(55, 65, 81, 0.4);
}

.dark .ehw-main-header {
    background-color: rgba(3, 7, 18, 0.5);
}

.dark .ehw-main-header.ehw-scrolled {
    background-color: rgba(3, 7, 18, 0.8);
}

.dark .ehw-logo-icon {
    background-color: #1f2937;
}

.dark .ehw-dropdown-inner {
    background-color: #111827;
    border-color: #374151;
}

.dark .ehw-mobile-menu {
    background-color: #030712;
}

/* ============================================
   RTL Support (for Persian/Farsi)
   ============================================ */
[dir="rtl"] .ehw-nav-menu {
    flex-direction: row-reverse;
}

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

[dir="rtl"] .ehw-dropdown .ehw-sub-dropdown-menu {
    left: 100%;
    right: auto;
    padding-left: 0.5rem;
    padding-right: 0;
}

[dir="rtl"] .ehw-nav-menu .menu-item-has-children > a::after {
    margin-left: 0;
    margin-right: 4px;
}

[dir="rtl"] .ehw-mobile-submenu {
    border-right: none;
    border-left: 2px solid var(--ehw-border);
    margin-right: 0;
    margin-left: 1rem;
    padding-right: 0;
    padding-left: 1rem;
}
