/* ==========================================================================
   WararaDesk — Top bar (desktop) + ferramentas de perfil/notificações
   ========================================================================== */

.app-topbar-tools { display: flex; align-items: center; gap: 6px; }

/* ---- Desktop top bar — Full-width modern bar ----------------------------- */
.app-topbar {
    position: sticky;
    top: 0;
    z-index: 125;
    width: 100%;
}

.app-topbar-inner {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: 100%;
    gap: 8px;
    pointer-events: auto;
}

@media (min-width: 900px) {
    .app-topbar {
        position: sticky;
        top: 0;
        z-index: 125;
        display: flex;
        align-items: center;
        width: 100%;
        min-height: var(--topbar-h);
        padding: 0 28px;
        background: color-mix(in srgb, var(--color-surface) 85%, transparent);
        backdrop-filter: blur(20px) saturate(180%);
        -webkit-backdrop-filter: blur(20px) saturate(180%);
        border-bottom: 1px solid var(--color-border);
        box-shadow: var(--shadow-sm);
    }

    :root[data-theme="dark"] .app-topbar {
        background: color-mix(in srgb, var(--color-surface) 78%, transparent);
        border-bottom-color: var(--color-border);
        box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
    }

    .app-topbar-inner {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        width: 100%;
        gap: 8px;
    }

    .app-topbar-tools {
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .app-topbar-pill-sep {
        width: 1px;
        height: 20px;
        background: var(--color-border);
        margin: 0 4px;
        border-radius: 99px;
        opacity: .7;
    }
}



@media (max-width: 899px) {
    .app-topbar {
        position: fixed;
        top: calc(var(--mobile-safe-top, 0px) + 6px);
        right: 12px;
        left: auto;
        width: auto;
        padding: 0;
        background: none;
        border: none;
        backdrop-filter: none;
    }

    .mobile-app-bar-title {
        padding-right: 84px;
    }

    .app-topbar-inner {
        gap: 4px;
    }

    .app-topbar .profile-pill-meta,
    .app-topbar .profile-pill-chevron {
        display: none;
    }

    .app-topbar .profile-pill {
        padding: 2px;
        border: none;
        background: transparent;
        box-shadow: none;
    }

    .app-topbar .profile-pill-avatar {
        width: 32px;
        height: 32px;
    }

    .app-topbar .wd-notify-btn {
        width: 36px;
        height: 36px;
        border: none;
        background: color-mix(in srgb, var(--color-surface) 88%, transparent);
        backdrop-filter: blur(10px);
    }

    .app-topbar .wd-notify-panel {
        position: fixed;
        top: calc(var(--mobile-app-bar-h) + var(--mobile-safe-top) + 8px);
        right: 12px;
        left: 12px;
        width: auto;
    }
}

/* ---- Profile pill ------------------------------------------------------- */
.profile-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 240px;
    padding: 4px 10px 4px 4px;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
    font: inherit;
    transition: border-color .15s var(--ease-out), box-shadow .15s var(--ease-out), background-color .15s var(--ease-out);
}

.profile-pill:hover,
.profile-pill:focus-visible {
    border-color: var(--color-violet-border);
    background: var(--color-surface-alt);
    outline: none;
    box-shadow: var(--shadow-sm);
}

/* Botões de ferramentas no topo desktop */
@media (min-width: 900px) {
    .app-topbar .profile-pill {
        border: 1px solid var(--color-border);
        background: var(--color-surface);
        box-shadow: var(--shadow-sm);
        padding: 4px 12px 4px 4px;
        border-radius: 999px;
        transition: border-color .15s var(--ease-out), background-color .15s var(--ease-out), box-shadow .15s var(--ease-out);
    }
    .app-topbar .profile-pill:hover,
    .app-topbar .profile-pill:focus-visible {
        border-color: var(--color-violet-border);
        background: var(--color-surface-alt);
        box-shadow: var(--shadow-md);
        outline: none;
    }
    .app-topbar .wd-notify-btn {
        border: 1px solid var(--color-border);
        background: var(--color-surface);
        box-shadow: var(--shadow-sm);
        width: 32px;
        height: 32px;
        transition: border-color .15s var(--ease-out), color .15s var(--ease-out), background-color .15s var(--ease-out), box-shadow .15s var(--ease-out);
    }
    .app-topbar .wd-notify-btn:hover,
    .app-topbar .wd-notify-btn[aria-expanded="true"] {
        border-color: var(--color-blue);
        background: var(--color-surface-alt);
        color: var(--color-blue);
        box-shadow: var(--shadow-md);
    }
}

.profile-pill-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--gradient-brand);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.profile-pill-avatar-lg { width: 36px; height: 36px; font-size: 14px; }

.profile-pill-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
    line-height: 1.2;
}

.profile-pill-name {
    font-size: 12.5px;
    font-weight: 700;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-pill-role {
    font-size: 10.5px;
    font-weight: 600;
    color: var(--color-text-dim);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.profile-pill-chevron {
    width: 14px;
    height: 14px;
    color: var(--color-text-dim);
    flex-shrink: 0;
}

.profile-popover-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--color-border);
}

.profile-popover-name { font-size: 14px; font-weight: 700; color: var(--color-text); }
.profile-popover-role { font-size: 12px; color: var(--color-text-muted); margin-top: 2px; }

.profile-popover-logout { margin: 0; padding: 6px; }

