:root {
    --top-navbar-bg: #f8fafc;
    --top-navbar-surface: #ffffff;
    --top-navbar-border: #e2e8f0;
    --top-navbar-accent: #0f275c;
    --top-navbar-accent-light: rgba(15, 39, 92, 0.08);
    --top-navbar-cta: #fbbf24;
    --top-navbar-cta-text: #1e293b;
    --top-navbar-muted: #64748b;
    --top-navbar-shadow: 0 18px 40px -24px rgba(15, 39, 92, 0.4);
}

/* =========================
   Header base
   ========================= */
.top-navbar {
    position: relative;
    background: var(--top-navbar-bg);
    border-bottom: 1px solid var(--top-navbar-border);
    color: #0b1a38;
    font-family: "Vazirmatn", "IRANSans", sans-serif;
    box-shadow: var(--top-navbar-shadow);
    z-index: 99999;
}

.top-navbar__upper,
.top-navbar__lower {
    width: 100%;
    position: relative;
    overflow: visible;
}

.top-navbar__upper {
    background: linear-gradient(135deg, #ffffff 0%, #f3f7ff 55%, #eef2ff 100%);
}

.top-navbar__container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 18px;
    display: flex;
    align-items: center;
    gap: 18px;
    min-width: 0;
    overflow: visible;
}

.top-navbar__upper .top-navbar__container {
    min-height: 78px;
    justify-content: space-between;
}

.top-navbar__lower {
    background: transparent;
    padding-bottom: 18px;
}

.top-navbar__lower .top-navbar__container {
    min-height: 56px;
}

/* =========================
   Brand
   ========================= */
.top-navbar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.top-navbar__brand-link {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-decoration: none;
    color: #0f275c;
    font-weight: 700;
}

.top-navbar__brand-mark {
    font-size: 20px;
    letter-spacing: -0.2px;
}

.top-navbar__brand-sub {
    font-size: 12px;
    color: var(--top-navbar-muted);
    font-weight: 500;
}

/* =========================
   Search
   ========================= */
.top-navbar__search {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    max-width: 680px;
    min-width: 0;
}

.top-navbar__search-toggle {
    display: none;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    border: 1px solid var(--top-navbar-border);
    background: var(--top-navbar-surface);
    align-items: center;
    justify-content: center;
    color: #0f275c;
    font-size: 18px;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.top-navbar__search-toggle:hover {
    border-color: var(--top-navbar-accent);
    background: #f8fafc;
    box-shadow: 0 10px 26px -16px rgba(15, 39, 92, 0.3);
}

.top-navbar__search-form {
    flex: 1;
    display: flex;
    align-items: center;
    background: var(--top-navbar-surface);
    border: 1px solid var(--top-navbar-border);
    border-radius: 999px;
    padding: 10px 18px;
    gap: 10px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    min-width: 0;
}

.top-navbar__search-form:focus-within {
    border-color: var(--top-navbar-accent);
    box-shadow: 0 0 0 4px rgba(15, 39, 92, 0.08);
}

.top-navbar__search-icon {
    color: var(--top-navbar-muted);
    font-size: 18px;
}

.top-navbar__search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-size: 14px;
    color: #111827;
    min-width: 0;
}

/* =========================
   Search modal (mobile)
   ========================= */
.top-navbar__search-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 30000;
}

.top-navbar.is-search-open .top-navbar__search-modal {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.top-navbar__search-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    border: none;
}

.top-navbar__search-panel {
    position: relative;
    z-index: 1;
    width: min(92vw, 420px);
    background: #fff;
    border-radius: 20px;
    padding: 22px;
    box-shadow: 0 25px 60px -20px rgba(15, 39, 92, 0.45);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.top-navbar__search-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.top-navbar__search-title {
    font-weight: 700;
    color: #0f275c;
    font-size: 16px;
}

.top-navbar__search-close {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #0f275c;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.top-navbar__search-close:hover {
    border-color: var(--top-navbar-accent);
    box-shadow: 0 8px 24px -12px rgba(15, 39, 92, 0.3);
}

.top-navbar__search-form--modal {
    padding: 12px 16px;
}

body.is-search-locked {
    overflow: hidden;
}

/* =========================
   Actions
   ========================= */
.top-navbar__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
}

