Newer
Older
cortex-hub / ui / client-app / src / components / SessionSidebar.css
/* SessionSidebar.css
   Uses CSS custom properties so it adapts to whatever Tailwind light/dark
   the rest of the app is using, rather than forcing its own dark palette.    */

/* ── Layout ──────────────────────────────────────────────────────────── */
.session-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    /* Slide in/out smoothly */
    transform: translateX(-100%);
    transition: transform 0.25s ease;

    /* ── Theme: inherit from Tailwind's HTML colour-scheme ── */
    background-color: rgb(255 255 255 / 0.97);
    border-right: 1px solid rgb(209 213 219);
    /* gray-300 */
    color: #111827;
    /* gray-900 */
    box-shadow: 4px 0 16px rgb(0 0 0 / 0.08);
}

/* Dark-mode variant — triggered by Tailwind's .dark class on <html> */
@media (prefers-color-scheme: dark) {
    .session-sidebar {
        background-color: rgb(31 41 55 / 0.98);
        /* gray-800 */
        border-right-color: rgb(55 65 81);
        /* gray-700 */
        color: #f3f4f6;
        /* gray-100 */
        box-shadow: 4px 0 20px rgb(0 0 0 / 0.4);
    }
}

.session-sidebar.open {
    transform: translateX(0);
}

/* ── Toggle tab (the ▶/◀ handle sticking out to the right) ─────────── */
.sidebar-toggle {
    position: absolute;
    top: 50%;
    right: -36px;
    transform: translateY(-50%);
    width: 36px;
    height: 72px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;

    cursor: pointer;
    border-radius: 0 8px 8px 0;

    /* Use same background as panel */
    background-color: inherit;
    border: 1px solid rgb(209 213 219);
    border-left: none;
    box-shadow: 3px 0 8px rgb(0 0 0 / 0.08);

    /* Prevent text overflow in the narrow tab */
    overflow: hidden;
    padding: 4px 2px;
}

@media (prefers-color-scheme: dark) {
    .sidebar-toggle {
        border-color: rgb(55 65 81);
    }
}

.sidebar-toggle-arrow {
    font-size: 12px;
    line-height: 1;
    color: #6366f1;
    /* indigo-500 */
}

.sidebar-toggle-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.05em;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    color: inherit;
    opacity: 0.7;
}

/* ── Panel content ───────────────────────────────────────────────────── */
.sidebar-content {
    padding: 16px 14px 16px 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* top space so content doesn't overlap Navbar if present */
    padding-top: 60px;
}

/* ── Header row (title + Delete All) ───────────────────────────────── */
.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgb(209 213 219);
}

@media (prefers-color-scheme: dark) {
    .sidebar-header {
        border-bottom-color: rgb(55 65 81);
    }
}

.sidebar-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: inherit;
}

/* ── "Delete All" button ────────────────────────────────────────────── */
.delete-all {
    background: transparent;
    color: #ef4444;
    /* red-500 */
    border: 1px solid #ef4444;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.delete-all:hover {
    background-color: #ef4444;
    color: #fff;
}

/* ── Session list ───────────────────────────────────────────────────── */
.sidebar-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-loading,
.sidebar-empty {
    font-size: 13px;
    color: #9ca3af;
    /* gray-400 */
    text-align: center;
    margin-top: 24px;
}

/* ── Individual session card ─────────────────────────────────────────── */
.sidebar-item {
    background-color: rgb(249 250 251);
    /* gray-50 */
    border: 1px solid rgb(229 231 235);
    /* gray-200 */
    padding: 10px 10px 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 6px;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
    position: relative;
}

@media (prefers-color-scheme: dark) {
    .sidebar-item {
        background-color: rgb(55 65 81 / 0.6);
        /* gray-700 */
        border-color: rgb(75 85 99);
    }
}

.sidebar-item:hover {
    background-color: rgb(238 242 255);
    /* indigo-50 */
    border-color: #a5b4fc;
    /* indigo-300 */
    box-shadow: 0 1px 4px rgb(99 102 241 / 0.12);
}

@media (prefers-color-scheme: dark) {
    .sidebar-item:hover {
        background-color: rgb(49 46 129 / 0.4);
        border-color: #6366f1;
    }
}

/* Active (current) session */
.sidebar-item.active {
    background-color: rgb(238 242 255);
    /* indigo-50 */
    border-color: #6366f1;
    /* indigo-500 */
    border-left: 3px solid #6366f1;
}

@media (prefers-color-scheme: dark) {
    .sidebar-item.active {
        background-color: rgb(49 46 129 / 0.5);
        border-color: #818cf8;
        /* indigo-400 */
        border-left-color: #818cf8;
    }
}

/* ── Card body ───────────────────────────────────────────────────────── */
.sidebar-item-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    min-width: 0;
    /* allow text truncation */
}

.sidebar-item-title {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: inherit;
    line-height: 1.3;
}

.sidebar-item-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.sidebar-item-date {
    font-size: 11px;
    color: #9ca3af;
    /* gray-400 */
    white-space: nowrap;
}

.sidebar-item-provider {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #6366f1;
    /* indigo-500 */
    background: rgb(238 242 255);
    border: 1px solid #a5b4fc;
    padding: 1px 5px;
    border-radius: 3px;
}

@media (prefers-color-scheme: dark) {
    .sidebar-item-provider {
        background: rgb(49 46 129 / 0.5);
        border-color: #6366f1;
        color: #a5b4fc;
    }
}

/* ── Delete (×) button on each card ─────────────────────────────────── */
.sidebar-item-delete {
    flex-shrink: 0;
    background: none;
    border: none;
    font-size: 17px;
    line-height: 1;
    color: #d1d5db;
    /* gray-300 */
    cursor: pointer;
    padding: 0 2px;
    transition: color 0.15s;
    margin-top: 1px;
}

.sidebar-item-delete:hover {
    color: #ef4444;
    /* red-500 */
}

/* ── Scrollbar ──────────────────────────────────────────────────────── */
.sidebar-list::-webkit-scrollbar {
    width: 4px;
}

.sidebar-list::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-list::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 2px;
}

.sidebar-list::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

@media (prefers-color-scheme: dark) {
    .sidebar-list::-webkit-scrollbar-thumb {
        background: #4b5563;
    }

    .sidebar-list::-webkit-scrollbar-thumb:hover {
        background: #6b7280;
    }
}