/* =============== Sidebar =============== */
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    /* top right bottom left */
    width: var(--sidebar-width);
    background: var(--container-bg-color);
    /* border-right: 1px solid var(--border-color); */
    /* box-shadow: var(--shadow-soft); */
    display: grid;
    grid-template-rows: auto 1fr auto;
    padding: 12px;
    transform: translateX(-100%);
    transition: transform 280ms ease;
    z-index: 40;
}

.app-shell[data-sidebar-open="true"] .sidebar {
    transform: translateX(0);
}

/* Header with brand and inline collapse button */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 2px;
    margin-bottom: 4px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #fff;
}

.brand-logo {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: #232525;
    color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(48, 197, 181, 0.10);
    font-size: 12px;
}

.brand-text {
    font-weight: 600;
    letter-spacing: -0.2px;
    font-size: 14px;
}

.sidebar-collapse {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: #181B1B;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 180ms ease, color 180ms ease, transform 180ms ease;
    font-size: 12px;
}

.sidebar-collapse:hover {
    background: var(--sidebar-hover);
    color: #fff;
    transform: translateY(-1px);
}

/* Scrollable nav area */
.sidebar-scroll {
    overflow-y: auto;
    padding: 4px 2px;
}

.sidebar-scroll::-webkit-scrollbar {
    width: 8px;
}

.sidebar-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 8px;
}

.section-title {
    color: var(--text-secondary);
    font-size: 11px;
    letter-spacing: 0.1px;
    margin: 8px 8px 6px;
}

.nav-section+.nav-section {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    min-height: 32px;
    border-radius: 10px;
    color: #ffffff;
    text-decoration: none;
    transition: background-color 180ms ease, color 180ms ease, transform 180ms ease;
    will-change: transform;
    opacity: 0;
    transform: translateX(-8px);
    font-size: 13px;
}

.nav-link i {
    color: #ffffff;
    width: 16px;
    text-align: center;
    font-size: 12px;
}

.nav-link span {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
    transform: translateX(-2px);
}

/* Staggered reveal when sidebar opens */
.app-shell[data-sidebar-open="true"] .nav-link {
    opacity: 1;
    transform: translateX(0);
}

.app-shell[data-sidebar-open="true"] .nav-links li:nth-child(1) .nav-link {
    transition-delay: 70ms;
}

.app-shell[data-sidebar-open="true"] .nav-links li:nth-child(2) .nav-link {
    transition-delay: 120ms;
}

.app-shell[data-sidebar-open="true"] .nav-links li:nth-child(3) .nav-link {
    transition-delay: 170ms;
}

/* Active link state */
.nav-link.is-active {
    background: #232525;
    color: #ffffff;
}

.nav-link.is-active i {
    color: #ffffff;
}

/* Create button - same styling as other nav links */
.nav-link.create-btn {
    background: transparent;
    color: #ffffff;
    border: none;
    justify-content: flex-start;
    margin: 0;
    text-align: left;
    border-radius: 5px;
    font-weight: 400;
}

.nav-link.create-btn:hover {
    background-color: var(--sidebar-hover);
}

/* Chat list */
.chat-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 0 4px;
}

.chat-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    min-height: 30px;
    border-radius: 12px;
    background: none;
    color: #ffffff;
    text-decoration: none;
    transition: background-color 180ms ease, color 180ms ease, transform 180ms ease;
    font-size: 12px;
}

.chat-pill i {
    display: none;
}

.chat-pill span {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-pill:hover {
    background: #232525;
    color: #fff;
}

.chat-pill.is-active {
    background: #232525;
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.08);
}

/* Upgrade Button - Dark theme, smaller size */
.upgrade-btn {
    width: 100%;
    margin-bottom: 12px;
    display: flex !important;
    visibility: visible !important;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;

    /* Button styling - dark theme */
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.upgrade-text {
    color: #d0d0d0;
    font-weight: 400;
    font-size: 12px;
    margin-right: 6px;
}

.pro-badge {
    background: #26a69a;
    color: #ffffff;
    font-weight: 600;
    font-size: 10px;
    padding: 3px 6px;
    border-radius: 4px;
    letter-spacing: 0.3px;
}

.upgrade-btn i {
    color: #d0d0d0;
    font-size: 12px;
    margin-left: auto;
}

.upgrade-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.upgrade-btn:active {
    transform: translateY(0);
    background: rgba(255, 255, 255, 0.03);
}

.sidebar-bottom {
    padding-top: 8px;
    margin-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: none;
    border-radius: 10px;
    background: none;
}

.avatar {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: #353535;
    color: #e6e6e6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
}

.user-meta {
    line-height: 1.15;
}

.user-meta .name {
    color: #e8e8e8;
    font-size: 12px;
}

.sub-action {
    color: var(--text-secondary);
    font-size: 11px;
    text-decoration: none;
}

.sub-action:hover {
    color: var(--accent-color);
}

.user-menu-container {
    position: relative;
    margin-left: auto;
}

.user-menu {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.user-menu:hover {
    color: #fff;
}

/* User Dropdown Menu */
.user-dropdown {
    position: absolute;
    top: 100%;
    right: -8px;
    margin-top: 10px;
    background: #2A2A2A;
    border-radius: 12px;
    padding: 8px;
    width: calc(var(--sidebar-width) - 24px);
    /* Slightly less than sidebar width */
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1000;

    /* Initially hidden with slide-down effect */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-12px);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.user-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    border-radius: 6px;
    text-decoration: none;
    color: #E5E5E5;
    font-size: 12px;
    font-weight: 400;
    transition: background-color 0.2s ease;
    margin-bottom: 2px;
    min-height: 28px;
}

/* Make email text more subtle */
.dropdown-item:first-child {
    color: #A0A0A0;
}

.dropdown-item:last-child {
    margin-bottom: 0;
}

/* Add hover effect only to items that are links */
.dropdown-item.is-link:hover {
    background-color: #3C3C3C;
    cursor: pointer;
}

/* Icon styling */
.dropdown-item .fa-solid,
.dropdown-item .fa-regular {
    color: #B4B4B4;
    font-size: 14px;
    width: 16px;
    text-align: center;
    margin-right: 8px;
    flex-shrink: 0;
}

/* Text content with ellipsis */
.dropdown-item span {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-divider {
    border: none;
    border-top: 1px solid #404040;
    margin: 2px 0;
}

/* Specific styles for the "Help" item with the chevron */
.dropdown-item.has-chevron {
    justify-content: space-between;
}

.item-content {
    display: flex;
    align-items: center;
}

.has-chevron .fa-chevron-right {
    font-size: 10px;
    color: #B4B4B4;
    margin-right: 0;
    flex-shrink: 0;
}

/* Ensure item-content can shrink with ellipsis */
.item-content {
    flex: 1;
    min-width: 0;
}

.item-content span {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Toggle button */
.sidebar-toggle {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 45;
    width: 34px;
    height: 34px;
    background: transparent;
    color: #cfcfcf;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: left 280ms ease, color 200ms ease;
    font-size: 16px;
}

.sidebar-toggle:hover {
    color: #fff;
}

.sidebar-toggle i {
    transition: transform 300ms ease;
}

.app-shell[data-sidebar-open="true"] .sidebar-toggle i {
    transform: rotate(90deg);
}

/* When open, nudge the button so it remains near the content edge */
.app-shell[data-sidebar-open="true"] .sidebar-toggle {
    left: calc(12px + var(--sidebar-width));
}