/**
 * Header Redesign - TeslaServer Theme
 * هدر تک‌خطی، منظم و شیک بدون topbar
 */

/* Main Navbar - Single Line Clean Header */
.header .navbar-main {
    background: #ffffff;
    border-bottom: 2px solid #e3f2fd;
    padding: 0.75rem 0;
    box-shadow: 0 2px 8px rgba(0, 128, 255, 0.08);
}

.header .navbar-main .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

/* Logo - Right Side */
.header .navbar-brand {
    flex-shrink: 0;
    margin: 0;
    padding: 0;
}

.header .navbar-brand .logo-img {
    max-height: 50px;
    width: auto;
    transition: transform 0.3s ease;
}

.header .navbar-brand:hover .logo-img {
    transform: scale(1.05);
}

/* Center Section - Notifications, Phone, Search, Account */
.navbar-center {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    justify-content: center;
    padding: 0 1rem;
}

/* Notification Button */
.header-icon-btn {
    position: relative;
    background: transparent;
    border: 1px solid #e3f2fd;
    border-radius: 10px;
    padding: 0.6rem 0.8rem;
    color: #64748b;
    transition: all 0.3s ease;
    cursor: pointer;
    flex-shrink: 0;
}

.header-icon-btn:hover {
    background: #e3f2fd;
    border-color: #bbdefb;
    color: #0080FF;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 128, 255, 0.15);
}

.header-icon-btn i {
    font-size: 1.2rem;
}

.header-icon-btn .badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: linear-gradient(135deg, #ff4757 0%, #e81e3e 100%);
    color: white;
    font-size: 0.7rem;
    padding: 0.25rem 0.45rem;
    border-radius: 12px;
    border: 2px solid white;
    font-weight: 700;
    min-width: 20px;
    text-align: center;
}

/* Phone Button - Green Elegant */
.header-phone-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8f4 100%);
    border: 1px solid #a5d6a7;
    border-radius: 25px;
    color: #2e7d32;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    transition: all 0.3s ease;
    direction: ltr;
    flex-shrink: 0;
}

.header-phone-btn:hover {
    background: linear-gradient(135deg, #c8e6c9 0%, #e8f5e9 100%);
    border-color: #81c784;
    color: #1b5e20;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.2);
    text-decoration: none;
}

.header-phone-btn i {
    font-size: 1.1rem;
    color: #4caf50;
    animation: ring 2s ease-in-out infinite;
}

@keyframes ring {
    0%, 100% { transform: rotate(0deg); }
    10%, 30% { transform: rotate(-10deg); }
    20% { transform: rotate(10deg); }
}

.header-phone-btn .phone-text {
    font-size: 1rem;
    font-weight: 700;
}

.header-phone-btn .phone-ext {
    font-size: 0.8rem;
    color: #66bb6a;
    font-weight: 500;
    margin-right: 0.3rem;
}

/* Search Form - Clean & Elegant */
.header-search-form {
    flex: 1;
    max-width: 400px;
    margin: 0;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: #f8f9fa;
    border: 1px solid #e3f2fd;
    border-radius: 25px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.search-input-wrapper:focus-within {
    background: white;
    border-color: #0080FF;
    box-shadow: 0 0 0 3px rgba(0, 128, 255, 0.1);
}

.search-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0.65rem 1rem;
    font-size: 0.9rem;
    color: #1e293b;
    outline: none;
    text-align: right;
    direction: rtl;
}

.search-input::placeholder {
    color: #94a3b8;
    text-align: right;
}

.search-btn {
    background: linear-gradient(135deg, #0080FF 0%, #0066CC 100%);
    border: none;
    color: white;
    padding: 0.65rem 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.search-btn:hover {
    background: linear-gradient(135deg, #0066CC 0%, #004d99 100%);
}

.search-btn i {
    font-size: 1rem;
}

/* Account Button */
.header-account-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.header-account-btn .account-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border: 1px solid #90caf9;
    border-radius: 25px;
    color: #0080FF;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.3s ease;
}

.header-account-btn .account-link:hover {
    background: linear-gradient(135deg, #bbdefb 0%, #90caf9 100%);
    border-color: #64b5f6;
    color: #0066CC;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 128, 255, 0.2);
    text-decoration: none;
}

.header-account-btn .account-link i {
    font-size: 1.2rem;
}

.header-account-btn .account-name {
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-account-btn .admin-return-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border: 1px solid #ffb74d;
    border-radius: 50%;
    color: #f57c00;
    text-decoration: none;
    transition: all 0.3s ease;
}

.header-account-btn .admin-return-btn:hover {
    background: linear-gradient(135deg, #ffe0b2 0%, #ffcc80 100%);
    border-color: #ffa726;
    color: #e65100;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 124, 0, 0.2);
}

/* Right Section - Cart & Hamburger */
.navbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

/* Cart Button */
.header-cart-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, #0080FF 0%, #0066CC 100%);
    border-radius: 12px;
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.header-cart-btn:hover {
    background: linear-gradient(135deg, #0066CC 0%, #004d99 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 128, 255, 0.3);
    color: white;
    text-decoration: none;
}

.header-cart-btn i {
    font-size: 1.3rem;
    color: white;
}

.header-cart-btn .badge {
    position: absolute;
    top: -8px;
    left: -8px;
    background: linear-gradient(135deg, #ff4757 0%, #e81e3e 100%);
    color: white;
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    border: 2px solid white;
    font-weight: 700;
    min-width: 22px;
    text-align: center;
}

/* Hamburger Menu */
.header-hamburger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    background: transparent;
    border: 1px solid #e3f2fd;
    border-radius: 12px;
    color: #0080FF;
    cursor: pointer;
    transition: all 0.3s ease;
}

.header-hamburger:hover {
    background: #e3f2fd;
    border-color: #bbdefb;
    color: #0066CC;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 128, 255, 0.15);
}

.header-hamburger i {
    font-size: 1.3rem;
}

/* Client Alerts Popup */
#accountNotificationsContent .client-alerts {
    list-style: none;
    padding: 0;
    margin: 0;
    min-width: 300px;
    max-width: 400px;
}

#accountNotificationsContent .client-alerts li {
    border-bottom: 1px solid #e3f2fd;
}

#accountNotificationsContent .client-alerts li:last-child {
    border-bottom: none;
}

#accountNotificationsContent .client-alerts a {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    text-decoration: none;
    color: #1e293b;
    transition: all 0.2s ease;
}

#accountNotificationsContent .client-alerts a:hover {
    background: #e3f2fd;
}

#accountNotificationsContent .client-alerts i {
    font-size: 1.2rem;
    margin-top: 0.2rem;
    flex-shrink: 0;
}

