/* memory.css - پنل حافظه کاربر (بازطراحی شده) */

.memory-panel {
    display: none;
    position: fixed;
    top: 50%;
    right: 280px;
    transform: translateY(-50%);
    width: 380px;
    max-height: 70vh;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    z-index: 500;
    overflow: hidden;
    animation: memorySlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes memorySlideIn {
    from {
        opacity: 0;
        transform: translateY(-50%) translateX(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(-50%) translateX(0) scale(1);
    }
}

/* ============================================ */
/* هدر پنل حافظه */
/* ============================================ */
.memory-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.05), rgba(16, 163, 127, 0.03));
}

.memory-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.memory-brain-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: brainGlow 3s ease-in-out infinite;
}

@keyframes brainGlow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.4); }
    50% { box-shadow: 0 0 0 12px rgba(139, 92, 246, 0); }
}

.memory-brain-icon i {
    font-size: 20px;
    color: white;
    animation: brainPulse 2s ease-in-out infinite;
}

@keyframes brainPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

.memory-panel-header h3 {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.memory-panel-header p {
    font-size: 11px;
    color: var(--text-tertiary);
}

.memory-panel-close {
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.memory-panel-close:hover {
    background: rgba(229, 62, 62, 0.1);
    color: #e53e3e;
    border-color: rgba(229, 62, 62, 0.3);
}

/* ============================================ */
/* بدنه پنل حافظه */
/* ============================================ */
.memory-panel-body {
    padding: 16px 20px;
    overflow-y: auto;
    max-height: calc(70vh - 100px);
}

.memory-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.memory-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.memory-item::before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: linear-gradient(to bottom, #8b5cf6, var(--accent-color));
    opacity: 0;
    transition: opacity 0.25s ease;
}

.memory-item:hover {
    border-color: rgba(139, 92, 246, 0.3);
    background: var(--bg-primary);
    transform: translateX(-4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
}

.memory-item:hover::before {
    opacity: 1;
}

.memory-key {
    font-size: 11px;
    font-weight: 600;
    color: #8b5cf6;
    background: rgba(139, 92, 246, 0.1);
    padding: 5px 12px;
    border-radius: 20px;
    white-space: nowrap;
    min-width: fit-content;
    letter-spacing: 0.3px;
}

.memory-value {
    flex: 1;
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.memory-delete {
    opacity: 0;
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-size: 12px;
}

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

.memory-delete:hover {
    background: rgba(229, 62, 62, 0.1);
    color: #e53e3e;
}

/* ============================================ */
/* حالت خالی */
/* ============================================ */
.memory-empty {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-tertiary);
}

.memory-empty-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(16, 163, 127, 0.1));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.memory-empty-icon i {
    font-size: 28px;
    color: #8b5cf6;
    opacity: 0.6;
}

.memory-empty p {
    font-size: 13px;
    font-weight: 500;
}

/* ============================================ */
/* فوتر - دکمه پاک کردن */
/* ============================================ */
.memory-footer {
    padding: 12px 0 0;
    border-top: 1px solid var(--border-color);
    margin-top: 12px;
}

.memory-clear-btn {
    width: 100%;
    padding: 12px;
    background: none;
    border: 1px solid rgba(229, 62, 62, 0.3);
    color: #e53e3e;
    border-radius: 12px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.memory-clear-btn:hover {
    background: rgba(229, 62, 62, 0.08);
    border-color: #e53e3e;
    box-shadow: 0 4px 12px rgba(229, 62, 62, 0.15);
}

.memory-clear-btn i {
    font-size: 13px;
}

/* ============================================ */
/* Responsive */
/* ============================================ */
@media (max-width: 768px) {
    .memory-panel {
        right: 10px;
        left: 10px;
        width: auto;
        top: 10px;
        bottom: 10px;
        transform: none;
        max-height: none;
        border-radius: 24px;
    }
    
    .memory-panel-body {
        max-height: calc(100vh - 160px);
    }
}