.profile-popover-action {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--color-danger);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .15s var(--ease-out);
}

.profile-popover-action svg { width: 16px; height: 16px; }
.profile-popover-action:hover { background: var(--color-danger-bg); }

#wd-profile-pop { min-width: 220px; }

/* ---- Notifications ------------------------------------------------------ */
.wd-notify-wrap { position: relative; }

.wd-notify-btn {
    position: relative;
    width: 38px;
    height: 38px;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-surface);
    color: var(--color-text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color .15s var(--ease-out), color .15s var(--ease-out), background-color .15s var(--ease-out);
}

.wd-notify-btn svg { width: 18px; height: 18px; }

.wd-notify-btn:hover,
.wd-notify-btn[aria-expanded="true"] {
    border-color: var(--color-blue);
    color: var(--color-blue);
    background: var(--color-surface-alt);
}

.wd-notify-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--color-danger);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    line-height: 16px;
    text-align: center;
    box-shadow: 0 0 0 2px var(--color-surface);
}

.wd-notify-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: min(360px, calc(100vw - 24px));
    max-height: min(420px, 70dvh);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 200;
}

.wd-notify-panel[hidden] { display: none; }

.wd-notify-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--color-border);
}

.wd-notify-head h2 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--color-text);
}

.wd-notify-mark-all {
    border: none;
    background: none;
    padding: 0;
    font: inherit;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--color-blue);
    cursor: pointer;
}

.wd-notify-mark-all:hover {
    color: var(--color-blue);
    text-decoration: underline;
    text-underline-offset: var(--link-underline-offset);
    text-decoration-thickness: var(--link-underline-thickness);
    text-decoration-color: var(--link-underline-color);
}

.wd-notify-list {
    overflow-y: auto;
    flex: 1;
    padding: 6px;
}

.wd-notify-empty {
    margin: 0;
    padding: 24px 16px;
    text-align: center;
    font-size: 13px;
    color: var(--color-text-dim);
}

.wd-notify-item {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: 10px;
    background: transparent;
    text-align: left;
    cursor: pointer;
    font: inherit;
    color: inherit;
    transition: background-color .12s var(--ease-out);
}

.wd-notify-item:hover { background: var(--color-surface-alt); }

.wd-notify-item.is-unread {
    background: color-mix(in srgb, var(--color-blue) 8%, transparent);
}

.wd-notify-item-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 3px;
}

.wd-notify-item-body {
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--color-text-muted);
}

.wd-notify-item-meta {
    margin-top: 6px;
    font-size: 11px;
    color: var(--color-text-dim);
}

.wd-notify-foot {
    padding: 10px 12px;
    border-top: 1px solid var(--color-border);
}

.wd-notify-enable-push {
    width: 100%;
    padding: 9px 12px;
    border: 1px dashed var(--color-border-strong);
    border-radius: 10px;
    background: var(--color-surface-alt);
    color: var(--color-text-muted);
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color .15s var(--ease-out), color .15s var(--ease-out);
}

.wd-notify-enable-push:hover {
    border-color: var(--color-blue);
    color: var(--color-blue);
}

/* ---------------------------------------------------------------- Push onboarding banner */
.wd-push-banner {
    margin: 0 0 20px;
    animation: wd-push-banner-in .35s var(--ease-out);
}

@keyframes wd-push-banner-in {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.wd-push-banner-inner {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid color-mix(in srgb, var(--color-blue) 28%, var(--color-border));
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--color-blue) 6%, var(--color-surface));
    box-shadow: var(--shadow-sm);
    position: relative;
}

.wd-push-banner-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: color-mix(in srgb, var(--color-blue) 14%, transparent);
    color: var(--color-blue);
}

.wd-push-banner-icon svg {
    width: 20px;
    height: 20px;
}

.wd-push-banner-copy {
    flex: 1;
    min-width: 0;
}

.wd-push-banner-title {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 4px;
}

.wd-push-banner-desc {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--color-text-muted);
}

.wd-push-banner-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.wd-push-banner .btn-sm {
    padding: 7px 14px;
    font-size: 12.5px;
}

.wd-push-banner-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--color-text-dim);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color .12s var(--ease-out), color .12s var(--ease-out);
}

.wd-push-banner-close:hover {
    background: var(--color-surface-alt);
    color: var(--color-text-muted);
}

.wd-push-banner-close svg {
    width: 16px;
    height: 16px;
}

.wd-push-banner.is-denied .wd-push-banner-inner {
    border-color: var(--color-border-strong);
    background: var(--color-surface-alt);
}

.wd-push-banner.is-denied .wd-push-banner-icon {
    background: var(--color-surface);
    color: var(--color-text-dim);
}

@media (max-width: 720px) {
    .wd-push-banner-inner {
        flex-wrap: wrap;
        padding-right: 40px;
    }

    .wd-push-banner-actions {
        width: 100%;
    }

    .wd-push-banner-actions .btn {
        flex: 1;
        min-width: 0;
    }
}

:root[data-theme="dark"] .wd-push-banner-inner {
    background: color-mix(in srgb, var(--color-blue) 10%, var(--color-surface));
    border-color: color-mix(in srgb, var(--color-blue) 22%, var(--color-border));
}

:root[data-theme="dark"] .wd-push-banner.is-denied .wd-push-banner-inner {
    background: var(--color-surface-alt);
    border-color: var(--color-border);
}
