/* Navbar personalizada */
.navbar-custom {
    background: linear-gradient(135deg, var(--navbar-bg-start) 0%, var(--navbar-bg-end) 100%);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 0.75rem 0;
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 1030;
    height: 70px;
    display: flex;
    align-items: center;
}

.navbar-custom .container-fluid {
    display: flex;
    align-items: center;
    gap: 20px;
}

.navbar-page-title {
    display: flex;
    align-items: center;
    color: var(--chrome-text);
    font-size: 1.1rem;
    font-weight: 600;
    flex: 1;
}

.navbar-page-title i {
    color: #f39c12;
}

.navbar-page-title span {
    color: var(--chrome-text);
}

.navbar-toggler {
    border: none;
    color: var(--chrome-text);
    background: rgba(255,255,255,0.1);
    border-radius: 6px;
    padding: 8px 12px;
}

.navbar-toggler:focus {
    box-shadow: none;
}

.navbar-toggler i {
    color: var(--chrome-text);
}

/* Título do App Alinhado à Esquerda */
.navbar-app-title {
    display: flex;
    align-items: center;
    margin-left: 15px;
}

.navbar-app-title a {
    color: var(--chrome-text);
    text-decoration: none;
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: opacity 0.3s;
}

.navbar-app-title a:hover {
    opacity: 0.8;
}

/* Espaçador para empurrar menu do usuário para direita */
.navbar-custom .container-fluid {
    justify-content: space-between;
}

.navbar-nav .nav-link {
    color: var(--chrome-text) !important;
    font-weight: 500;
    transition: all 0.3s ease;
    margin: 0 5px;
    border-radius: 6px;
    padding: 8px 16px !important;
}

.navbar-nav .nav-link:hover {
    background-color: rgba(243, 156, 18, 0.3);
    color: var(--chrome-text-hover) !important;
}

.navbar-nav .nav-link.active {
    background-color: var(--accent-green);
    color: var(--chrome-text-hover) !important;
}

/* Botão de notificações */
.btn-notifications {
    position: relative;
    background: transparent;
    border: none;
    color: var(--chrome-text);
    font-size: 1.3rem;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.3s;
    border-radius: 8px;
}

.btn-notifications:hover {
    background-color: rgba(243, 156, 18, 0.3);
}


.notification-badge {
    position: absolute;
    top: 2px;
    right: 6px;
    background: #f39c12;
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--navbar-bg-start);
}

