/* ========================================== */
/* HISTORY SIDEBAR - Claude-Style             */
/* Shared between Command Center & Prompts    */
/* ========================================== */

.history-sidebar {
    width: 260px;
    min-width: 260px;
    background: #FAFAFB;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    transition: width 0.2s ease, min-width 0.2s ease, opacity 0.2s ease;
}

.history-sidebar.collapsed {
    width: 0;
    min-width: 0;
    opacity: 0;
    border-right: none;
    overflow: hidden;
}

/* ---- Header ---- */

.history-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0.875rem;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.history-sidebar-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: #1e3a8a;
    letter-spacing: -0.01em;
}

.history-collapse-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    color: #94a3b8;
    font-size: 0.75rem;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.history-collapse-btn:hover {
    background: #e2e8f0;
    color: #475569;
}

/* ---- Filters ---- */

.history-sidebar-filters {
    display: flex;
    gap: 0.25rem;
    padding: 0.5rem 0.875rem;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}

.history-filter-btn {
    padding: 0.25rem 0.5rem;
    border: 1px solid transparent;
    background: transparent;
    border-radius: 4px;
    font-size: 0.688rem;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s;
}

.history-filter-btn:hover {
    background: #e2e8f0;
    color: #334155;
}

.history-filter-btn.active {
    background: #1e3a8a;
    color: white;
    border-color: #1e3a8a;
}

/* ---- Content / Scroll Area ---- */

.history-sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 0.375rem 0;
}

.history-sidebar-content::-webkit-scrollbar {
    width: 4px;
}

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

.history-sidebar-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

/* ---- Date Groups ---- */

.history-date-group {
    margin-bottom: 0.25rem;
}

.history-date-label {
    font-size: 0.625rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.5rem 0.875rem 0.25rem;
}

/* ---- History Items ---- */

.history-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.875rem;
    cursor: pointer;
    transition: background 0.1s;
    position: relative;
    border-radius: 0;
}

.history-item:hover {
    background: #e8ecf1;
}

.history-item:hover .history-item-delete {
    opacity: 1;
}

.history-item-icon {
    width: 22px;
    height: 22px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 700;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}

.history-task .history-item-icon {
    background: #dbeafe;
    color: #1e40af;
}

.history-chat .history-item-icon {
    background: #f3e8ff;
    color: #7c3aed;
}

.history-item-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.history-item-title {
    font-size: 0.75rem;
    font-weight: 500;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.history-item-meta {
    font-size: 0.625rem;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-meta-dot {
    margin: 0 0.2rem;
}

.history-item-delete {
    opacity: 0;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.2rem;
    border-radius: 3px;
    color: #94a3b8;
    font-size: 0.7rem;
    transition: all 0.15s;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.history-item-delete:hover {
    background: #fee2e2;
    color: #ef4444;
}

/* ---- Empty State ---- */

.history-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: #94a3b8;
    font-size: 0.75rem;
}

.history-empty-icon {
    font-size: 1.5rem;
    opacity: 0.3;
    margin-bottom: 0.5rem;
}

/* ---- Toggle Button (for collapsed state) ---- */

.history-toggle-btn {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    background: #FAFAFB;
    border: 1px solid #e5e7eb;
    border-left: none;
    border-radius: 0 6px 6px 0;
    padding: 0.5rem 0.25rem;
    cursor: pointer;
    z-index: 10;
    color: #64748b;
    font-size: 0.7rem;
    transition: all 0.15s;
}

.history-toggle-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
}

/* ---- Command Center Layout Wrapper ---- */

.command-center-layout {
    display: flex;
    height: calc(100vh - 56px);
    overflow: hidden;
}

.command-center-layout .command-center {
    flex: 1;
    overflow-y: auto;
    min-width: 0;
}

/* ---- Prompts History Section (inside copilot-sidebar) ---- */

.prompts-history-section {
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 0.25rem;
    margin-bottom: 0.25rem;
}

.prompts-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: background 0.1s;
}

.prompts-history-header:hover {
    background: #e8ecf1;
}

.prompts-history-label {
    font-size: 0.688rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.prompts-history-badge {
    font-size: 0.6rem;
    padding: 0.1rem 0.35rem;
    background: #e2e8f0;
    color: #475569;
    border-radius: 3px;
    font-weight: 600;
}

.prompts-history-items {
    padding: 0 0.25rem 0.25rem;
}

.prompts-history-items .history-item {
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    margin-bottom: 1px;
}

.prompts-history-more {
    display: block;
    width: 100%;
    text-align: center;
    padding: 0.3rem;
    background: none;
    border: none;
    color: #3b82f6;
    font-size: 0.688rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.15s;
}

.prompts-history-more:hover {
    color: #2563eb;
}

/* ---- Responsive ---- */

@media (max-width: 1024px) {
    .history-sidebar {
        width: 220px;
        min-width: 220px;
    }

    .command-center-layout {
        height: auto;
    }
}

@media (max-width: 768px) {
    .history-sidebar {
        display: none;
    }

    .command-center-layout {
        flex-direction: column;
        height: auto;
    }
}
