/* ================================================================
   organization-switcher.css
   Auth buttons / user menu state management
   Pure CSS — no inline styles needed.
   ================================================================ */

/* ── Visibility classes ──────────────────────────────────────── */
.nb-hidden {
    display: none !important;
}
 

a#pr-org-logout-btn {
    color: black;
}

/* ── Skeleton loader ─────────────────────────────────────────── */
.nb-skeleton {
    display: block;
    border-radius: 999px;
    background: linear-gradient(
        90deg,
        #e8e8e8 25%,
        #f5f5f5 50%,
        #e8e8e8 75%
    );
    background-size: 200% 100%;
    animation: nb-shimmer 1.5s ease-in-out infinite;
}

/* ── Skeleton dimension variants (match button sizes) ────────── */
.nb-skeleton--login {
    width: 80px;
    height: 40px;
}
.nb-skeleton--cta {
    width: 130px;
    height: 40px;
}

/* ── Skeleton shimmer keyframes ──────────────────────────────── */
@keyframes nb-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}



/* ── User avatar skeleton (circular, matches profile pic) ───── */
.nb-skeleton--avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

/* ── Mobile skeleton (full-width, taller) ────────────────────── */
.nb-skeleton--mobile-login {
    width: 100%;
    height: 45px;
    border-radius: 10px;
}
.nb-skeleton--mobile-cta {
    width: 100%;
    height: 48px;
    border-radius: 10px;
}

/* ── Error message ───────────────────────────────────────────── */
#nb-auth-buttons {
    position: relative;
}
.nb-auth-error {
    position: absolute;
    top: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    font-size: 13px;
    color: #d32f2f;
    white-space: nowrap;
    background: #fff;
    padding: 4px 12px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    z-index: 10;
}
.nb-auth-error.nb-hidden {
    display: none;
}

/* ── User profile avatar ─────────────────────────────────────── */
#pr-org-user-profile-image {
    border-radius: 50%;
    overflow: hidden;
    width: 40px;
    height: 40px;
    border: 2px solid #2C67FF;
}
#pr-org-user-profile-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ── Fade-in for user buttons on success ─────────────────────── */
#nb-user-buttons.nb-visible {
    animation: nb-fade-in 0.3s ease-out;
}

@keyframes nb-fade-in {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ================================================================
   ORGANIZATION SWITCHER DROPDOWN ("Your Organizations" menu)
   ================================================================ */

:root {
    --pr-org-brand: #2C67FF;
    --pr-org-text: #1a1a1a;
    --pr-org-muted: #6b7280;
    --pr-org-border: #e5e7eb;
    --pr-org-hover: #f3f6ff;
}

/* ── Trigger (avatar + name + chevron) ───────────────────────── */
.pr-org-action {
    position: relative;
    display: inline-flex;
}

.pr-org-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px;
    border-radius: 999px;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s ease;
}
.pr-org-profile:hover {
    background-color: var(--pr-org-hover);
}

.pr-org-profile-header {
    display: flex;
    align-items: center;
    gap: 6px;
}
.pr-org-profile-header h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--pr-org-text);
    line-height: 1.2;
    white-space: nowrap;
}
.pr-org-arrow-icon {
    font-size: 12px;
    color: var(--pr-org-muted);
    transition: transform 0.2s ease;
}
.pr-org-action.active .pr-org-arrow-icon {
    transform: rotate(180deg);
}

/* ── Dropdown panel ──────────────────────────────────────────── */
.pr-org-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 320px;
    max-width: calc(100vw - 32px);
    background: #fff;
    border: 1px solid var(--pr-org-border);
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(16, 24, 40, 0.12);
    padding: 12px;
    z-index: 1000;

    /* hidden by default; .active reveals it */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}
.pr-org-action.active .pr-org-menu,
.pr-org-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.pr-org-menu-title {
    margin: 4px 4px 10px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--pr-org-muted);
}

/* ── Organization list ───────────────────────────────────────── */
.pr-org-organization-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 280px;
    overflow-y: auto;
}

.pr-org-organization-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}
.pr-org-organization-item:hover {
    background-color: var(--pr-org-hover);
}
/* .pr-org-organization-item.active {
    background-color: var(--pr-org-hover);
    box-shadow: inset 0 0 0 1px rgba(44, 103, 255, 0.35);
} */

.pr-org-organization-avatar-wrapper {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    background: #f0f2f5;
}
.pr-org-organization-avatar-wrapper > div {
    width: 100%;
    height: 100%;
}
.pr-org-organization-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 50%;
}

/* Fallback initials avatar (rendered when no logo / image load fails).
   The JS emits Tailwind utility classes that aren't loaded in this theme,
   so these rules make the initials render correctly on their own. */
.pr-org-organization-avatar,
.pr-org-user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background-color: #dfe8ff;
    color: var(--pr-org-brand);
    font-weight: 600;
    font-size: 15px;
    border-radius: 50%;
}
.pr-org-organization-avatar p,
.pr-org-user-avatar p {
    margin: 0;
    line-height: 1;
    color: inherit;
}
/* When it's a real <img>, the cover fit wins over the flex fallback. */
img.pr-org-organization-avatar,
img.pr-org-user-avatar {
    object-fit: cover;
}

.pr-org-organization-info {
    min-width: 0;
    flex: 1 1 auto;
}
.pr-org-organization-info a {
    text-decoration: none;
    display: block;
}
.pr-org-organization-info h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--pr-org-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pr-org-organization-info p {
    margin: 2px 0 0;
    font-size: 12px;
    color: var(--pr-org-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Action buttons ──────────────────────────────────────────── */
.pr-org-primary-btn,
.pr-org-secondary-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}
.pr-org-primary-btn {
    background-color: var(--pr-org-brand);
    color: #fff;
}
.pr-org-primary-btn:hover {
    background-color: #1e4fd6;
}
.pr-org-secondary-btn {
    background-color: #fff;
    color: var(--pr-org-text);
    border-color: var(--pr-org-border);
}
.pr-org-secondary-btn:hover {
    background-color: var(--pr-org-hover);
    border-color: var(--pr-org-brand);
}

/* ── Footer / logout ─────────────────────────────────────────── */
.pr-org-menu-footer {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--pr-org-border);
}
.pr-org-menu-footer a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500; 
    text-decoration: none;
    transition: background-color 0.15s ease;
}
 

/* ── Small screens: keep the dropdown from overflowing the viewport ── */
@media (max-width: 420px) {
    .pr-org-menu {
        right: -50px;
        width: calc(100vw - 24px);
    }
}

/* ── Narrow phones: logo + avatar + hamburger all share one row, so
   drop the name label and keep just the avatar + chevron trigger ── */
@media (max-width: 480px) {
    #nb-user-buttons .pr-org-profile-name {
        display: none;
    }
    #nb-user-buttons .pr-org-profile {
        gap: 0;
        padding: 4px;
    }
}

/* ── Mobile skeletons are hidden on desktop and vice versa ───── */
@media (min-width: 981px) {
    .nb-skeleton--mobile-login,
    .nb-skeleton--mobile-cta {
        display: none;
    }
}

/* ── User skeleton visible on mobile only ───────────────────── */
@media (max-width: 980px) {
    #nb-user-skeleton {
        display: flex;
        align-items: center;
        margin-left: auto;
    }
}

@media (min-width: 981px) {
    #nb-user-skeleton {
        display: none;
    }
}