/* ── Notification Dropdown ── */
.notifications-wrapper {
    position: relative;
}
.notifications-panel {
    width: 340px;
}
.notifications-panel .vox-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.notifications-panel .btn-text {
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    color: var(--primary-green, #2c5530);
    text-decoration: none;
    cursor: pointer;
}
.notifications-panel .btn-text:hover {
    text-decoration: underline;
}
.notifications-panel .btn-notif-settings {
    color: var(--text-muted, #6c757d);
    font-size: 0.75rem;
    text-decoration: none;
    opacity: 0.7;
    transition: opacity 0.2s, color 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}
.notifications-panel .btn-notif-settings:hover {
    opacity: 1;
    color: var(--primary-green, #2c5530);
}
.notifications-panel .vox-panel-footer {
    text-align: center;
    padding: 10px 16px;
}
.notifications-panel .vox-panel-footer a {
    font-size: 0.8rem;
    color: var(--primary-green, #2c5530);
    font-weight: 500;
    text-decoration: none;
}
.notifications-panel .vox-panel-footer a:hover {
    text-decoration: underline;
}
.notification-item {
    display: flex;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--panel-border);
    transition: background-color 0.15s;
}
.notification-item:last-child { border-bottom: none; }
.notification-item:hover { background-color: var(--panel-hover); }
.notification-item.unread { background-color: rgba(var(--bs-primary-rgb, 13,110,253), 0.06); }
.notification-item.unread .notification-title { font-weight: 600; }
.notification-icon {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: var(--bg-light, #f0f0f0);
    flex-shrink: 0;
    font-size: 0.9rem;
}
.notification-content { flex: 1; min-width: 0; }
.notification-title { font-size: 0.85rem; line-height: 1.3; }
.notification-message { font-size: 0.78rem; color: var(--text-secondary); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notification-meta { font-size: 0.72rem; color: var(--text-muted); margin-top: 3px; }
.notification-empty { text-align: center; padding: 24px; color: var(--text-muted); font-size: 0.85rem; }
.notification-empty i { display: block; font-size: 1.8rem; margin-bottom: 8px; }
.notification-actions { display: flex; gap: 4px; align-items: flex-start; }
.btn-notif-action {
    background: none; border: none; color: #999; cursor: pointer;
    padding: 2px 6px; border-radius: 4px; font-size: 0.75rem;
}
.btn-notif-action:hover { background: rgba(0,0,0,0.06); color: #333; }

/* Avatar do usuário */
.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    color: white;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-left: 10px;
}

.user-info .user-name {
    color: var(--chrome-text);
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.2;
}

.user-info .user-role {
    color: var(--chrome-text-muted);
    font-size: 0.8rem;
    line-height: 1.2;
}



.superadmin-badge {
    display: inline-block;
    background: linear-gradient(135deg, #6b5b95, #8b7bb5);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-left: 4px;
    vertical-align: middle;
}



/* Tenant switcher — elegante org pill na navbar (superadmin) */
.org-switcher-wrapper {
    position: relative;
}
.org-switcher-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 14px 5px 6px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--chrome-text);
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.82rem;
    white-space: nowrap;
    max-width: 220px;
}
.org-switcher-pill:hover {
    background-color: rgba(243, 156, 18, 0.3);
}
.org-switcher-pill .pill-icon {
    width: 28px; height: 28px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; font-weight: 700;
    flex-shrink: 0;
}
.org-switcher-pill .pill-icon.cross-tenant-icon {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
}
.org-switcher-pill .pill-icon.org-icon {
    background: var(--primary-green);
    color: #fff;
}
.org-switcher-pill .pill-icon img {
    width: 100%; height: 100%;
    border-radius: 8px; object-fit: contain;
    background: #fff;
}
.org-switcher-pill .pill-label {
    overflow: hidden; text-overflow: ellipsis;
    font-weight: 500;
}
.org-switcher-pill .pill-chevron {
    font-size: 0.6rem; opacity: 0.6;
    margin-left: auto; transition: transform 0.25s;
}
.org-switcher-wrapper.open .pill-chevron {
    transform: rotate(180deg);
}

/* Panel de seleção (compartilhado: org-switcher + user-menu) */
.vox-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 300px;
    background: var(--panel-bg);
    border-radius: 12px;
    box-shadow: 0 8px 30px var(--shadow-heavy, rgba(0,0,0,0.18));
    z-index: 2000;
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    overflow: hidden;
    border: 1px solid var(--panel-border);
}
.vox-panel-wrapper.open .vox-panel {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.vox-panel-header {
    padding: 12px 16px 8px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--panel-text-secondary);
}
.vox-panel-search {
    padding: 6px 12px 8px;
}
.vox-panel-search input {
    width: 100%;
    padding: 7px 12px 7px 32px;
    border: 1.5px solid var(--panel-search-border);
    border-radius: 8px;
    font-size: 0.82rem;
    background: var(--panel-search-bg);
    color: var(--panel-text);
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}
.vox-panel-search input:focus {
    border-color: var(--primary-green);
    box-shadow: 0 0 0 3px rgba(44, 85, 48, 0.1);
    background: var(--panel-bg);
}
.vox-panel-search-icon {
    position: absolute;
    left: 22px;
    top: 50%;
    transform: translateY(-50%);
    color: #aaa;
    font-size: 0.78rem;
    pointer-events: none;
}
.vox-panel-scroll {
    max-height: 280px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #d1d5db transparent;
}
.vox-panel-scroll::-webkit-scrollbar { width: 5px; }
.vox-panel-scroll::-webkit-scrollbar-track { background: transparent; }
.vox-panel-scroll::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }
.vox-panel-empty {
    padding: 20px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.82rem;
    display: none;
}
.vox-panel-empty i { font-size: 1.3rem; display: block; margin-bottom: 4px; }
.org-switcher-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border-left: 3px solid transparent;
}
.org-switcher-item:hover {
    background: var(--panel-hover);
}
.org-switcher-item.active {
    background: var(--panel-active-bg);
    border-left-color: var(--primary-green);
}
.org-switcher-item.cross-tenant-item.active {
    background: #fffbeb;
    border-left-color: #f59e0b;
}
.org-switcher-item-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem; font-weight: 700;
    flex-shrink: 0;
}
.org-switcher-item-icon.ct-icon {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
}
.org-switcher-item-icon.org-icon-item {
    background: #e8f5e9;
    color: var(--primary-green);
}
.org-switcher-item-icon img {
    width: 100%; height: 100%;
    border-radius: 8px; object-fit: contain;
    background: #fff;
}
.org-switcher-item-info {
    flex: 1; min-width: 0;
}
.org-switcher-item-name {
    font-size: 0.85rem; font-weight: 600;
    color: var(--panel-text); line-height: 1.2;
    overflow: hidden; text-overflow: ellipsis;
    white-space: nowrap;
}
.org-switcher-item-sub {
    font-size: 0.7rem; color: var(--panel-text-secondary);
}
.org-switcher-item-check {
    color: var(--primary-green);
    font-size: 0.9rem; flex-shrink: 0;
    opacity: 0;
}
.org-switcher-item.active .org-switcher-item-check {
    opacity: 1;
}
.org-switcher-item.cross-tenant-item.active .org-switcher-item-check {
    color: #f59e0b;
}
.org-switcher-divider, .vox-panel-divider {
    height: 1px;
    background: var(--panel-border);
    margin: 4px 0;
}

