/* ==========================================
   History Panel - Sidebar
   ========================================== */

.history-panel {
    position: fixed;
    top: 0;
    right: -350px;
    width: 320px;
    height: 100vh;
    background: var(--bg-card);
    border-left: 2px solid var(--border);
    padding: var(--space-lg);
    overflow-y: auto;
    transition: right 0.3s ease;
    z-index: 100;
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.1);
}

.history-panel.open {
    right: 0;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 2px solid var(--border);
}

.history-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.btn-clear-history {
    padding: 0.5rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.15s;
}

.btn-clear-history:hover {
    background: var(--error);
    color: white;
    border-color: var(--error);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.history-empty {
    text-align: center;
    color: var(--text-tertiary);
    font-size: 0.875rem;
    padding: var(--space-xl) 0;
}

.history-item {
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-md);
    cursor: pointer;
    transition: all 0.15s;
}

.history-item:hover {
    border-color: var(--primary);
    background: var(--bg-hover);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-xs);
}

.history-item-name {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.875rem;
    flex: 1;
}

.history-item-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
}

.history-item-badge.telegram {
    background: #0088cc;
}

.history-item-badge.email {
    background: #ea580c;
}

.history-item-badge.both {
    background: #16a34a;
}

.history-item-date {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-bottom: var(--space-xs);
}

.history-item-actions {
    display: flex;
    gap: var(--space-xs);
    margin-top: var(--space-sm);
}

.btn-history-action {
    flex: 1;
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s;
}

.btn-history-action:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-history-action.delete {
    background: transparent;
    color: var(--error);
    border-color: var(--border);
}

.btn-history-action.delete:hover {
    background: var(--error);
    color: white;
    border-color: var(--error);
}

/* History Toggle Button */
.btn-toggle-history {
    position: fixed;
    top: 100px;
    right: 20px;
    z-index: 99;
    padding: 0.75rem 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all 0.2s;
}

.btn-toggle-history:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 20px rgba(37, 99, 235, 0.3);
}

.btn-toggle-history.panel-open {
    right: 340px;
}