/* ==========================================================================
   Tasks Sidebar Overlay — "window shade" drawer with pull-tab
   ========================================================================== */

/* --- Drawer wrapper (positions the whole unit) --- */
.tasks-drawer {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 20;
    display: flex;
    pointer-events: none;
    transition: width 0.25s ease-in-out;
    width: 0;
    animation: tabSlideIn 0.35s ease-out;
}

.tasks-drawer.open {
    width: 280px;
    max-width: 50%;
}

/* --- Entrance: slide in from right + bright glow --- */
@keyframes tabSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.tasks-drawer.entering .tasks-tab-hint {
    animation: tabPulseBright 0.6s ease-out;
}

@keyframes tabPulseBright {
    0% {
        box-shadow: 0 0 0 0 rgba(187, 154, 247, 0.8);
        background: rgba(187, 154, 247, 0.4);
    }

    100% {
        box-shadow: 0 0 12px 4px rgba(187, 154, 247, 0);
        background: rgba(187, 154, 247, 0.15);
    }
}

/* --- Progress: dim pulse --- */
.tasks-drawer.progress .tasks-tab-hint {
    animation: tabPulseDim 0.4s ease-out;
}

@keyframes tabPulseDim {
    0% {
        background: rgba(187, 154, 247, 0.25);
    }

    100% {
        background: rgba(187, 154, 247, 0.15);
    }
}

/* --- Departure: slide out to right quietly --- */
.tasks-drawer.departing {
    animation: tabSlideOut 0.5s ease-in forwards;
}

@keyframes tabSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* --- Pull-tab (always visible) --- */
.tasks-tab-hint {
    pointer-events: auto;
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(187, 154, 247, 0.15);
    border: 1px solid rgba(187, 154, 247, 0.4);
    border-right: none;
    border-radius: 8px 0 0 8px;
    padding: 10px 6px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: background 0.15s;
}

.tasks-tab-hint:hover {
    background: rgba(187, 154, 247, 0.25);
    border-color: #bb9af7;
}

.tasks-tab-count {
    font-size: 0.85rem;
    font-weight: 700;
    color: #bb9af7;
    line-height: 1;
}

.tasks-tab-label {
    font-size: 0.55rem;
    color: #bb9af7;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    writing-mode: vertical-lr;
    text-orientation: mixed;
}

/* --- Panel (visible when open) --- */
.tasks-sidebar-panel {
    pointer-events: auto;
    width: 280px;
    min-width: 280px;
    display: flex;
    flex-direction: column;
    background: var(--bg-darker);
    border-left: 1px solid rgba(187, 154, 247, 0.4);
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.tasks-sidebar-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

/* --- Task pills --- */
.task-pill {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0.5rem 0.6rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: opacity 0.3s, border-color 0.2s;
}

.task-pill.running {
    border-color: rgba(187, 154, 247, 0.5);
}

.task-pill.completed {
    border-color: rgba(158, 206, 106, 0.4);
}

.task-pill.failed {
    border-color: rgba(247, 118, 142, 0.4);
    background: rgba(247, 118, 142, 0.05);
}

.task-pill.fading {
    opacity: 0.5;
}

.task-pill-header {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Status dot */
.task-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.task-status-dot.running {
    background: #bb9af7;
    animation: taskPulse 1.5s ease-in-out infinite;
}

.task-status-dot.completed {
    background: var(--success);
}

.task-status-dot.failed {
    background: var(--error);
}

@keyframes taskPulse {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(187, 154, 247, 0.4);
    }

    50% {
        opacity: 0.6;
        box-shadow: 0 0 0 3px rgba(187, 154, 247, 0);
    }
}

/* Type pill badge */
.task-type-pill {
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #bb9af7;
    background: rgba(187, 154, 247, 0.15);
    padding: 1px 6px;
    border-radius: 3px;
}

/* Tool badge (last tool used) */
.task-tool-badge {
    font-size: 0.55rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.08);
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: auto;
    font-family: monospace;
}

/* Description */
.task-pill-description {
    font-size: 0.75rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
}

/* Current activity (from task_progress) */
.task-pill-activity {
    font-size: 0.65rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-style: italic;
    line-height: 1.3;
}

/* Stats row */
.task-pill-stats {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.task-pill-stat {
    font-size: 0.65rem;
    color: var(--text-secondary);
    font-family: monospace;
}
