/* Navbar, notifications, user menu, and credit badge styles. */

[data-theme="light"] .navbar {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* --- Navbar (content-area topbar) --- */
.navbar {
    display: flex;
    align-items: center;
    font-size: 14px;
    height: var(--navbar-height);
    padding: 0 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    z-index: 100;
    flex-shrink: 0;
    gap: 12px;
}

/* Full lockup only on mobile; desktop brand lives in the sidebar. */
.navbar-logo,
.navbar-logo-mobile {
    display: none;
    align-items: center;
    color: var(--text-primary);
    white-space: nowrap;
    line-height: 0;
}

.navbar-logo .ideavibes-brand,
.navbar-logo-mobile .ideavibes-brand {
    display: block;
    width: 112px;
    height: 26px;
    aspect-ratio: 460 / 112;
    flex: 0 0 auto;
    overflow: visible;
}

.ideavibes-wordmark {
    display: inline-block;
    width: auto;
    height: 1em;
    aspect-ratio: 350 / 112;
    overflow: hidden;
    color: var(--text-primary);
    vertical-align: middle;
}

.navbar-mode-switcher {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    height: 32px;
    padding: 2px;
    margin-left: 2px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-tertiary);
    box-shadow: var(--shadow-sm);
}

.navbar-mode-segment {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 108px;
    height: 26px;
    padding: 0 12px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition:
        background var(--transition-speed),
        color var(--transition-speed),
        box-shadow var(--transition-speed);
}

.navbar-mode-segment.active {
    background: var(--bg-primary);
    color: var(--accent);
    box-shadow: var(--shadow-sm);
}

.navbar-mode-segment:not(.active):not(:disabled):hover {
    background: var(--surface);
    color: var(--text-primary);
}

.navbar-mode-segment:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.navbar-mode-segment.active:disabled {
    opacity: 1;
}

.navbar-mode-compact {
    display: none;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--accent);
    font-size: 14px;
    font-weight: 800;
    box-shadow: var(--shadow-sm);
}

.navbar-mode-compact:disabled {
    opacity: 0.65;
}

.navbar-spacer {
    flex: 1;
}

.navbar-cmd {
    display: flex;
    align-items: center;
    gap: 8px;
    height: var(--navbar-control-height);
    padding: 0 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--navbar-control-radius);
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    transition: border-color var(--transition-speed);
    white-space: nowrap;
}

.navbar-cmd:hover {
    border-color: var(--text-muted);
}

.navbar-cmd kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 20px;
    padding: 0 5px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text-muted);
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.credit-navbar-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: var(--navbar-control-height);
    padding: 0 10px;
    border-radius: var(--navbar-control-radius);
    background: transparent;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 700;
    transition: color 0.15s, background 0.15s;
}

.credit-navbar-badge:hover {
    background: var(--bg-tertiary);
}

.credit-navbar-badge strong {
    color: currentColor;
    font-size: 14px;
}

.credit-navbar-badge span {
    font-size: 14px;
}

.credit-navbar-icon {
    width: 15px;
    height: 15px;
    color: currentColor;
    fill: currentColor;
    flex-shrink: 0;
}

.credit-navbar-badge.low {
    background: color-mix(in srgb, var(--warning) 14%, transparent);
    color: var(--warning);
}

.credit-navbar-badge.critical,
.credit-navbar-badge.empty {
    background: color-mix(in srgb, var(--danger) 14%, transparent);
    color: var(--danger);
}

.credit-navbar-action {
    font-weight: 600;
    opacity: 0.9;
}

.credit-navbar-container {
    position: relative;
}

.credit-popover-backdrop {
    position: fixed;
    inset: 0;
    z-index: 99;
}

.credit-summary-popover {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 100;
    width: 300px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-secondary);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
}

.credit-summary-total,
.credit-summary-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 12px;
}

