/* ============================================================
   taskbar.css
   Owns all top bar and view menu styles.
   ============================================================ */

/* --- Top bar (collapsible tray) --------------------------- */
/* Slim by default (just the handle); grows to the full bar when .expanded is
   set. overflow:hidden clips the controls during the slide, and the bar
   overlays page content (which reserves only the slim height) rather than
   pushing it. */
#top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--top-bar-slim-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    overflow: hidden;
    z-index: 10;
    transition: height 0.22s ease;
}

#top-bar.expanded {
    height: var(--top-bar-h);
}

/* Collapsed handle — full-width tap target: where-you-are + unread + cue. */
#tray-handle {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    height: var(--top-bar-slim-h);
    padding: 0 1.25rem;
    background: none;
    border: none;
    cursor: pointer;
    transition: background 0.15s;
}

#tray-handle:hover { background: var(--surface-2); }
#top-bar.expanded #tray-handle { display: none; }

#tray-handle-label {
    flex: 1;
    text-align: left;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#tray-handle-badge {
    background: var(--accent-gold);
    color: #0d1117;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    flex-shrink: 0;
}

.tray-avatar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    line-height: 0;
}

/* Expanded tray — the full bar (today's layout). */
#tray-open {
    display: none;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    height: var(--top-bar-h);
    padding: 0 1.25rem;
}

#top-bar.expanded #tray-open { display: flex; }

/* Left group — menu btn + current view label */
#top-bar-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 1;
    min-width: 0;
}

/* --- Menu button ------------------------------------------ */
#menu-btn {
    position: relative;
    background: none;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text-dim);
    font-size: 1.1rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

#menu-btn:hover {
    color: var(--text);
    background: var(--surface-2);
    border-color: var(--border);
}

#menu-btn.active {
    color: var(--text);
    background: var(--surface-2);
    border-color: var(--border);
}

/* Badge on menu button */
#menu-btn-badge {
    position: absolute;
    top: -5px;
    left: -5px;
    background: var(--accent-gold);
    color: #0d1117;
    font-size: 0.6rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    line-height: 1;
}

/* --- Current view label ----------------------------------- */
#current-view-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Right group — account button */
#top-bar-right {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

/* --- Account button ----------------------------------------- */
#account-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.35rem 0.6rem;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

#account-btn:hover,
#account-btn.active {
    background: var(--surface-2);
    border-color: var(--border);
}

#account-btn-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

#account-btn-caret {
    font-size: 0.7rem;
    color: var(--text-dim);
    line-height: 1;
}

/* --- Account menu -------------------------------------------- */
#account-menu {
    position: fixed;
    top: var(--top-bar-h);
    right: 1.25rem;
    width: 200px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 50;
    padding: 0.5rem 0;
}

#account-menu-list {
    list-style: none;
}

.account-menu-item {
    padding: 0.6rem 1rem;
    color: var(--text-dim);
    font-size: 0.9rem;
    transition: background 0.15s, color 0.15s;
}

.account-menu-item:hover {
    background: var(--surface-2);
    color: var(--text);
}

#account-menu-logout {
    color: var(--error);
}

#account-menu-logout:hover {
    background: var(--surface-2);
    color: var(--error);
}

/* --- Settings / icon buttons ------------------------------ */
.icon-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1.1rem;
    padding: 0.25rem;
    border-radius: 4px;
    transition: color 0.2s;
    line-height: 1;
}

.icon-btn:hover { color: var(--text); }

/* --- View menu -------------------------------------------- */
#view-menu {
    position: fixed;
    top: var(--top-bar-h);
    left: 0;
    width: 220px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 50;
    padding: 0.5rem 0;
}

#view-menu-list {
    list-style: none;
}

.view-menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    gap: 0.75rem;
    color: var(--text-dim);
    font-size: 0.9rem;
    transition: background 0.15s, color 0.15s;
}

.view-menu-item:hover {
    background: var(--surface-2);
    color: var(--text);
}

.view-menu-item.active {
    color: var(--text);
    background: var(--surface-2);
}

.view-menu-label {
    flex: 1;
}

/* Badge on menu item */
.view-menu-badge {
    background: var(--accent-gold);
    color: #0d1117;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    flex-shrink: 0;
}

/* --- Social accordion group ------------------------------- */
.view-group-header {
    cursor: pointer;
}

.view-group-caret {
    font-size: 0.6rem;
    color: var(--text-dim);
    line-height: 1;
    flex-shrink: 0;
    transition: transform 0.2s;
}

.view-menu-group.expanded .view-group-caret {
    transform: rotate(90deg);
}

.view-submenu {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease;
}

.view-menu-group.expanded .view-submenu {
    max-height: 180px;
}

/* Indent the sub-views under the Social header */
.view-subitem {
    padding-left: 2rem;
}