.top-navbar__icon-btn {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    border: 1px solid var(--top-navbar-border);
    background: var(--top-navbar-surface);
    display: grid;
    place-items: center;
    color: #0f275c;
    text-decoration: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.top-navbar__icon-btn:hover {
    border-color: var(--top-navbar-accent);
    background: #f8fafc;
    box-shadow: 0 10px 26px -16px rgba(15, 39, 92, 0.3);
}

.top-navbar__badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    display: grid;
    place-items: center;
    padding: 0 5px;
    font-weight: 700;
    box-shadow: 0 6px 14px -8px rgba(15, 39, 92, 0.45);
}

.top-navbar__auth-link,
.top-navbar__profile-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 999px;
    border: 1px solid var(--top-navbar-border);
    padding: 9px 16px;
    background: var(--top-navbar-surface);
    color: #0f275c;
    text-decoration: none;
    font-weight: 600;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.top-navbar__auth-link:hover,
.top-navbar__profile-btn:hover {
    border-color: var(--top-navbar-accent);
    background: #f8fafc;
    box-shadow: 0 10px 26px -16px rgba(15, 39, 92, 0.3);
}

/* =========================
   Profile dropdown
   ========================= */
.top-navbar__profile {
    position: relative;
    z-index: 10001;
}

.top-navbar__profile-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #e5e7eb;
    flex-shrink: 0;
}

.top-navbar__profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.top-navbar__profile-name {
    font-size: 13px;
    font-weight: 600;
    color: #0f275c;
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.top-navbar__mobile-bottom {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid var(--top-navbar-border);
    box-shadow: 0 -12px 30px -20px rgba(15, 39, 92, 0.45);
    padding: 8px 12px 12px;
    z-index: 30000;
    justify-content: space-between;
}

.top-navbar__bottom-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #0f275c;
    text-decoration: none;
    background: transparent;
    border: none;
    padding: 6px 0;
}

.top-navbar__bottom-item i {
    font-size: 18px;
}

.top-navbar__bottom-icon {
    position: relative;
    display: inline-flex;
}

.top-navbar__profile-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    min-width: 220px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    box-shadow: 0 20px 50px -20px rgba(15, 39, 92, 0.35);
    padding: 10px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
    z-index: 20000;
}

.top-navbar__profile.is-open .top-navbar__profile-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.top-navbar__profile-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 12px;
    color: #0f275c;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
}

.top-navbar__profile-item:hover {
    background: #f8fafc;
    color: #0a1f54;
}

/* =========================
   Main menu + Dropdowns
   ========================= */
.top-navbar__menu {
    display: flex;
    align-items: center;
    gap: 6px;
    list-style: none;
    padding: 6px;
    margin: 0;
    width: 100%;
    flex-wrap: wrap;
    white-space: nowrap;
    min-width: 0;
    background: var(--top-navbar-surface);
    border: 1px solid var(--top-navbar-border);
    border-radius: 999px;
    box-shadow: 0 16px 30px -26px rgba(15, 39, 92, 0.35);
    overflow: visible;
}

.top-navbar__item {
    position: relative;
    z-index: 10001;
}

.top-navbar__link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    color: #0f275c;
    text-decoration: none;
    font-weight: 600;
    transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
    white-space: nowrap;
    background: transparent;
    border: none;
    cursor: pointer;
}

.top-navbar__link:hover {
    background: var(--top-navbar-accent-light);
    color: #0a1f54;
    box-shadow: inset 0 0 0 1px rgba(15, 39, 92, 0.1);
}

.top-navbar__item--cta .top-navbar__link {
    background: var(--top-navbar-cta);
    color: var(--top-navbar-cta-text);
    font-weight: 800;
    box-shadow: inset 0 0 0 1px rgba(15, 39, 92, 0.08);
}

.top-navbar__item--cta .top-navbar__link:hover {
    background: #fde68a;
    color: #0a1f54;
}

.top-navbar__chevron {
    font-size: 12px;
    color: var(--top-navbar-muted);
}

