/* ========================================
   KALRAV CHAT HISTORY VIEW STYLES
   ======================================== */

/* History Toggle Button in Header */
#history-toggle-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    transition: all 0.2s ease;
    display: none; /* Hidden by default, shown via JS when user is logged in */
}

#history-toggle-btn:hover {
    transform: scale(1.1);
    opacity: 0.8;
}

#history-toggle-btn.active svg {
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Chat header icon styles */
.chat-header-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #fff;
    font-size: 20px;
    transition: all 0.2s ease;
}

.chat-header-icon:hover {
    transform: scale(1.1);
    opacity: 0.8;
}

.chat-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}


/* ── History header ── */
.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(0,0,0,0.08);
    flex-shrink: 0;
    background: var(--primary-color);
    min-height: 52px;
    box-sizing: border-box;
}

.history-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #222;
}

.history-close-btn {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
    line-height: 1;
    padding: 0 4px;
}

.history-close-btn:hover {
    color: #222;
}

#chat-history-container {
    width: 100%;
    min-height: 200px;
}

.history-list {
    width: 100%;
    padding: 0;
    margin: 0;
}

.history-item {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 10px 16px;
    margin: 0;
    cursor: pointer;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    display: block;
    width: 100%;
    box-sizing: border-box;
    transition: background 0.15s ease;
}

.history-item:hover,
.history-item.active {
    background: rgba(103, 61, 230, 0.06);
}


.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.history-item-date {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

.history-item-count {
    font-size: 11px;
    background: var(--primary-color);
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
}

.history-item-message {
    font-size: 14px;
    color: #333;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
   
    -webkit-box-orient: vertical;
}

/* Empty State */
.history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
    padding: 40px 20px;
    text-align: center;
}

.history-empty svg {
    width: 64px;
    height: 64px;
    margin-bottom: 20px;
    opacity: 0.3;
}

.history-empty p {
    font-size: 14px;
    margin: 0;
}

/* Loading State */
.history-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #666;
}

.history-loading svg {
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ========================================
   MESSAGE DISPLAY STYLES
   ======================================== */

.user-message, .bot-message {
    margin-bottom: 15px;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-content {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.bot-avatar {
    flex-shrink: 0;
}

.message-text {
    flex: 1;
    line-height: 1.5;
}

.message-text a {
    color: var(--primary-color);
    text-decoration: underline;
}

.message-text strong {
    font-weight: 600;
}

.message-text em {
    font-style: italic;
}

/* Loading state for session messages */
.session-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #666;
}

.session-loading svg {
    animation: spin 1s linear infinite;
    margin-right: 10px;
}