html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

.page {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.page-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

main {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.content {
    padding-top: 1.1rem;
    flex: 1;
}

.sidebar {
    background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%);
    width: 250px;
    min-width: 250px;
    max-width: 250px;
    transition: width 0.3s ease, opacity 0.3s ease;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.sidebar.collapsed {
    width: 0;
    opacity: 0;
    overflow: hidden;
}

.nav-scrollable {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
    width: 100%;
    box-sizing: border-box;
}

.nav-scrollable nav {
    flex: 1;
    padding: 1rem 0;
}

.nav-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: auto;
    flex-shrink: 0;
}

.nav-footer small {
    color: rgba(255, 255, 255, 0.6) !important;
    font-size: 0.75rem;
}

.nav-section {
    margin-bottom: 1rem;
}

.nav-section-header {
    color: #d7d7d7;
    font-weight: 600;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.nav-section-header .bi:first-child {
    margin-right: 0.5rem;
}

.nav-section-menu-button {
    color: #d7d7d7;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: 1rem;
    opacity: 0.7;
    transition: opacity 0.2s;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-section-menu-button:hover {
    opacity: 1;
    color: white;
}

.nav-section-content {
    padding-top: 0.25rem;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

.nav-item {
    padding: 0.25rem 0;
    width: 100%;
    box-sizing: border-box;
}

/* Override Bootstrap px-3 padding for nav-items to prevent overflow */
.nav-item.px-3 {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.nav-item ::deep a {
    color: white;
    border-radius: 4px;
    height: 2.5rem;
    min-height: 2.5rem;
    max-height: 2.5rem;
    display: flex;
    align-items: center;
    line-height: 2.5rem;
    text-decoration: none;
    padding-left: 0.75rem;
    padding-right: 0.5rem;
    transition: background-color 0.2s;
    position: relative;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
    max-width: 100%;
}

.nav-item ::deep a::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 0;
    transition: background 0.2s;
    pointer-events: none;
}

.nav-item ::deep a:hover::before,
.nav-item ::deep a.active::before {
    background: rgba(0, 0, 0, 0.2);
}

.nav-item ::deep a .list-item {
    position: relative;
    z-index: 1;
    width: 100%;
    min-width: 0;
    flex-shrink: 1;
    overflow: hidden;
}

/* Only show overlay if there's a background image */
.nav-item ::deep a[style*="background-image"]::before {
    display: block;
}

.nav-item ::deep a:not([style*="background-image"])::before {
    display: none;
}

.nav-item ::deep a:hover {
    background-color: rgba(255,255,255,0.1);
    color: white;
    width: 100%;
}

.nav-item ::deep a.show-more-link {
    color: #d7d7d7;
    cursor: pointer;
}

.nav-item ::deep a.active {
    background-color: rgba(255,255,255,0.37);
    color: white;
}

.list-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    width: 100%;
}

.list-icon, .list-icon-initials, .list-icon-placeholder {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: white;
}

.list-icon {
    object-fit: cover;
}

.list-icon-initials {
    font-weight: 600;
}

.list-icon-placeholder {
    font-size: 0.875rem;
}

.space-icon-no-bg {
    background-color: transparent !important;
    background: none !important;
}

.list-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: white;
}

.new-space-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    width: 100%;
}

.new-space-input {
    flex: 1;
    min-width: 0;
    max-width: 140px; /* Constrain to fit within 250px sidebar with padding and buttons */
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    color: white;
    font-size: 0.875rem;
    outline: none;
    transition: background-color 0.2s, border-color 0.2s;
}

.new-space-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.new-space-input:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
}

.new-space-input:hover {
    background: rgba(255, 255, 255, 0.12);
}

.new-space-confirm-btn,
.new-space-cancel-btn {
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 0.5rem;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    transition: background-color 0.2s, border-color 0.2s;
    outline: none;
}

.new-space-confirm-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

.new-space-cancel-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

.new-space-confirm-btn:active,
.new-space-cancel-btn:active {
    background: rgba(255, 255, 255, 0.15);
}

.space-item-wrapper,
.list-item-wrapper {
    position: relative;
    min-height: 2.5rem;
    width: 100%;
}

.space-item-wrapper .nav-link {
    height: 2.5rem;
    min-height: 2.5rem;
    max-height: 2.5rem;
    width: 100%;
    box-sizing: border-box;
}

.space-menu-button,
.list-menu-button {
    display: flex;
    color: #d7d7d7;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    font-size: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    min-width: 24px;
    max-width: 24px;
    min-height: 24px;
    max-height: 24px;
    align-items: center;
    justify-content: center;
}

.space-item-wrapper:hover .space-menu-button,
.space-menu-button.active,
.list-item-wrapper:hover .list-menu-button,
.list-menu-button.active {
    opacity: 0.7;
    visibility: visible;
}

.space-menu-button:hover,
.list-menu-button:hover {
    opacity: 1 !important;
    color: white;
}

.list-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.list-item-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
    flex-shrink: 0;
}

.list-drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    cursor: grab;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.list-item-wrapper:hover .list-drag-handle {
    opacity: 0.5;
    visibility: visible;
}

.list-drag-handle:active {
    cursor: grabbing;
    opacity: 0.8 !important;
}

.drag-handle-dots-horizontal {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 2px;
    width: 16px;
    height: 12px;
}

