/* topbar.css */

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 50;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 12px 16px;

    background: var(--app-topbar-bg);
    border-bottom: 1px solid var(--app-border);
    box-shadow: var(--app-topbar-shadow);
    backdrop-filter: blur(10px);
    color: var(--app-text-topbar);
}

.app-topbar__left {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.app-navtoggle {
    height: 32px;
    min-width: 32px;

    border-radius: 10px;
    border: 1px solid var(--app-border);

    background: transparent;
    color: var(--app-text-topbar);

    font-weight: 900;
    line-height: 1;
    padding: 0 10px;
}

.app-navtoggle:hover {
    border-color: var(--app-border-hover);
}

/* brand */
.app-brand {
    display: inline-flex;
    align-items: baseline;
    gap: 10px;

    text-decoration: none;
    color: var(--app-text-topbar);

    min-width: 0;
    max-width: 56vw;

    font-weight: 900;
    letter-spacing: 0.1px;
}

.app-brand__name {
    font-weight: 900;
    font-size: 21px; /* restore bigger title */
    line-height: 1.1;
    color: var(--app-text-topbar);
    font-family: var(--app-font-heading);
    letter-spacing: 0.3px;

    max-width: 34vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-brand__desc {
    font-weight: 700;
    font-size: 13px;
    line-height: 1.1;
    color: var(--app-text-topbar-muted);
    opacity: 0.95;

    max-width: 34vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-topbar__right {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.app-lang {
    display: inline-flex;
    gap: 6px;
}

.app-lang__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    height: 32px;
    padding: 0 10px;

    border: 1px solid var(--app-border);
    border-radius: 10px;

    color: var(--app-text-topbar);
    text-decoration: none;
    font-size: 13px;
    font-weight: 900;

    background: transparent;
}

.app-lang__btn:hover {
    border-color: var(--app-border-hover);
}

body.app-theme-light .app-lang__btn {
    border-color: rgba(255, 255, 255, 0.6);
}

body.app-theme-light .app-lang__btn:hover {
    border-color: rgba(255, 255, 255, 0.85);
}

body.app-theme-light .app-topbar .app-lang__btn,
body.app-theme-light .app-topbar .app-lang__btn:visited,
body.app-theme-light .app-topbar .app-lang__btn:hover,
body.app-theme-light .app-topbar .app-lang__btn:focus {
    color: var(--app-text-topbar);
}

.app-topsearch {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.app-topsearch__input {
    height: 32px;
    width: min(280px, 34vw);
    min-width: 150px;

    border-radius: 10px;
    border: 1px solid var(--app-border);
    background: var(--app-surface-2);
    color: var(--app-text);

    padding: 0 10px;
    outline: none;
}

.app-topsearch__input:focus {
    border-color: var(--app-topsearch-focus-border);
    box-shadow: 0 0 0 4px var(--app-focus);
}

.app-topsearch__btn {
    height: 32px;
    width: 36px;

    border-radius: 10px;
    border: 1px solid var(--app-border);

    display: inline-flex;
    align-items: center;
    justify-content: center;

    background: var(--app-topsearch-btn-bg);
    color: var(--app-topsearch-btn-text);

    font-weight: 900;
    font-size: 14px;
    line-height: 1;
    padding: 0;
}

.app-topsearch__btn i {
    font-size: 14px;
    line-height: 1;
}

body.app-theme-light .app-topsearch__btn {
    border-color: var(--app-topsearch-btn-border-light);
}

body.app-theme-light .app-topsearch__btn:hover,
body.app-theme-dark .app-topsearch__btn:hover {
    filter: brightness(1.03);
}

.app-iconbtn {
    height: 32px;
    width: 36px;

    border-radius: 10px;
    border: 1px solid var(--app-border);

    background: transparent;
    color: var(--app-text-topbar);

    font-weight: 900;
    font-size: 14px;
    line-height: 1;

    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.app-iconbtn i {
    font-size: 14px;
    line-height: 1;
}

.app-iconbtn:hover {
    border-color: var(--app-border-hover);
}

.app-user {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.app-user__name {
    font-weight: 900;
    font-size: 13px;
    color: var(--app-text-topbar);
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-avatar {
    height: 32px;
    width: 32px;
    border-radius: 999px;

    border: 1px solid var(--app-border);
    background: var(--app-surface-2);

    display: inline-flex;
    align-items: center;
    justify-content: center;

    overflow: hidden;
    color: var(--app-text);
    font-weight: 900;
    font-size: 13px;
}

.app-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.app-avatar--lg {
    height: 64px;
    width: 64px;
    font-size: 18px;
}

/* Notifications (topbar dropdown) */

.app-notif {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.app-notif__badge {
    position: absolute;
    top: -6px;
    right: -6px;

    min-width: 18px;
    height: 18px;
    padding: 0 5px;

    border-radius: 999px;
    border: 1px solid var(--app-notif-badge-border);
    background: var(--app-notif-badge-bg);
    color: var(--app-notif-badge-text);

    font-size: 11px;
    font-weight: 900;
    line-height: 18px;
    text-align: center;

    box-shadow: var(--app-notif-badge-shadow);
}

.app-notif__menu {
    width: min(420px, 92vw);
    padding: 10px;
    border-radius: 14px;
    border: 1px solid var(--app-border);
    background: var(--app-surface);
    box-shadow: var(--app-shadow);
}

.app-notif__title {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    height: 24px;
    padding: 0 10px;

    border-radius: 999px;
    border: 1px solid var(--app-notif-chip-border);
    background: var(--app-notif-chip-bg);
    color: var(--app-text);

    font-weight: 900;
    font-size: 12px;

    margin: 2px 2px 10px 2px;
    letter-spacing: 0.2px;
}

.app-notif__item {
    display: block;
    text-decoration: none;

    border: 1px solid var(--app-border);
    background: var(--app-surface-2);
    border-radius: 12px;

    padding: 10px;
    margin-bottom: 8px;

    color: var(--app-text);
}

.app-notif__item:hover {
    background: var(--app-surface);
}

.app-notif__item-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
}

.app-notif__item-title {
    font-weight: 900;
    font-size: 13px;
    line-height: 1.35;
    min-width: 0;
    flex: 1 1 auto;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.app-notif__item-body {
    margin-top: 4px;
    color: var(--app-text-muted);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.45;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.app-notif__item-meta {
    margin-top: 6px;
    color: var(--app-text-muted);
    font-size: 11px;
    font-weight: 800;
    line-height: 1.45;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.app-notif__footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-top: 10px;
}

.app-notif__link {
    text-decoration: none;
    font-weight: 900;
    font-size: 13px;
    color: var(--app-primary);
}

.app-notif__link:hover {
    text-decoration: underline;
}

.app-notif__linkbtn {
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
    color: var(--app-primary);
    font-weight: 900;
    font-size: 13px;
}

.app-notif__linkbtn:hover {
    text-decoration: underline;
}

.app-notif__pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 22px;
    padding: 3px 8px;

    border-radius: 999px;
    border: 1px solid var(--app-notif-chip-border);
    background: var(--app-notif-chip-bg);
    color: var(--app-text);

    font-weight: 900;
    font-size: 11px;
    letter-spacing: 0.2px;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
    flex: 0 0 auto;
}

/* User dropdown */

.dropdown-menu.app-menu {
    padding: 8px;
    border-radius: 14px;
    border: 1px solid var(--app-border);
    background: var(--app-surface);
    box-shadow: var(--app-shadow);

    min-width: 190px;
}

.dropdown-menu.app-menu .dropdown-item {
    border-radius: 10px;
    padding: 7px 10px;

    color: var(--app-text);
    font-weight: 900;
    font-size: 13px;
}

.dropdown-menu.app-menu .dropdown-item:hover,
.dropdown-menu.app-menu .dropdown-item:focus {
    background: var(--app-surface-2);
    color: var(--app-text);
}

.dropdown-menu.app-menu .dropdown-divider {
    border-top: 1px solid var(--app-border);
    opacity: 1;
    margin: 8px 0;
}

.dropdown-menu.app-menu .app-btn {
    min-height: 32px;
    padding: 0 12px;
    font-size: 13px;
    border-radius: 12px;
    font-weight: 900;
}

.app-menu__logoutform {
    margin: 0;
    padding: 0;
}

@media (max-width: 991.98px) {
    .app-topbar {
        flex-wrap: wrap;
        gap: 10px;
    }

    .app-topbar__left,
    .app-topbar__right {
        width: 100%;
    }

    .app-topbar__left {
        justify-content: center;
        position: relative;
    }

    .app-navtoggle {
        position: absolute;
        left: 0;
    }

    .app-brand {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 2px;
        max-width: 100%;
    }

    .app-brand__name,
    .app-brand__desc {
        max-width: 100%;
    }

    .app-topbar__right {
        flex-wrap: wrap;
        justify-content: center;
    }

    .app-topsearch {
        flex: 1 1 100%;
        order: 6;
    }

    .app-topsearch__input {
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 575.98px) {
    .app-topsearch__input { width: 100%; min-width: 0; }
    .app-user__name { display: none; }

    .app-brand__desc { display: none; }
    .app-brand { max-width: 62vw; }
    .app-brand__name { max-width: 62vw; font-size: 15px; }
}
