/* Modern Header Styles - Material UI Inspired */

/* Topbar Styles */
.modern-topbar {
    background: linear-gradient(135deg, #1a1c26 0%, #2d3748 100%);
    padding: 8px 0;
    font-size: 13px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modern-topbar.text-light {
    color: #ffffff !important;
}

.modern-topbar .topbar-left,
.modern-topbar .topbar-right {
    display: flex;
    align-items: center;
}

.modern-topbar a {
    color: #ffffff !important;
    text-decoration: none;
    transition: color 0.3s;
    opacity: 0.95;
}

.modern-topbar a:hover {
    color: #ffffff !important;
    opacity: 1;
}

.modern-topbar .topbar-widget {
    color: #ffffff !important;
    opacity: 0.95;
}

.modern-topbar .topbar-widget:hover {
    opacity: 1;
}

/* Header Styles */
.modern-header {
    background: transparent;
    box-shadow: none;
    position: relative;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: visible;
}

/* Ensure all text in header is white when not scrolled */
.modern-header:not(.scrolled) {
    color: #ffffff !important;
}

.modern-header:not(.scrolled) h1,
.modern-header:not(.scrolled) h2,
.modern-header:not(.scrolled) h3,
.modern-header:not(.scrolled) h4,
.modern-header:not(.scrolled) h5,
.modern-header:not(.scrolled) h6,
.modern-header:not(.scrolled) .title,
.modern-header:not(.scrolled) .site-title,
.modern-header:not(.scrolled) .logo,
.modern-header:not(.scrolled) div#logo,
.modern-header:not(.scrolled) div#logo * {
    color: #ffffff !important;
}

.modern-header .container {
    position: relative;
    overflow: visible;
}

.modern-header.scrolled {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12), 0 1px 4px rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.header-modern-content {
    padding: 4px 0;
    position: relative;
    overflow: visible;
}

.header-modern-content .row {
    margin-left: 0;
    margin-right: 0;
}

.header-modern-content .row > [class*="col-"] {
    padding-left: 15px;
    padding-right: 15px;
}

/* Menu row - full width - handled by container-fluid in HTML */

.modern-logo {
    position: relative;
    display: inline-block;
}

.modern-logo a {
    display: inline-block;
    padding: 10px 18px;
    background: linear-gradient(135deg, #1a1c26 0%, #2d3748 100%);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modern-logo a:hover {
    background: linear-gradient(135deg, #2d3748 0%, #1a1c26 100%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
}

.modern-logo img {
    max-height: 50px;
    width: auto;
    display: block;
    filter: brightness(1) drop-shadow(0 2px 4px rgba(255, 255, 255, 0.1));
}

.modern-header.scrolled .modern-logo a {
    padding: 8px 16px;
    background: linear-gradient(135deg, #1a1c26 0%, #2d3748 100%);
}

.modern-header.scrolled .modern-logo img {
    max-height: 42px;
}

/* Modern Menu Styles - Material UI Inspired */
.modern-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    background: #6B46C1;
    border-radius: 6px;
    overflow: visible;
    box-shadow: 0 2px 4px rgba(107, 70, 193, 0.2), 0 1px 2px rgba(107, 70, 193, 0.1);
    width: 100%;
    position: relative;
    min-height: 44px;
    height: 44px;
    flex-wrap: nowrap;
}

/* Ensure nav container doesn't clip dropdowns */
nav.d-none.d-lg-block {
    position: relative;
    overflow: visible;
}

.modern-menu > li {
    position: relative;
    margin: 0;
    padding: 0;
    height: 44px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.modern-menu > li.has-submenu {
    z-index: 1001;
}

.modern-menu > li.has-submenu:hover {
    z-index: 1002;
}

.modern-menu > li > a {
    display: flex;
    align-items: center;
    padding: 0 16px;
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    font-family: 'IRANSans', 'Tahoma', 'Arial', sans-serif;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    position: relative;
    height: 48px;
    border-left: 1px solid rgba(255, 255, 255, 0.12);
    overflow: hidden;
}

/* Ripple effect */
.modern-menu > li > a::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.modern-menu > li > a:hover::before {
    width: 300px;
    height: 300px;
}

.modern-menu > li:first-child > a {
    border-left: none;
    border-radius: 8px 0 0 8px;
}

.modern-menu > li:last-child > a {
    border-radius: 0 8px 8px 0;
}

.modern-menu > li > a i {
    margin-left: 8px;
    font-size: 16px;
    position: relative;
    z-index: 1;
}

.modern-menu > li > a span {
    position: relative;
    z-index: 1;
}

/* Dropdown arrow for items with submenu */
.modern-menu > li > a:after {
    content: '';
    display: none;
}

.modern-menu > li.has-submenu > a:after {
    content: '\f107';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    margin-right: 5px;
    font-size: 12px;
    display: inline-block;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1;
}

.modern-menu > li.has-submenu:hover > a:after {
    transform: rotate(180deg);
}

.modern-menu > li > a:hover,
.modern-menu > li.active > a {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.modern-menu > li.active > a {
    background: rgba(255, 255, 255, 0.16);
    font-weight: 600;
}

/* Submenu Styles - Material Design */
.modern-menu ul {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: #fff;
    min-width: 240px;
    list-style: none;
    margin: 0;
    padding: 8px 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.95);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9999;
    display: block;
}

.modern-menu > li:hover > ul,
.modern-menu > li.has-submenu:hover > ul {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    display: block;
}

.modern-menu ul li {
    margin: 0;
    padding: 0;
}

.modern-menu ul li a {
    display: block;
    padding: 12px 20px;
    color: rgba(0, 0, 0, 0.87);
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: right;
    position: relative;
}

.modern-menu ul li a::before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 0;
    background: rgba(107, 70, 193, 0.08);
    transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.modern-menu ul li a:hover {
    background: rgba(107, 70, 193, 0.04);
    color: #6B46C1;
    padding-right: 24px;
}

.modern-menu ul li a:hover::before {
    width: 3px;
}

@media (max-width: 1199px) {
    .modern-menu {
        min-height: 40px;
        height: 40px;
    }
    
    .modern-menu > li {
        height: 40px;
    }
    
    .modern-menu > li > a {
        padding: 0 10px;
        font-size: 12px;
        height: 40px;
    }
    
    .modern-menu > li > a i {
        margin-left: 5px;
        font-size: 13px;
    }
}

/* Mobile Menu Button - Material Design */
.modern-menu-btn,
#menu-btn {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 32px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 10001;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 4px;
    margin-left: 15px;
    margin-right: 0;
}

.modern-menu-btn:active,
#menu-btn:active {
    background: rgba(0, 0, 0, 0.05);
}

@media (min-width: 992px) {
    .modern-menu-btn,
    #menu-btn {
        display: none !important;
    }
}

.modern-menu-btn span,
#menu-btn span {
    width: 100%;
    height: 2.5px;
    background: #333;
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
    display: block;
}

.modern-header:not(.scrolled) .modern-menu-btn span,
.modern-header:not(.scrolled) #menu-btn span {
    background: #fff;
}

.modern-header.scrolled .modern-menu-btn span,
.modern-header.scrolled #menu-btn span {
    background: #333;
}

.modern-menu-btn.active,
#menu-btn.active {
    z-index: 10001;
}

.modern-menu-btn.active span:nth-child(1),
#menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
    background: #333;
}

.modern-menu-btn.active span:nth-child(2),
#menu-btn.active span:nth-child(2) {
    opacity: 0;
    transform: scale(0);
}

.modern-menu-btn.active span:nth-child(3),
#menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(8px, -8px);
    background: #333;
}

/* Mobile Menu Overlay */
#menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

#menu-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Mobile Menu - Material Drawer */
.modern-menu.d-lg-none {
    position: fixed;
    top: 0;
    right: -320px;
    width: 300px;
    max-width: 85%;
    height: 100vh;
    background: #fff;
    box-shadow: -2px 0 16px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    overflow-y: auto;
    overflow-x: hidden;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    margin: 0;
    list-style: none;
}

.modern-menu.d-lg-none.active {
    right: 0;
}

/* RTL Support for Mobile Menu */
[dir="rtl"] .modern-menu.d-lg-none {
    right: auto;
    left: -320px;
    box-shadow: 2px 0 16px rgba(0, 0, 0, 0.2);
}