.drag-handle-dots-horizontal span {
    width: 3px;
    height: 3px;
    background-color: #495057;
    border-radius: 50%;
}

.list-item-wrapper:hover .drag-handle-dots-horizontal span {
    background-color: #212529;
}

.list-menu-button {
    color: #adb5bd;
}

.list-item-wrapper:hover .list-menu-button {
    opacity: 0.8;
    visibility: visible;
}

.list-menu-button:hover {
    opacity: 1 !important;
    color: #ffffff;
}

.space-menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: transparent;
}

.space-menu-popover {
    position: fixed;
    z-index: 1201;
    min-width: 200px;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 8px;
    box-shadow: 0 10px 26px rgba(0,0,0,0.18);
    padding: 0;
}

.space-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(0,0,0,0.12);
    font-weight: 600;
    font-size: 0.9rem;
    color: #212529;
}

.space-menu-close {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: #666;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.space-menu-close:hover {
    color: #000;
}

.space-menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    padding: 0.6rem 1rem;
    border: none;
    background: transparent;
    color: #212529;
    font-size: 0.95rem;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.2s;
}

.space-menu-item:hover {
    background: rgba(0,0,0,0.05);
}

.new-badge {
    font-size: 0.65rem;
    padding: 0.15rem 0.35rem;
    margin-left: auto;
}

.top-row {
    background-color: #f7f7f7;
    border-bottom: 1px solid #d6d5d5;
    justify-content: space-between;
    height: 3.5rem;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    width: 100%;
    z-index: 100;
}

.top-row-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.top-row-right {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.top-nav-icon-button {
    color: #333;
    padding: 0.25rem 0.5rem;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.top-nav-icon-button:hover:not(:disabled) {
    background-color: rgba(0,0,0,0.05);
    border-radius: 4px;
}

.top-nav-icon-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.top-nav-menu {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.top-nav-menu-button {
    color: #333;
    padding: 0.25rem 0.5rem;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.top-nav-menu-button:hover {
    background-color: rgba(0,0,0,0.05);
    border-radius: 4px;
}

.top-nav-menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: transparent;
}

.top-nav-menu-popover {
    position: absolute;
    top: calc(100% + 0.35rem);
    right: 0;
    z-index: 1201;
    min-width: 200px;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 8px;
    box-shadow: 0 10px 26px rgba(0,0,0,0.18);
    padding: 0.35rem 0;
}

.top-nav-menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.9rem;
    border: none;
    background: transparent;
    color: #212529;
    font-size: 0.95rem;
    text-align: left;
    cursor: pointer;
}

.top-nav-menu-item .bi {
    width: 18px;
    display: inline-flex;
    justify-content: center;
}

.top-nav-menu-item:hover {
    background: rgba(0,0,0,0.05);
}

.top-nav-menu-item:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.top-nav-menu-sep {
    height: 1px;
    background: rgba(0,0,0,0.12);
    margin: 0.35rem 0;
}

.sidebar-toggle {
    color: #333;
    padding: 0.25rem 0.5rem;
    border: none;
    background: none;
    cursor: pointer;
}

.sidebar-toggle:hover {
    background-color: rgba(0,0,0,0.05);
}

.navbar-brand {
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
    text-decoration: none;
}

.navbar-brand:hover {
    color: #000;
    text-decoration: none;
}

/* Notification Bell */
.notification-bell-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
}

.notification-bell-button {
    padding: 0.25rem 0.5rem;
    color: #333;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.notification-bell-button:hover {
    background-color: rgba(0,0,0,0.05);
    color: #000;
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background-color: #f44336; /* Red */
    color: white;
    border-radius: 50%;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    padding: 0 4px;
    border: 2px solid white;
    box-sizing: border-box;
}

.top-row ::deep a, .top-row ::deep .btn-link {
    white-space: nowrap;
    margin-left: 1.5rem;
    text-decoration: none;
}

.top-row ::deep a:hover, .top-row ::deep .btn-link:hover {
    text-decoration: underline;
}

.top-row ::deep a:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 640.98px) {
    .top-row {
        justify-content: space-between;
    }

    .top-row ::deep a, .top-row ::deep .btn-link {
        margin-left: 0;
    }
}

@media (min-width: 641px) {
    .page-content {
        flex-direction: row;
    }

    .sidebar {
        height: 100%;
    }
}

@media (max-width: 640.98px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 3.5rem;
        height: calc(100vh - 3.5rem);
        z-index: 1000;
        box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    }

    .sidebar.collapsed {
        left: -250px;
    }
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

/* Mention Input (SLW) */
.mention-input-container {
    position: relative;
    width: 100%;
}

.mention-picker {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + 8px);
    background-color: #2a2a2a;
    border: 1px solid #555;
    border-radius: 8px;
    box-shadow: 0 10px 26px rgba(0,0,0,0.35);
    max-height: 220px;
    overflow-y: auto;
    z-index: 2000;
    padding: 6px 0;
}

.mention-picker-visible {
    display: block;
}

.mention-picker-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    user-select: none;
}

.mention-picker-item:hover,
.mention-picker-item-selected {
    background-color: rgba(255,255,255,0.06);
}

.mention-picker-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.mention-picker-avatar-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.75rem;
    border: 1px solid rgba(255,255,255,0.15);
}

.mention-picker-name {
    color: #e0e0e0;
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mention-picker-empty {
    padding: 10px 12px;
    color: #9aa0a6;
    font-size: 0.9rem;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }
