.sidebar { position: fixed; top: 0; right: 0; bottom: 0; width: 260px; background: var(--sidebar-bg); color: var(--sidebar-text); transform: translateX(0); /* The width transition drives the whole expansion; text reveal is gated by the matching delay below so labels never reflow mid-flight. */ transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1); z-index: 40; display: flex; flex-direction: column; border-left: 1px solid var(--sidebar-border); overflow: hidden; } .sidebar.open { width: 260px; } .sidebar:not(.open) { width: 72px; padding-bottom: 0.5rem; } .sidebar-inner { display: flex; flex-direction: column; flex: 1; overflow: hidden; } /* Sidebar width animation: 0.35s. Text must not appear until the sidebar is wide enough to hold the label on one line, so every label fades in only AFTER the width transition finishes (delay = full duration) and fades out immediately when collapsing. This prevents Persian text from wrapping vertically. */ :root { --sidebar-expand-duration: 0.35s; --sidebar-collapse-duration: 0.15s; } /* Scoped to `.sidebar`: the account menu is a CDK overlay rendered outside the sidebar DOM, so unscoping these selectors would hide the username inside the dropdown too. */ .sidebar .nav-label, .sidebar .history-text, .sidebar .history-header .history-title, .sidebar .user-info, .sidebar .theme-toggle span { max-width: 0; opacity: 0; overflow: hidden; white-space: nowrap; transform: translateX(-8px); /* Fast fade OUT when collapsing — no delay on the way in. */ transition: max-width var(--sidebar-collapse-duration) ease-in, opacity var(--sidebar-collapse-duration) ease-in, transform var(--sidebar-collapse-duration) ease-in; } /* Expanded state: the sidebar has finished growing, so the label can fade in. `max-width: 100%` lets it occupy only the remaining space next to the icon (never forcing a second line), and the delay guarantees the width is already sufficient before the text becomes visible. */ .sidebar.open .nav-label, .sidebar.open .history-text, .sidebar.open .history-header .history-title, .sidebar.open .user-info, .sidebar.open .theme-toggle span { max-width: 100%; opacity: 1; transform: translateX(0); transition: max-width var(--sidebar-expand-duration) ease-out var(--sidebar-expand-duration), opacity var(--sidebar-expand-duration) ease-out var(--sidebar-expand-duration), transform var(--sidebar-expand-duration) ease-out var(--sidebar-expand-duration); } .sidebar-top { padding: 0.75rem; display: flex; flex-direction: column; gap: 0.5rem; } .sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: 0.5rem; min-height: 48px; position: relative; overflow: hidden; } .sidebar-logo { height: 32px; width: auto; object-fit: contain; } .sidebar-logo-link { display: inline-flex; align-items: center; cursor: pointer; position: relative; overflow: hidden; } .sidebar-logo-link:hover .sidebar-logo { opacity: 0.85; } .sidebar:not(.open) .sidebar-logo-link { justify-content: center; width: 40px; height: 40px; margin: 0 auto; } .sidebar:not(.open) .sidebar-logo { height: 28px; } /* Keep the logo in the same 40px column as the nav items. */ .sidebar:not(.open) .sidebar-header { justify-content: center; padding: 0.5rem 0; } .sidebar:not(.open) .close-btn { display: none; } .sidebar-open-icon { position: absolute; inset: 0; margin: auto; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 0.5rem; background: var(--surface-bg); color: var(--sidebar-text); border: 1px solid var(--sidebar-border); box-shadow: 0 8px 24px rgb(0 0 0 / 12%); opacity: 0; visibility: hidden; transition: opacity 0.2s, visibility 0.2s; } .sidebar:not(.open) .sidebar-logo-link:hover .sidebar-logo { opacity: 0; visibility: hidden; } .sidebar:not(.open) .sidebar-logo-link:hover .sidebar-open-icon { opacity: 1; visibility: visible; } .sidebar-title { font-size: 1rem; font-weight: 600; margin: 0; color: var(--sidebar-text); } .close-btn { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: none; background: transparent; color: var(--sidebar-muted); border-radius: 0.375rem; cursor: pointer; transition: background 0.2s; flex-shrink: 0; } .close-btn:hover { background: var(--sidebar-hover); } .sidebar:not(.open) .close-btn { display: none; } .new-chat-btn { display: flex; align-items: center; gap: 0.75rem; width: 100%; padding: 0.75rem; border: 1px solid var(--sidebar-border); background: transparent; color: var(--sidebar-text); border-radius: 0.5rem; cursor: pointer; font-size: 0.875rem; transition: background 0.2s; text-align: start; } .new-chat-btn:hover { background: var(--sidebar-hover); } .nav-menu { display: flex; flex-direction: column; gap: 0.25rem; } .nav-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem; border-radius: 0.5rem; color: var(--sidebar-muted); text-decoration: none; font-size: 0.875rem; font-weight: 500; transition: background 0.2s; /* Keep the icon and label on one line regardless of sidebar width. */ min-width: 0; } .nav-item:hover { background: var(--sidebar-hover); } .nav-item.active { background: var(--sidebar-hover); color: var(--sidebar-text); font-weight: 500; } /* Collapsed rail (72px): a fixed 40px item column centred in the rail, so every icon lines up with the others and with the logo/avatar above it. */ .sidebar:not(.open) .sidebar-top { padding: 0.75rem 1rem; align-items: center; } .sidebar:not(.open) .nav-item { justify-content: center; gap: 0; width: 40px; height: 40px; padding: 0; margin: 0 auto; box-sizing: border-box; } .sidebar:not(.open) .nav-item .nav-icon { flex-shrink: 0; display: flex; align-items: center; justify-content: center; } .sidebar-divider { height: 1px; background: var(--sidebar-border); margin: 0 0.75rem; } .sidebar:not(.open) .sidebar-divider { /* Same 40px column inset (16px each side of the 72px rail). */ margin: 0 1rem; } .sidebar-bottom { flex: 1; overflow-y: auto; padding: 0.75rem; display: flex; flex-direction: column; gap: 0.5rem; } .sidebar:not(.open) .sidebar-bottom { display: none; } .sidebar:not(.open) .history-header { display: none; } .history-list { display: flex; flex-direction: column; gap: 0.25rem; } .history-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem; border: none; background: transparent; color: var(--sidebar-muted); border-radius: 0.5rem; cursor: pointer; font-size: 0.875rem; text-align: start; transition: background 0.2s; width: 100%; } .history-item:hover { background: var(--sidebar-hover); } .sidebar:not(.open) .history-item { justify-content: center; padding: 0.75rem 0; } .sidebar:not(.open) .history-item svg { margin: 0; } /* The whole lower section collapses with the sidebar; its labels animate via the shared width/opacity transition defined earlier. */ .sidebar:not(.open) .history-header { justify-content: center; } .history-header { display: flex; padding: 0.25rem 0.5rem; font-size: 0.75rem; font-weight: 500; color: var(--sidebar-muted); text-transform: uppercase; letter-spacing: 0.05em; min-width: 0; } .history-icon { flex-shrink: 0; opacity: 0.7; } .history-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; } .history-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem; padding: 1.5rem 0.75rem; font-size: 0.875rem; color: var(--sidebar-muted); text-align: center; } .history-empty-icon { opacity: 0.5; margin-bottom: 0.25rem; } .sidebar-footer { padding: 0.75rem; border-top: 1px solid var(--sidebar-border); display: flex; flex-direction: column; gap: 0.5rem; margin-top: auto; } .sidebar:not(.open) .sidebar-footer { align-items: center; padding: 0.75rem 1rem; margin-top: auto; } .sidebar:not(.open) .user-profile { width: 40px; height: 40px; padding: 0; gap: 0; border-radius: 50%; justify-content: center; } /* Theme-toggle label animates with the shared transition instead of display:none. */ .user-profile { display: flex; align-items: center; gap: 0.75rem; width: 100%; padding: 0.5rem; border: none; border-radius: 0.75rem; background: transparent; color: var(--sidebar-text); text-align: start; cursor: pointer; min-width: 0; } .user-profile:hover, .user-profile.menu-open { background: var(--sidebar-hover); } .user-profile:focus-visible, .account-menu-item:focus-visible { outline: 2px solid var(--sidebar-muted); outline-offset: -2px; } .account-menu { width: 236px; max-width: calc(100vw - 24px); padding: 0.5rem; border: 1px solid var(--sidebar-border); border-radius: 1.25rem; background: var(--surface-bg); color: var(--sidebar-text); box-shadow: 0 8px 24px rgb(0 0 0 / 12%); } .account-menu-header { display: flex; align-items: center; /* dir="rtl" on .account-menu already lays children right→left, so the default `row` order puts the avatar on the right and the name beside it to the left. */ gap: 0.5rem; padding: 0.5rem; } .account-menu-header .user-info { text-align: start; } .account-menu-divider { height: 1px; margin: 0.375rem 0.5rem; background: var(--sidebar-border); } .account-menu-item { display: flex; align-items: center; /* justify-content: space-between; */ gap: 0.75rem; width: 100%; padding: 0.625rem 0.75rem; border: none; border-radius: 0.5rem; background: transparent; color: inherit; font-size: 0.875rem; text-align: start; cursor: pointer; } .account-menu-item:hover, .account-menu-item:focus { background: var(--sidebar-hover); } .account-menu-item svg { flex-shrink: 0; } .user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--sidebar-hover); color: var(--sidebar-text); display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 500; flex-shrink: 0; } .user-info { display: flex; flex-direction: column; gap: 0.125rem; overflow: hidden; min-width: 0; } .user-name { font-size: 0.875rem; font-weight: 500; color: var(--sidebar-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .claim-btn { display: flex; align-items: center; justify-content: center; gap: 0.5rem; width: 100%; padding: 0.625rem; border: 1px solid var(--sidebar-border); background: transparent; color: var(--sidebar-text); border-radius: 0.5rem; cursor: pointer; font-size: 0.875rem; transition: background 0.2s; } .claim-btn:hover { background: var(--sidebar-hover); } .sidebar:not(.open) .claim-btn { width: 40px; height: 40px; padding: 0; border-radius: 0.5rem; justify-content: center; } .sidebar:not(.open) .claim-btn svg { margin: 0; } /* Label collapse is handled by the shared width/opacity transition. */ .theme-toggle { display: flex; align-items: center; justify-content: center; gap: 0.5rem; width: 100%; padding: 0.625rem; border: 1px solid var(--sidebar-border); background: transparent; color: var(--sidebar-text); border-radius: 0.5rem; cursor: pointer; font-size: 0.875rem; transition: background 0.2s; } .theme-toggle:hover { background: var(--sidebar-hover); } .sidebar:not(.open) .theme-toggle { width: 40px; height: 40px; padding: 0; gap: 0; border-radius: 0.5rem; justify-content: center; } .sidebar:not(.open) .theme-toggle svg { margin: 0; flex-shrink: 0; } /* Collapsed rail: the avatar text must not stretch the 40px column. */ .sidebar:not(.open) .user-avatar { flex-shrink: 0; }