/**
 * B2B Top Navigation — professional header
 */

.b2b-topnav {
    --ht-bg: rgba(255, 255, 255, 0.92);
    --ht-border: rgba(15, 23, 42, 0.08);
    --ht-text: #0f172a;
    --ht-muted: #64748b;
    --ht-accent: var(--primary-color, #313f51);
    --ht-accent-soft: rgba(49, 63, 81, 0.08);
    --ht-h: 68px;
    --ht-radius: 10px;
    --ht-font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

    position: sticky;
    top: 0;
    z-index: 1001;
    background: var(--ht-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--ht-border);
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
    font-family: var(--ht-font);
}

.b2b-topnav.is-scrolled {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
}

.b2b-topnav__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 20px;
    min-height: var(--ht-h);
    max-width: 100%;
}

.b2b-topnav__left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    flex: 1;
}

.b2b-topnav__menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: var(--ht-radius);
    background: transparent;
    color: var(--ht-text);
    font-size: 17px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    text-decoration: none;
    flex-shrink: 0;
}

.b2b-topnav__menu-btn:hover {
    background: var(--ht-accent-soft);
    color: var(--ht-accent);
}

.b2b-topnav__divider {
    width: 1px;
    height: 28px;
    background: var(--ht-border);
    flex-shrink: 0;
}

.b2b-topnav__brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    text-decoration: none;
    color: var(--ht-text);
    flex-shrink: 0;
}

.b2b-topnav__brand:hover {
    color: var(--ht-text);
    text-decoration: none;
}

.b2b-topnav__logo {
    width: 38px;
    height: 38px;
    border-radius: 9px;
    object-fit: contain;
    background: #f8fafc;
    border: 1px solid var(--ht-border);
    padding: 4px;
}

.b2b-topnav__logo-placeholder {
    width: 38px;
    height: 38px;
    border-radius: 9px;
    background: var(--ht-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
}

.b2b-topnav__brand-text {
    min-width: 0;
    line-height: 1.25;
}

.b2b-topnav__brand-name {
    display: block;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.b2b-topnav__brand-sub {
    display: block;
    font-size: 10px;
    color: var(--ht-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 1px;
}

.b2b-topnav__right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.b2b-topnav__icon-btn {
    position: relative;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: var(--ht-radius);
    background: transparent;
    color: var(--ht-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    transition: background 0.15s, color 0.15s;
    text-decoration: none;
}

.b2b-topnav__icon-btn:hover,
.b2b-topnav__icon-btn.show {
    background: var(--ht-accent-soft);
    color: var(--ht-accent);
}

.b2b-topnav__icon-btn.dropdown-toggle::after {
    display: none;
}

.b2b-topnav__badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    line-height: 1;
}

.b2b-topnav__user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 12px 4px 4px;
    border: 1px solid var(--ht-border);
    border-radius: 999px;
    background: #fff;
    text-decoration: none;
    color: var(--ht-text);
    transition: border-color 0.15s, box-shadow 0.15s;
    margin-left: 4px;
}

.b2b-topnav__user:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
    color: var(--ht-text);
    text-decoration: none;
}

.b2b-topnav__user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--ht-accent);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.b2b-topnav__user-name {
    font-size: 13px;
    font-weight: 600;
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#notification-count:empty,
#notification-count[data-count="0"] {
    display: none !important;
}

/* Notification dropdown */
.b2b-notif-dropdown {
    width: min(380px, calc(100vw - 2rem));
    padding: 0;
    border: 1px solid var(--ht-border);
    border-radius: 14px;
    box-shadow: 0 16px 48px rgba(15, 23, 42, 0.14);
    overflow: hidden;
    margin-top: 8px !important;
}

.b2b-notif-dropdown__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: #f8fafc;
    border-bottom: 1px solid var(--ht-border);
}

.b2b-notif-dropdown__title {
    font-size: 14px;
    font-weight: 700;
    color: var(--ht-text);
    margin: 0;
    letter-spacing: -0.01em;
}

.b2b-notif-dropdown__link {
    font-size: 12px;
    font-weight: 600;
    color: var(--ht-accent);
    text-decoration: none;
}

.b2b-notif-dropdown__link:hover {
    text-decoration: underline;
}