[dir="rtl"] .modern-menu.d-lg-none.active {
    right: auto;
    left: 0;
}

html[dir="rtl"] .modern-menu.d-lg-none {
    right: auto;
    left: -320px;
}

html[dir="rtl"] .modern-menu.d-lg-none.active {
    right: auto;
    left: 0;
}

/* Mobile Menu Header */
.modern-menu.d-lg-none::before {
    content: '';
    display: block;
    height: 64px;
    background: linear-gradient(135deg, #6B46C1 0%, #7C3AED 100%);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Scrollbar styling for mobile menu */
.modern-menu.d-lg-none::-webkit-scrollbar {
    width: 6px;
}

.modern-menu.d-lg-none::-webkit-scrollbar-track {
    background: #f5f5f5;
}

.modern-menu.d-lg-none::-webkit-scrollbar-thumb {
    background: #6B46C1;
    border-radius: 3px;
}

.modern-menu.d-lg-none::-webkit-scrollbar-thumb:hover {
    background: #5a3aa8;
}

.modern-menu.d-lg-none > li {
    width: 100%;
    margin: 0;
    padding: 0;
    display: block;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.modern-menu.d-lg-none > li:first-child {
    border-top: none;
}

.modern-menu.d-lg-none > li > a {
    padding: 16px 20px;
    color: rgba(0, 0, 0, 0.87);
    background: transparent;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    width: 100%;
    box-sizing: border-box;
    text-align: right;
    direction: rtl;
    height: auto;
    border-left: none;
    border-radius: 0;
}

.modern-menu.d-lg-none > li > a::before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 0;
    background: rgba(107, 70, 193, 0.1);
    transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.modern-menu.d-lg-none > li > a:hover,
.modern-menu.d-lg-none > li > a:focus {
    background: rgba(107, 70, 193, 0.04);
    color: #6B46C1;
    padding-right: 24px;
}

.modern-menu.d-lg-none > li > a:hover::before,
.modern-menu.d-lg-none > li > a:focus::before {
    width: 3px;
}

.modern-menu.d-lg-none > li > a i {
    margin-left: 12px;
    margin-right: 0;
    color: #6B46C1;
    font-size: 18px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
    order: -1;
}

.modern-menu.d-lg-none > li.has-submenu > a {
    position: relative;
    padding-right: 50px;
    padding-left: 20px;
}

.modern-menu.d-lg-none > li.has-submenu > a:after {
    content: '\f107';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    color: rgba(0, 0, 0, 0.54);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: absolute;
    right: 20px;
    left: auto;
    font-size: 14px;
    line-height: 1;
}

.modern-menu.d-lg-none > li.active > a {
    background: rgba(107, 70, 193, 0.08);
    color: #6B46C1;
}

.modern-menu.d-lg-none > li.active > a:after {
    transform: rotate(180deg);
    color: #6B46C1;
}

.modern-menu.d-lg-none ul {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    background: rgba(0, 0, 0, 0.02);
    display: none;
    margin: 0;
    padding: 0;
    border-radius: 0;
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modern-menu.d-lg-none > li.active > ul {
    display: block;
    max-height: 1000px;
    padding: 4px 0;
}

.modern-menu.d-lg-none ul li {
    margin: 0;
    padding: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.modern-menu.d-lg-none ul li:last-child {
    border-bottom: none;
}

.modern-menu.d-lg-none ul li a {
    padding: 12px 50px 12px 20px;
    color: rgba(0, 0, 0, 0.7);
    text-decoration: none;
    font-size: 14px;
    display: block;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    text-align: right;
    font-weight: 400;
}

.modern-menu.d-lg-none ul li a::before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 0;
    background: rgba(107, 70, 193, 0.1);
    transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.modern-menu.d-lg-none ul li a:hover,
.modern-menu.d-lg-none ul li a:focus {
    background: rgba(107, 70, 193, 0.06);
    color: #6B46C1;
    padding-right: 54px;
}

.modern-menu.d-lg-none ul li a:hover::before,
.modern-menu.d-lg-none ul li a:focus::before {
    width: 3px;
}

.modern-menu.d-lg-none ul li a:before {
    content: '•';
    position: absolute;
    right: 30px;
    color: #6B46C1;
    font-size: 16px;
    line-height: 1;
    opacity: 0.6;
}

/* Phone Display */
.modern-phone {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: 8px;
    backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modern-phone:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.modern-phone span {
    color: #ffffff !important;
    opacity: 0.9;
    font-size: 12px;
    font-weight: 500;
    margin-left: 5px;
}

.modern-phone i {
    color: #ffffff;
    font-size: 18px;
    opacity: 0.9;
}

.modern-phone strong {
    color: #ffffff !important;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.5px;
}

/* Phone Display when header is scrolled */
.modern-header.scrolled .modern-phone {
    background: linear-gradient(135deg, #1a1c26 0%, #2d3748 100%);
    color: #ffffff;
}

.modern-header.scrolled .modern-phone span,
.modern-header.scrolled .modern-phone i,
.modern-header.scrolled .modern-phone strong {
    color: #ffffff !important;
}

/* Ensure menu button is visible on mobile */
@media (max-width: 991px) {
    .modern-menu.d-none.d-lg-block {
        display: none !important;
    }
    
    .modern-header {
        padding: 8px 0;
    }
    
    .modern-logo a {
        padding: 8px 14px;
    }
    
    .modern-logo img {
        max-height: 45px;
    }
    
    .modern-menu.d-lg-none {
        display: flex !important;
    }
}

@media (max-width: 768px) {
    .modern-topbar .sm-hide {
        display: none;
    }
    
    .modern-phone {
        display: none;
    }
    
    .modern-logo a {
        padding: 6px 12px;
    }
    
    .modern-logo img {
        max-height: 40px;
    }
    
    .modern-menu.d-lg-none {
        width: 280px;
        max-width: 85%;
    }
}

@media (max-width: 575px) {
    .modern-logo a {
        padding: 6px 10px;
    }
    
    .modern-logo img {
        max-height: 38px;
    }
    
    .modern-menu.d-lg-none {
        width: 260px;
        max-width: 90%;
    }
    
    .modern-menu.d-lg-none > li > a {
        padding: 14px 18px;
        font-size: 14px;
    }
    
    .modern-menu.d-lg-none ul li a {
        padding: 10px 45px 10px 18px;
        font-size: 13px;
    }
    
    .modern-menu-btn,
    #menu-btn {
        width: 28px;
        height: 20px;
    }
    
    .modern-menu-btn span,
    #menu-btn span {
        height: 2.5px;
    }
}

/* Body lock when menu is open */
body.menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
    left: 0;
    right: 0;
}

html.menu-open {
    overflow: hidden;
    height: 100%;
}

body.menu-open #wrapper {
    position: relative;
}

/* Ensure menu button is always clickable */
.modern-menu-btn,
#menu-btn {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    outline: none;
    order: 2;
}

.modern-menu-btn:focus,
#menu-btn:focus {
    outline: 2px solid #6B46C1;
    outline-offset: 2px;
}

/* Mobile header adjustments */
@media (max-width: 991px) {
    .header-modern-content .row.align-items-center {
        flex-wrap: nowrap;
    }
    
    .header-modern-content .d-flex {
        flex-wrap: nowrap;
        gap: 10px;
    }
    
    .modern-phone {
        order: 1;
        flex-shrink: 0;
    }
    
    #menu-btn {
        order: 2;
        flex-shrink: 0;
        margin-left: 15px;
        margin-right: 0;
    }
}

/* Additional RTL fixes */
[dir="rtl"] .modern-menu.d-lg-none ul li a {
    text-align: right;
    padding-right: 50px;
    padding-left: 20px;
}

[dir="rtl"] .modern-menu.d-lg-none ul li a:before {
    right: 30px;
    left: auto;
}

[dir="rtl"] .modern-menu.d-lg-none > li.has-submenu > a:after {
    right: 20px;
    left: auto;
}

[dir="rtl"] .modern-menu.d-lg-none > li > a i,
html[dir="rtl"] .modern-menu.d-lg-none > li > a i {
    margin-right: 12px;
    margin-left: 0;
    order: 1;
}
