/* ============================================================
   Session — Session list, dots, tooltips, session header/view
   ============================================================ */

/* ── Session List ──────────────────────────────────────────── */

.session-list {
    list-style: none;
}

.session-list li {
    padding: 8px 16px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: flex-start;
    gap: 8px;
    transition: background 0.15s ease, box-shadow 0.15s ease;
}

#history-sessions-list li {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.session-row-top {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
}

.session-row-mid {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.session-row-bottom {
    margin-top: 1px;
}

.session-list li:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.session-list li:hover:not(.empty-state):not(.session-group-header) {
    box-shadow: inset 0 0 0 1px rgba(88, 166, 255, 0.06);
}

.session-list li.active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-left: 2px solid var(--accent);
}

.session-list li.empty-state {
    cursor: default;
    color: var(--text-muted);
    font-style: italic;
}

.session-list li.empty-state:hover {
    background: transparent;
    color: var(--text-muted);
}

/* Duration badge in sidebar items */
.session-dur {
    font-size: 10px;
    color: var(--text-muted);
    margin-left: 4px;
}

/* ── Session Dots ──────────────────────────────────────────── */

.session-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 5px;
}

.session-dot.active  { background: var(--success); }
.session-dot.stale   { background: var(--text-muted); }
.session-dot.working {
    background: #3b82f6;
    animation: pulse-working 1.5s ease-in-out infinite;
}
.session-dot.waiting {
    background: var(--warning);
    animation: pulse-waiting 1.5s ease-in-out infinite;
}
.session-dot.done {
    background: var(--success, #4caf50);
}

/* ── Session Hover Tooltip ─────────────────────────────────── */

.session-tooltip {
    display: none;
    position: fixed;
    z-index: 1000;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 10px 14px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    min-width: 220px;
    max-width: 400px;
}

.session-tooltip-table {
    border-collapse: collapse;
    font-size: 12px;
    line-height: 1.5;
}

.session-tooltip-table td {
    padding: 1px 0;
}

.tt-label {
    color: var(--text-muted);
    padding-right: 12px;
    font-weight: 500;
}

.tt-value {
    color: var(--text-primary);
    max-width: 300px;
    word-break: break-word;
}

.tt-state-working           { color: #3b82f6; font-weight: 600; }
.tt-state-waiting-for-input  { color: var(--warning); font-weight: 600; }
.tt-state-active             { color: var(--success); font-weight: 600; }
.tt-state-idle               { color: var(--text-muted); }

.session-time {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}

.session-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.session-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.session-name-row {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.session-name-spacer {
    flex: 1;
}

.session-goal {
    font-size: 11px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 2px;
}

/* ── Sidebar Edit / Rename ─────────────────────────────────── */

.sidebar-edit-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    padding: 2px 4px;
    flex-shrink: 0;
    border-radius: 3px;
    line-height: 1;
}

.sidebar-edit-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.session-list li:hover .sidebar-edit-btn {
    display: inline-block;
}

/* ── Grouped Sessions ──────────────────────────────────────── */

.session-group-header {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 6px 12px 2px !important;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    cursor: default;
    display: flex;
    align-items: center;
    gap: 6px;
}

.session-group-header:hover {
    background: transparent !important;
}

.session-group-count {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 0 5px;
    line-height: 16px;
}

.session-group-item {
    padding-left: 22px !important;
}

/* ── Session View ──────────────────────────────────────────── */

.session-view {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.session-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.session-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.session-title-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 4px;
}

.session-title-actions .btn-icon-label {
    margin: 0;
}

.session-title-actions .actions-divider {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 4px;
    flex-shrink: 0;
}

.session-title h2 {
    font-size: 16px;
    font-weight: 600;
}

.session-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.session-meta-compact {
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.meta-separator {
    color: var(--text-muted);
    font-size: 14px;
}

.status-line, .summary-line {
    font-size: 13px;
    color: var(--text-secondary);
}

.summary-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    white-space: nowrap;
}

.goal-label {
    font-size: 15px;
    font-weight: 600;
    color: #bc8cff;
    flex-shrink: 0;
}

.summary-inline .summary-text {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.goal-action-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.goal-action-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.goal-edit-input {
    flex: 1;
    min-width: 0;
    background: var(--bg-primary);
    border: 1px solid var(--accent);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    padding: 2px 8px;
    outline: none;
}

.branch-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    background: rgba(88, 166, 255, 0.1);
    border: 1px solid rgba(88, 166, 255, 0.2);
    border-radius: 12px;
    font-size: 12px;
    color: var(--accent);
    font-family: var(--font-mono);
}

.branch-chip svg {
    flex-shrink: 0;
    color: var(--accent);
}

.copy-branch-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 4px;
    margin-left: 2px;
    vertical-align: middle;
    opacity: 0.5;
    transition: opacity 0.15s;
}

.copy-branch-btn:hover {
    opacity: 1;
    color: var(--accent);
}

.sidebar-branch {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    margin-top: 1px;
}

.sidebar-branch svg {
    flex-shrink: 0;
    opacity: 0.7;
}

/* ── Status Dots ───────────────────────────────────────────── */

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    background: var(--success);
}

.status-dot.working {
    background: #3b82f6;
    animation: pulse-working 1.5s ease-in-out infinite;
}

.status-dot.waiting {
    background: var(--warning);
    animation: pulse-waiting 1.5s ease-in-out infinite;
}

.status-dot.done {
    background: var(--success, #4caf50);
}

.status-dot-stale {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--fg-muted);
    flex-shrink: 0;
}

.status-dot-working {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse-working 1.5s ease-in-out infinite;
    flex-shrink: 0;
}

/* ── Waiting / Done Banners ────────────────────────────────── */

.waiting-banner {
    display: none;
    background: rgba(255, 193, 7, 0.15);
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: 6px;
    padding: 6px 12px;
    margin: 0 12px 8px;
    font-size: 13px;
    color: var(--warning);
    text-align: center;
}

.waiting-banner.done-banner {
    background: rgba(76, 175, 80, 0.15);
    border-color: rgba(76, 175, 80, 0.3);
    color: var(--success, #4caf50);
}

/* ── Session ID Label ──────────────────────────────────────── */

.session-id-label {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* ── Jobs Sidebar ──────────────────────────────────────────── */

.live-job-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
    font-size: 12px;
}

.live-job-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--fg);
}

.live-job-badge {
    font-size: 9px;
    font-weight: 600;
    padding: 1px 4px;
    border-radius: 3px;
    text-transform: uppercase;
    flex-shrink: 0;
}

.live-job-badge-api {
    background: rgba(136, 87, 229, 0.2);
    color: #b392f0;
}

.live-job-badge-cron {
    background: rgba(88, 166, 255, 0.2);
    color: #58a6ff;
}

.live-job-elapsed {
    font-size: 10px;
    color: var(--fg-muted);
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}