.top-navbar__dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    min-width: 240px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    box-shadow: 0 24px 60px -28px rgba(15, 39, 92, 0.45);
    padding: 12px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
    z-index: 20000;
}

.top-navbar__item--dropdown.is-open > .top-navbar__dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.top-navbar__item--dropdown::after {
    content: "";
    position: absolute;
    right: 0;
    left: 0;
    top: 100%;
    height: 12px;
}

.top-navbar__dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    text-decoration: none;
    color: #0f275c;
    font-weight: 600;
    transition: background 0.18s ease, color 0.18s ease;
}

.top-navbar__dropdown-item:hover {
    background: #f8fafc;
    color: #0a1f54;
}

/* =========================
   Hamburger
   ========================= */
.top-navbar__hamburger {
    display: none;
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    border: 1px solid var(--top-navbar-border);
    background: var(--top-navbar-surface);
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 6px;
    padding: 0 10px;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.top-navbar__hamburger-line {
    width: 100%;
    height: 2px;
    background: #0f275c;
    border-radius: 999px;
}

.top-navbar__hamburger:hover {
    border-color: var(--top-navbar-accent);
    box-shadow: 0 10px 30px -14px rgba(15, 39, 92, 0.35);
}

/* =========================
   Responsive
   ========================= */
@media (max-width: 991px) {
    .top-navbar__container {
        max-width: 100%;
        flex-wrap: wrap;
    }

    .top-navbar__upper .top-navbar__container {
        gap: 12px;
    }

    .top-navbar__brand {
        flex: 0 0 auto;
    }

    .top-navbar__search {
        order: 3;
        flex: 1 0 100%;
        max-width: none;
    }

    .top-navbar__actions {
        order: 2;
    }

    .top-navbar__lower {
        padding-bottom: 12px;
    }

    .top-navbar__menu {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding: 12px;
        display: none;
        overflow: visible;
        white-space: normal;
        border-radius: 18px;
    }

    .top-navbar.is-nav-open .top-navbar__menu {
        display: flex;
    }

    .top-navbar__item {
        width: 100%;
    }

    .top-navbar__link {
        justify-content: space-between;
        width: 100%;
    }

    .top-navbar__dropdown {
        position: relative;
        top: auto;
        right: auto;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: 1px solid #e5e7eb;
        margin-top: 6px;
        display: none;
        z-index: auto;
    }

    .top-navbar__item--dropdown::after {
        display: none;
    }

    .top-navbar__item--dropdown.is-open > .top-navbar__dropdown {
        display: block;
    }

    .top-navbar__actions {
        gap: 8px;
    }

    .top-navbar__hamburger {
        display: inline-flex;
    }
}

@media (max-width: 640px) {
    .top-navbar__container {
        padding: 0 14px;
    }

    .top-navbar__upper .top-navbar__container {
        gap: 10px;
    }

    .top-navbar__brand {
        width: 100%;
        justify-content: center;
    }

    .top-navbar__actions {
        width: 100%;
        justify-content: space-between;
        gap: 6px;
    }

    .top-navbar__search {
        display: none;
    }

    .top-navbar__brand-link {
        font-size: 14px;
    }

    .top-navbar__brand-sub {
        display: none;
    }

    .top-navbar__search-form {
        display: none;
        padding: 8px 12px;
    }

    .top-navbar__search-form--modal {
        display: flex;
    }

    .top-navbar__search-input {
        font-size: 13px;
    }

    .top-navbar__search-toggle {
        display: inline-flex;
    }

    .top-navbar__actions {
        gap: 6px;
    }

    .top-navbar__icon-btn {
        width: 38px;
        height: 38px;
        border-radius: 12px;
    }

    .top-navbar__auth-link,
    .top-navbar__profile-btn {
        padding: 6px 10px;
    }

    .top-navbar__profile-name {
        font-size: 12px;
        max-width: 90px;
    }

    .top-navbar__profile-btn .top-navbar__chevron {
        display: none;
    }

    .top-navbar__mobile-bottom {
        display: flex;
        align-items: center;
        gap: 4px;
    }

    body {
        padding-bottom: 76px;
    }
}