/* ── User menu panel (mesmo estilo do org-switcher) ── */
.user-menu-wrapper {
    position: relative;
}
.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 12px 5px 5px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--chrome-text);
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none !important;
}
.user-menu-trigger:hover {
    background-color: rgba(243, 156, 18, 0.3);
}
.user-menu-trigger .trigger-chevron {
    font-size: 0.55rem; opacity: 0.5;
    transition: transform 0.25s; margin-left: 2px;
}
.user-menu-wrapper.open .trigger-chevron {
    transform: rotate(180deg);
}
.user-menu-panel {
    width: 280px;
}
.user-menu-profile-card {
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, var(--panel-active-bg) 0%, var(--panel-active-bg) 100%);
    border-bottom: 1px solid var(--panel-border);
}
.user-menu-profile-card .profile-avatar {
    width: 44px; height: 44px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; font-weight: 700; color: #fff;
    flex-shrink: 0;
}
.user-menu-profile-card .profile-avatar img {
    width: 100%; height: 100%;
    border-radius: 50%; object-fit: cover;
}
.user-menu-profile-card .profile-details {
    flex: 1; min-width: 0;
}
.user-menu-profile-card .profile-name {
    font-size: 0.9rem; font-weight: 600; color: var(--panel-text);
    line-height: 1.2;
}
.user-menu-profile-card .profile-role {
    font-size: 0.75rem; color: var(--panel-text-muted);
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border-left: 3px solid transparent;
    color: var(--panel-text);
    text-decoration: none !important;
    font-size: 0.85rem;
}
.user-menu-item:hover {
    background: var(--panel-hover);
    color: var(--panel-text);
}
.user-menu-item i {
    width: 18px; text-align: center;
    font-size: 0.9rem; color: #888;
}
.user-menu-item:hover i { color: var(--primary-green); }
.user-menu-item.danger { color: #dc3545; }
.user-menu-item.danger i { color: #dc3545; }
.user-menu-item.danger:hover { background: rgba(220, 53, 69, 0.1); }

/* Mobile */
@media (max-width: 768px) {
    .org-switcher-pill .pill-label { display: none; }
    .org-switcher-pill .pill-chevron { display: none; }
    .org-switcher-pill { padding: 4px; }
    .vox-panel { right: -40px; width: 270px; }
    .user-menu-trigger .user-info { display: none !important; }
    .user-menu-trigger { padding: 4px; gap: 0; }
    .user-menu-trigger .trigger-chevron { display: none; }
    .user-menu-panel { width: 260px; }
    .notifications-panel { width: 300px; }
}

/* ── Cross-tenant mode: visual cues ────────────── */
body.cross-tenant-mode .navbar-custom {
    border-top: 3px solid #f59e0b;
    background: linear-gradient(135deg, var(--cross-tenant-navbar-start) 0%, var(--cross-tenant-navbar-end) 100%);
}
body.cross-tenant-mode .sidebar {
    border-right: 3px solid #f59e0b;
    background: linear-gradient(180deg, var(--cross-tenant-sidebar-start) 0%, var(--cross-tenant-sidebar-end) 100%);
}
.cross-tenant-sidebar-badge {
    display: none;
    padding: 4px 12px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.1);
    border-top: 1px solid rgba(251, 191, 36, 0.15);
    border-bottom: 1px solid rgba(251, 191, 36, 0.15);
    text-align: center;
}
body.cross-tenant-mode .cross-tenant-sidebar-badge {
    display: block;
}
.sidebar.expanded .cross-tenant-sidebar-badge {
    font-size: 0.68rem;
}

.navbar-user-section {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

/* Responsividade do menu de usuário */
@media (max-width: 768px) {
    .user-info {
        display: none !important;
    }
    
    .user-avatar {
        margin: 0 !important;
    }
    
    .navbar-user-section {
        gap: 8px;
        margin-left: 10px;
    }
    
    .btn-notifications {
        padding: 8px;
    }
    
    .navbar-toggler {
        display: none !important;
    }
}

@media (max-width: 480px) {
    .navbar-app-title a {
        font-size: 1rem;
    }
    
    .user-avatar {
        width: 36px;
        height: 36px;
        font-size: 0.85rem;
    }
}

/* ============================================================
   DARK MODE overrides
   ============================================================ */
[data-bs-theme="dark"] .btn-notif-action:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--chrome-text);
}

[data-bs-theme="dark"] .org-switcher-item.cross-tenant-item.active {
    background: rgba(245, 158, 11, 0.15);
}

[data-bs-theme="dark"] .user-menu-item i {
    color: var(--text-secondary);
}

[data-bs-theme="dark"] .org-switcher-pill .pill-icon img { background: var(--card-secondary); }
[data-bs-theme="dark"] .org-switcher-item-icon.org-icon-item { background: rgba(58, 138, 66, 0.2); }
[data-bs-theme="dark"] .org-switcher-item-icon img { background: var(--card-secondary); }
[data-bs-theme="dark"] .vox-panel-scroll::-webkit-scrollbar-thumb { background: var(--border-color); }
