/* ===== CHAT HISTORY SIDEBAR =====
 * GetAdvice v5.8 — Slide-out panel for past conversations.
 * File: css/history.css
 */

/* ── Overlay backdrop ── */
.history-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    opacity: 0;
    transition: opacity var(--transition-normal);
    pointer-events: none;
}

.history-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

/* ── Sidebar panel ── */
.history-panel {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(320px, 85vw);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    z-index: 100;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform var(--transition-normal);
    padding-top: var(--safe-top);
}

.history-panel.open {
    transform: translateX(0);
}

/* ── Panel header ── */
.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.history-header h3 {
    font-size: var(--font-size-input);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.history-close-btn {
    background: var(--bg-glass);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.history-close-btn:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
}

/* ── Chat list ── */
.history-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-sm);
    -webkit-overflow-scrolling: touch;
}

.history-empty {
    text-align: center;
    color: var(--text-muted);
    padding: var(--space-2xl) var(--space-lg);
    font-size: var(--font-size-sm);
    line-height: 1.5;
}

.history-item {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast);
    border: 1px solid transparent;
}

.history-item:hover {
    background: var(--bg-glass-hover);
    border-color: var(--border);
}

.history-item.active {
    background: rgba(124, 92, 252, 0.1);
    border-color: var(--border-glow);
}

.history-item-preview {
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.history-item-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.history-item-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: var(--font-size-xs);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    opacity: 0;
    transition: all var(--transition-fast);
    font-family: inherit;
}

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

.history-item-delete:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* ── Clear all button ── */
.history-footer {
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.history-clear-btn {
    width: 100%;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.history-clear-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

/* ── History toggle button (in header) ── */
.history-toggle-btn {
    background: var(--bg-glass);
    border: 1px solid var(--border);
    color: var(--text-primary);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.history-toggle-btn:hover {
    background: var(--bg-glass-hover);
    border-color: var(--border-glow);
}

.history-toggle-btn svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ===== Header feedback button =====
 * Added 2026-04-14: the footer-note "Send feedback" link is hidden whenever
 * body.keyboard-open is set (input focused, which on mobile is basically always
 * while chatting). That made the only feedback entry invisible to real users.
 * This header button is always visible regardless of keyboard state.
 */
.header-feedback-btn {
    background: var(--bg-glass);
    border: 1px solid var(--border);
    color: var(--text-primary);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}
.header-feedback-btn:hover {
    background: var(--bg-glass-hover);
    border-color: var(--border-glow);
}
.header-feedback-btn svg {
    width: 16px;
    height: 16px;
}