.credit-summary-total {
    align-items: baseline;
    padding: 2px 2px 10px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.credit-summary-total strong {
    font-size: 20px;
    color: var(--text-primary);
}

.credit-summary-rows {
    padding: 6px 2px 2px;
}

.credit-summary-row {
    padding: 6px 0;
    font-size: 14px;
}

.credit-summary-row > span {
    color: var(--text-secondary);
}

.credit-summary-row > strong {
    color: var(--text-primary);
}

.credit-summary-row > small {
    grid-column: 1 / -1;
    color: var(--text-muted);
    font-size: 14px;
}

.credit-summary-breakdown-toggle {
    display: block;
    margin: 2px 0 4px;
    padding: 2px 0;
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
    text-align: left;
}

.credit-summary-breakdown-toggle:hover,
.credit-summary-breakdown-toggle:focus-visible {
    color: var(--accent-hover);
    text-decoration: underline;
}

.credit-summary-detail {
    padding-left: 10px;
    border-left: 2px solid var(--border);
}

.credit-summary-loading,
.credit-summary-member-note {
    margin: 6px 2px;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.45;
}

.credit-summary-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.credit-summary-actions .credit-summary-member-note {
    margin: 0;
}

.credit-summary-link {
    margin-left: auto;
    padding: 4px;
    border-radius: 4px;
    color: var(--accent);
    font-size: 14px;
    font-weight: 600;
}

.credit-summary-link:hover,
.credit-summary-link:focus-visible {
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    color: var(--accent-hover);
}

.navbar-action-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--navbar-control-height);
    height: var(--navbar-control-height);
    border-radius: var(--navbar-control-radius);
    color: var(--text-secondary);
    transition: background var(--transition-speed), color var(--transition-speed);
}

.navbar-action-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.navbar-action-btn .badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    border: 2px solid var(--bg-secondary);
}

.navbar-action-btn .notif-badge {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: 18px;
    min-width: 20px;
    padding: 0 4px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    color: #fff;
    background: var(--danger);
    border-radius: 8px;
    border: 2px solid var(--bg-secondary);
    top: -6px;
    right: -7px;
}

/* --- Notification Dropdown --- */

.notif-container {
    position: relative;
}

.notif-backdrop {
    position: fixed;
    inset: 0;
    z-index: 99;
}

.notif-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 380px;
    max-height: 520px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.35);
    z-index: 100;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.notif-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}

.notif-header-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.notif-header-title span {
    color: var(--text-muted);
    font-weight: 500;
}

.notif-mark-read {
    background: none;
    border: none;
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.15s;
}

.notif-mark-read:hover {
    background: rgba(59,130,246,0.1);
}

.notif-list {
    flex: 1;
    overflow-y: auto;
}

.notif-group {
    margin: 0;
    padding: 12px 18px 6px;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
    border-bottom: 1px solid var(--border);
    width: 100%;
    color: inherit;
    text-align: left;
}

.notif-item:last-child {
    border-bottom: none;
}

.notif-item:hover {
    background: var(--bg-hover);
}

.notif-item.read {
    opacity: 0.6;
}

.notif-item.read:hover {
    opacity: 1;
}

.notif-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.notif-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.notif-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.notif-time {
    font-size: 14px;
    color: var(--text-muted);
    white-space: nowrap;
}

.notif-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.notif-detail {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notif-unread-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
    margin-top: 6px;
}

.notif-footer {
    padding: 10px 18px;
    border-top: 1px solid var(--border);
    text-align: center;
}

.notif-footer-link {
    background: none;
    border: none;
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.15s;
}

.notif-footer-link:hover {
    background: rgba(59,130,246,0.1);
}

/* --- User Menu Dropdown --- */

.user-menu-container {
    position: relative;
}

.user-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 99;
}

.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 260px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.35);
    z-index: 100;
    padding: 6px;
    display: flex;
    flex-direction: column;
}

.user-menu-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 10px;
}

.user-menu-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
}

.user-menu-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.user-menu-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-menu-email {
    font-size: 14px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-menu-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 6px;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    border-radius: 8px;
    border: none;
    background: none;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    text-align: left;
}

.user-menu-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.user-menu-item.logout {
    color: #f87171;
}

.user-menu-item.logout:hover {
    background: rgba(239,68,68,0.08);
    color: #f87171;
}

.user-menu-item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.7;
}

.user-menu-item:hover .user-menu-item-icon {
    opacity: 1;
}

.user-menu-item-value {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
}

.navbar-cmd-icon {
    color: var(--text-muted);
    flex-shrink: 0;
}

.navbar-avatar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background var(--transition-speed);
}

.navbar-avatar:hover {
    background: var(--bg-tertiary);
}

.navbar-avatar .avatar-circle {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
}

/* Avatar component: the <img> shares the circle class with the initials
   fallback, so make the image crop-to-fill the circle (size + radius come
   from each call site's circle class). */
img.avatar-circle,
img.user-menu-avatar,
img.team-avatar,
img.settings-avatar-circle {
    object-fit: cover;
    border-radius: 50%;
    background: none;
    padding: 0;
}

.navbar-avatar .role-badge {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
}