#accountNotificationsContent .client-alerts i.fa-info-circle {
    color: #0080FF;
}

#accountNotificationsContent .client-alerts i.fa-exclamation-triangle {
    color: #ff4757;
}

#accountNotificationsContent .client-alerts i.fa-exclamation-circle {
    color: #ff4757;
}

#accountNotificationsContent .client-alerts i.fa-check-circle {
    color: #4caf50;
}

#accountNotificationsContent .client-alerts .message {
    flex: 1;
    font-size: 0.85rem;
    line-height: 1.5;
}

#accountNotificationsContent .client-alerts .none {
    padding: 1rem;
    text-align: center;
    color: #94a3b8;
    font-size: 0.9rem;
}

/* Main Navigation Below */
.header .main-navbar-wrapper {
    background: #ffffff;
    border-bottom: 1px solid #e3f2fd;
    box-shadow: 0 1px 3px rgba(0, 128, 255, 0.05);
}

/* Mobile Header Items */
.mobile-header-items {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.mobile-notif-btn,
.mobile-phone-btn,
.mobile-account-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: white;
    border: 1px solid #e3f2fd;
    border-radius: 10px;
    color: #1e293b;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    position: relative;
}

.mobile-notif-btn:hover,
.mobile-phone-btn:hover,
.mobile-account-btn:hover {
    background: #e3f2fd;
    border-color: #bbdefb;
    color: #0080FF;
    text-decoration: none;
}

.mobile-notif-btn i,
.mobile-phone-btn i,
.mobile-account-btn i {
    font-size: 1.2rem;
    color: #0080FF;
    flex-shrink: 0;
}

.mobile-phone-btn i {
    color: #4caf50;
}

.mobile-notif-btn .badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #ff4757;
    color: white;
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
    border-radius: 10px;
    font-weight: 700;
}

.mobile-account-btn span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Mobile Search */
.main-navbar-wrapper .d-lg-none.mb-3 .input-group {
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #e3f2fd;
}

.main-navbar-wrapper .d-lg-none.mb-3 .form-control {
    border: none;
    background: white;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    text-align: right;
}