.b2b-notif-dropdown__scroll {
    display: block;
    max-height: 360px;
    overflow-y: auto;
}

.b2b-notif-dropdown__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.b2b-notif-dropdown__list > li {
    border-bottom: 1px solid var(--ht-border);
}

.b2b-notif-dropdown__list > li:last-child {
    border-bottom: none;
}

.b2b-notif-dropdown__item {
    display: flex !important;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px !important;
    white-space: normal !important;
    font-size: 13px;
    line-height: 1.45;
    color: var(--ht-text) !important;
    transition: background 0.12s;
}

.b2b-notif-dropdown__item:hover {
    background: #f8fafc !important;
}

.b2b-notif-dropdown__item-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--ht-accent-soft);
    color: var(--ht-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.b2b-notif-ic--chat    { background: rgba(54, 153, 255, 0.12);  color: #3699ff; }
.b2b-notif-ic--request { background: rgba(255, 168, 0, 0.12);   color: #ffa800; }
.b2b-notif-ic--success { background: rgba(27, 197, 189, 0.12);  color: #1bc5bd; }
.b2b-notif-ic--error   { background: rgba(246, 78, 96, 0.12);   color: #f64e60; }
.b2b-notif-ic--info    { background: rgba(102, 110, 232, 0.12); color: #666ee8; }

.b2b-notif-dropdown__item-body {
    flex: 1;
    min-width: 0;
}

.b2b-notif-dropdown__item-text,
.b2b-notif-dropdown__item .message {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-weight: 500;
}

.b2b-notif-dropdown__item-time {
    font-size: 11px;
    color: var(--ht-muted);
    margin-top: 3px;
    display: block;
}

.b2b-notif-dropdown__list > li.nav-item .dropdown-item {
    display: flex !important;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px !important;
    white-space: normal !important;
}

.b2b-notif-dropdown__empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--ht-muted);
    font-size: 13px;
}

.b2b-notif-dropdown__foot {
    padding: 12px 16px;
    background: #f8fafc;
    border-top: 1px solid var(--ht-border);
    text-align: center;
}

.b2b-notif-dropdown__foot a {
    font-size: 13px;
    font-weight: 600;
    color: var(--ht-accent);
    text-decoration: none;
}

.b2b-notif-dropdown__foot a:hover {
    text-decoration: underline;
}

/* Legacy top_nav reset */
.top_nav.b2b-topnav-wrap {
    float: none;
    background: transparent;
    border: none;
    margin-bottom: 0;
}

.top_nav.b2b-topnav-wrap .navbar-right {
    display: none;
}

@media (max-width: 991px) {
    .b2b-topnav__divider,
    .b2b-topnav__brand-text,
    .b2b-topnav__user-name,
    .b2b-topnav__welcome {
        display: none;
    }

    .b2b-topnav__inner {
        padding: 0 12px;
    }

    .b2b-topnav__user {
        padding: 4px;
        border: none;
        background: transparent;
    }
}

/* RTL */
[dir="rtl"] .b2b-topnav__badge {
    right: auto;
    left: 2px;
}

[dir="rtl"] .b2b-topnav__user {
    margin-left: 0;
    margin-right: 4px;
    padding: 4px 4px 4px 12px;
}

.b2b-topnav__quick {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    justify-content: center;
    max-width: 420px;
    margin: 0 auto;
    padding: 0 8px;
}

.b2b-topnav__quick-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ht-muted);
    text-decoration: none;
    border-radius: 999px;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.b2b-topnav__quick-link i {
    font-size: 14px;
    opacity: 0.85;
}

.b2b-topnav__quick-link:hover {
    background: var(--ht-accent-soft);
    color: var(--ht-accent);
    text-decoration: none;
}

.b2b-topnav__quick-link.is-active {
    background: var(--ht-accent-soft);
    color: var(--ht-accent);
}

.b2b-topnav__quick-pill {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #f59e0b;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.b2b-topnav__welcome {
    display: none;
    font-size: 13px;
    font-weight: 500;
    color: var(--ht-muted);
    margin-right: 8px;
}

.b2b-topnav__welcome strong {
    color: var(--ht-text);
    font-weight: 600;
}

@media (min-width: 1200px) {
    .b2b-topnav__welcome {
        display: block;
    }
}

@media (max-width: 991px) {
    .b2b-topnav__quick {
        display: none;
    }
}

[dir="rtl"] .b2b-topnav__welcome {
    margin-right: 0;
    margin-left: 8px;
}

/* ── Public (guest) top navigation ── */
.b2b-pubnav {
    --ht-bg: rgba(255, 255, 255, 0.92);
    --ht-border: rgba(15, 23, 42, 0.08);
    --ht-text: #0f172a;
    --ht-muted: #64748b;
    --ht-accent: var(--primary-color, #313f51);
    --ht-accent-soft: rgba(49, 63, 81, 0.08);
    --ht-h: 68px;
    --ht-radius: 10px;
    --ht-font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

    position: sticky;
    top: 0;
    z-index: 1001;
    background: var(--ht-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--ht-border);
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
    font-family: var(--ht-font);
}

.b2b-pubnav.is-scrolled {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
}

.b2b-pubnav__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 24px;
    min-height: var(--ht-h);
    max-width: 1280px;
    margin: 0 auto;
}

.b2b-pubnav__left,
.b2b-pubnav__right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.b2b-pubnav__left {
    min-width: 0;
    flex: 1;
}

.b2b-pubnav__brand {
    display: flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
}

.b2b-pubnav__logo {
    height: 40px;
    width: auto;
    max-width: 160px;
    object-fit: contain;
}

.b2b-pubnav__links {
    align-items: center;
    gap: 4px;
    margin-left: 20px;
}

.b2b-pubnav__link {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ht-muted);
    text-decoration: none;
    border-radius: 999px;
    transition: background 0.15s, color 0.15s;
}

.b2b-pubnav__link:hover,
.b2b-pubnav__link.is-active {
    background: var(--ht-accent-soft);
    color: var(--ht-accent);
    text-decoration: none;
}

.b2b-pubnav__lang {
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ht-muted);
    text-decoration: none;
    border-radius: var(--ht-radius);
}

.b2b-pubnav__lang:hover {
    background: var(--ht-accent-soft);
    color: var(--ht-accent);
    text-decoration: none;
}

.b2b-pubnav__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    padding: 0 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 999px;
    text-decoration: none;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.b2b-pubnav__btn--ghost {
    color: var(--ht-text);
    border: 1px solid var(--ht-border);
    background: #fff;
}

.b2b-pubnav__btn--ghost:hover {
    border-color: #cbd5e1;
    color: var(--ht-accent);
    text-decoration: none;
}

.b2b-pubnav__btn--primary {
    color: #fff !important;
    background: var(--ht-accent);
    border: 1px solid var(--ht-accent);
}

.b2b-pubnav__btn--primary:hover {
    filter: brightness(1.06);
    color: #fff;
    text-decoration: none;
}

.b2b-pubnav__user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 12px 4px 4px;
    border: 1px solid var(--ht-border);
    border-radius: 999px;
    background: #fff;
    text-decoration: none;
    color: var(--ht-text);
}

.b2b-pubnav__user.dropdown-toggle::after {
    margin-left: 6px;
}

.b2b-pubnav__user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--ht-accent);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.b2b-pubnav__user-name {
    font-size: 13px;
    font-weight: 600;
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.b2b-pubnav__toggle {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: var(--ht-radius);
    background: transparent;
    color: var(--ht-text);
    font-size: 17px;
    cursor: pointer;
}

.b2b-pubnav__toggle:hover {
    background: var(--ht-accent-soft);
    color: var(--ht-accent);
}

.b2b-pubnav__mobile {
    border-top: 1px solid var(--ht-border);
    background: #fff;
}

.b2b-pubnav__mobile-links {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 16px 16px;
}

.b2b-pubnav__mobile-links .b2b-pubnav__link {
    border-radius: var(--ht-radius);
}

@media (max-width: 575px) {
    .b2b-pubnav__inner {
        padding: 0 12px;
    }

    .b2b-pubnav__btn--ghost {
        display: none !important;
    }
}

[dir="rtl"] .b2b-pubnav__links {
    margin-left: 0;
    margin-right: 20px;
}