.main-navbar-wrapper .d-lg-none.mb-3 .btn-primary {
    background: linear-gradient(135deg, #0080FF 0%, #0066CC 100%);
    border: none;
    padding: 0.75rem 1.25rem;
}

.main-navbar-wrapper .d-lg-none.mb-3 .btn-primary:hover {
    background: linear-gradient(135deg, #0066CC 0%, #004d99 100%);
}

/* Responsive Design */
@media (max-width: 1199px) {
    .navbar-center {
        display: none !important;
    }
    
    .header .navbar-brand .logo-img {
        max-height: 45px;
    }
    
    .header-cart-btn {
        width: 42px;
        height: 42px;
    }
    
    .header-hamburger {
        width: 42px;
        height: 42px;
    }
}

@media (max-width: 767px) {
    .header .navbar-main {
        padding: 0.6rem 0;
    }
    
    .header .navbar-brand .logo-img {
        max-height: 40px;
    }
    
    .header-cart-btn {
        width: 40px;
        height: 40px;
    }
    
    .header-cart-btn i {
        font-size: 1.2rem;
    }
    
    .header-hamburger {
        width: 40px;
        height: 40px;
    }
    
    .header-hamburger i {
        font-size: 1.2rem;
    }
}

/* Clean Header Shadow */
.header {
    box-shadow: 0 3px 12px rgba(0, 128, 255, 0.08);
}

/* Smooth Transitions */
.header * {
    transition: all 0.3s ease;
}

/* Account Dropdown Menu - Compact Two Column Layout */
.navbar-nav .account .dropdown-menu {
    display: none !important; /* فقط با hover/click باز شود */
    width: 450px !important; /* Fixed width برای ستون‌های یکسان */
    padding: 0.5rem !important;
    border-radius: 10px !important;
    box-shadow: 0 6px 20px rgba(0, 128, 255, 0.15) !important;
    border: 1px solid #e3f2fd !important;
    overflow: hidden !important; /* جلوگیری از بیرون زدن */
}

/* Show on hover/click */
.navbar-nav .account:hover .dropdown-menu,
.navbar-nav .account.show .dropdown-menu {
    display: grid !important;
}

/* Two Column Grid - Exact Equal Columns */
.navbar-nav .account .dropdown-menu {
    grid-template-columns: repeat(2, 1fr); /* دقیقاً یکسان */
    gap: 0.3rem;
    align-items: start;
}

/* Dropdown Items - Beautiful with Icons */
.navbar-nav .account .dropdown-menu .dropdown-item {
    margin: 0 !important;
    border-radius: 8px !important;
    padding: 0 !important;
    overflow: hidden !important; /* جلوگیری از overflow */
    min-width: 0 !important; /* برای text-overflow */
}

.navbar-nav .account .dropdown-menu .dropdown-item a {
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    padding: 0.55rem 0.7rem !important;
    border-radius: 8px !important;
    transition: all 0.2s ease !important;
    font-size: 0.8rem !important;
    color: #1e293b !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    font-weight: 500 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.navbar-nav .account .dropdown-menu .dropdown-item a:hover {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 50%) !important;
    color: #0080FF !important;
    transform: translateX(-3px) !important;
    box-shadow: 0 2px 8px rgba(0, 128, 255, 0.1) !important;
}

.navbar-nav .account .dropdown-menu .dropdown-item a i {
    color: #0080FF !important;
    font-size: 0.9rem !important;
    width: 18px !important;
    min-width: 18px !important;
    text-align: center !important;
    flex-shrink: 0 !important;
    transition: transform 0.2s ease !important;
}

.navbar-nav .account .dropdown-menu .dropdown-item a:hover i {
    transform: scale(1.1) !important;
}

/* Text wrapper for better ellipsis */
.navbar-nav .account .dropdown-menu .dropdown-item a span:not(.badge) {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    flex: 1 !important;
    min-width: 0 !important;
}

/* Dividers - Full Width & Compact */
.navbar-nav .account .dropdown-menu .dropdown-divider {
    grid-column: 1 / -1 !important;
    margin: 0.3rem 0 !important;
    border-color: #e3f2fd !important;
}

/* Last Item (Logout) - Full Width & Highlighted */
.navbar-nav .account .dropdown-menu .dropdown-item:last-child {
    grid-column: 1 / -1 !important;
}

.navbar-nav .account .dropdown-menu .dropdown-item:last-child a {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%) !important;
    border: 1px solid #ffb74d !important;
    color: #f57c00 !important;
    font-weight: 600 !important;
    justify-content: center !important;
    margin-top: 0.2rem !important;
    padding: 0.5rem 1rem !important;
}

.navbar-nav .account .dropdown-menu .dropdown-item:last-child a:hover {
    background: linear-gradient(135deg, #ffe0b2 0%, #ffcc80 100%) !important;
    border-color: #ffa726 !important;
    color: #e65100 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(245, 124, 0, 0.2) !important;
}

/* Responsive - Single Column for Mobile */
@media (max-width: 767px) {
    .navbar-nav .account .dropdown-menu {
        width: 280px !important;
        max-width: calc(100vw - 2rem) !important;
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 480px) {
    .navbar-nav .account .dropdown-menu {
        width: 100% !important;
        max-width: calc(100vw - 2rem) !important;
    }
}

/* RTL Support */
[dir="rtl"] .navbar-center {
    flex-direction: row-reverse;
}

[dir="rtl"] .search-input {
    text-align: right;
    direction: rtl;
}

[dir="rtl"] .header-phone-btn {
    direction: ltr;
}

[dir="rtl"] .navbar-nav .account .dropdown-menu .dropdown-item a:hover {
    transform: translateX(3px) !important;
}

/* RTL - Fix text alignment */
[dir="rtl"] .navbar-nav .account .dropdown-menu .dropdown-item a {
    text-align: right !important;
    direction: rtl !important;
}

[dir="rtl"] .navbar-nav .account .dropdown-menu .dropdown-item a i {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Services & Domains Dropdown - No Scroll, All Visible */
.main-navbar-wrapper .dropdown-menu {
    display: none !important; /* فقط با hover/click باز شود */
    max-height: none !important; /* بدون محدودیت ارتفاع */
    overflow: visible !important; /* بدون اسکرول */
    border-radius: 10px !important;
    box-shadow: 0 8px 24px rgba(0, 128, 255, 0.15) !important;
    border: 1px solid #e3f2fd !important;
    padding: 0.5rem !important;
    min-width: 220px !important;
    background: white !important;
}

/* Show dropdown on hover/click */
.main-navbar-wrapper .dropdown:hover > .dropdown-menu,
.main-navbar-wrapper .dropdown.show > .dropdown-menu {
    display: block !important;
}

/* Dropdown Items - Beautiful & Icon-Ready */
.main-navbar-wrapper .dropdown-menu .dropdown-item {
    padding: 0 !important;
    margin: 0.15rem 0 !important;
    border-radius: 8px !important;
}

.main-navbar-wrapper .dropdown-menu .dropdown-item a,
.main-navbar-wrapper .dropdown-menu .dropdown-item.dropdown-item {
    display: flex !important;
    align-items: center !important;
    gap: 0.65rem !important;
    padding: 0.6rem 0.85rem !important;
    border-radius: 8px !important;
    transition: all 0.2s ease !important;
    font-size: 0.85rem !important;
    color: #1e293b !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    font-weight: 500 !important;
}

.main-navbar-wrapper .dropdown-menu .dropdown-item a:hover,
.main-navbar-wrapper .dropdown-menu .dropdown-item.dropdown-item:hover {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 50%) !important;
    color: #0080FF !important;
    transform: translateX(-3px) !important;
    box-shadow: 0 2px 8px rgba(0, 128, 255, 0.1) !important;
}

/* Icons - Beautiful & Consistent */
.main-navbar-wrapper .dropdown-menu .dropdown-item a i,
.main-navbar-wrapper .dropdown-menu .dropdown-item.dropdown-item i {
    color: #0080FF !important;
    font-size: 1rem !important;
    width: 20px !important;
    text-align: center !important;
    flex-shrink: 0 !important;
    transition: transform 0.2s ease !important;
}

.main-navbar-wrapper .dropdown-menu .dropdown-item a:hover i,
.main-navbar-wrapper .dropdown-menu .dropdown-item.dropdown-item:hover i {
    transform: scale(1.1) !important;
}

/* Dividers - Elegant */
.main-navbar-wrapper .dropdown-menu .dropdown-divider {
    margin: 0.5rem 0 !important;
    border-color: #e3f2fd !important;
    border-width: 1px !important;
}

/* RTL Support for Main Menu */
[dir="rtl"] .main-navbar-wrapper .dropdown-menu .dropdown-item a:hover,
[dir="rtl"] .main-navbar-wrapper .dropdown-menu .dropdown-item.dropdown-item:hover {
    transform: translateX(2px) !important;
}
