/* ============================================
   HIM - Chat Styles
   ============================================ */

.chat-container {
    max-width: 800px; margin: 0 auto;
    display: flex; flex-direction: column;
    height: calc(100vh - var(--header-height) - 24px);
    background: var(--bg-card); border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-light); overflow: hidden;
}
.chat-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 24px; border-bottom: 1px solid var(--border-light);
    background: var(--bg-card);
}
.chat-header-info { display: flex; align-items: center; gap: 12px; }
.chat-avatar {
    width: 44px; height: 44px; border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary-light), var(--color-secondary-light));
    display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.chat-header-info h3 { font-size: 18px; margin-bottom: 2px; }
.chat-status { font-size: 13px; font-weight: 500; }

/* Mood Bar */
.chat-mood-bar {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 24px; background: var(--bg-body);
    border-bottom: 1px solid var(--border-light); overflow-x: auto;
}
.mood-label { font-size: 13px; color: var(--text-muted); font-weight: 500; white-space: nowrap; }
.mood-options { display: flex; gap: 6px; }
.mood-chip {
    padding: 6px 14px; border-radius: 50px; font-size: 13px;
    border: 1px solid var(--border-light); background: var(--bg-card);
    cursor: pointer; transition: var(--transition-fast); white-space: nowrap;
}
.mood-chip:hover { border-color: var(--color-primary); }
.mood-chip.active { background: var(--color-primary); color: white; border-color: var(--color-primary); }

/* Messages */
.chat-messages {
    flex: 1; overflow-y: auto; padding: 24px;
    display: flex; flex-direction: column; gap: 16px;
    background: var(--bg-body);
}
.chat-bubble { max-width: 75%; position: relative; animation: slideIn 0.3s ease; }
.chat-bubble-user {
    margin-left: auto;
}
.chat-bubble-user .bubble-content {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: white; padding: 14px 20px;
    border-radius: 20px 20px 4px 20px;
    font-size: 15px; line-height: 1.5;
}
.chat-bubble-ai .bubble-content {
    background: var(--bg-card); color: var(--text-primary);
    padding: 14px 20px; border-radius: 20px 20px 20px 4px;
    font-size: 15px; line-height: 1.5;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
}
.bubble-time { font-size: 11px; color: var(--text-muted); margin-top: 4px; display: block; }
.chat-bubble-user .bubble-time { text-align: right; }
.tts-btn {
    position: absolute; bottom: 4px; right: -32px;
    width: 28px; height: 28px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); font-size: 12px;
    transition: var(--transition-fast);
}
.tts-btn:hover { background: var(--color-primary-light); color: var(--color-primary); }

/* Typing indicator */
.typing-indicator { display: flex; gap: 4px; padding: 14px 20px; }
.typing-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--text-muted); animation: typingBounce 1.4s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-8px); }
}
@keyframes slideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Input Area */
.chat-input-area {
    padding: 16px 24px; border-top: 1px solid var(--border-light);
    background: var(--bg-card);
}
.chat-input-wrapper {
    display: flex; align-items: flex-end; gap: 12px;
    background: var(--bg-body); border-radius: var(--border-radius-lg);
    padding: 8px 12px 8px 20px; border: 2px solid var(--border-light);
    transition: border-color var(--transition-normal);
}
.chat-input-wrapper:focus-within { border-color: var(--color-primary); }
.chat-input {
    flex: 1; border: none; background: transparent;
    font-size: 15px; color: var(--text-primary);
    resize: none; outline: none; max-height: 120px;
    padding: 8px 0; line-height: 1.5;
}
.chat-send-btn {
    width: 44px; height: 44px; border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: white; display: flex; align-items: center; justify-content: center;
    font-size: 16px; flex-shrink: 0;
    transition: var(--transition-normal);
}
.chat-send-btn:hover { transform: scale(1.05); }
.chat-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

@media (max-width: 767px) {
    .chat-container { border-radius: 0; height: calc(100vh - var(--header-height) - 72px); }
    .chat-bubble { max-width: 85%; }
    .chat-mood-bar { padding: 10px 16px; }
    .chat-messages { padding: 16px; }
    .chat-input-area { padding: 12px 16px; }
}

/* History Modal */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(4px);
}
.history-modal-content {
    background: var(--bg-card); border-radius: var(--border-radius-lg);
    width: 90%; max-width: 500px; max-height: 80vh;
    display: flex; flex-direction: column;
    box-shadow: var(--shadow-lg); overflow: hidden;
}
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px; border-bottom: 1px solid var(--border-light);
    background: var(--bg-body);
}
.modal-header h3 { font-size: 18px; color: var(--text-primary); margin: 0; }
.close-modal {
    background: none; border: none; font-size: 24px; color: var(--text-muted);
    cursor: pointer; line-height: 1; transition: color 0.2s;
}
.close-modal:hover { color: var(--color-error); }
.modal-body {
    padding: 20px; overflow-y: auto; flex: 1;
}
.session-list { display: flex; flex-direction: column; gap: 12px; }
.session-item {
    display: flex; flex-direction: column; gap: 8px;
    padding: 14px; border: 1px solid var(--border-light);
    border-radius: var(--border-radius-md); text-decoration: none;
    transition: var(--transition-normal); background: var(--bg-card);
}
.session-item:hover {
    border-color: var(--color-primary-light);
    box-shadow: var(--shadow-sm); transform: translateY(-2px);
}
.session-item.active-session {
    border-color: var(--color-primary); background: var(--bg-body);
}
.session-item-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.session-title { font-weight: 500; color: var(--text-primary); line-height: 1.4; }
.session-date { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.session-item-footer { display: flex; justify-content: space-between; align-items: center; font-size: 12px; }
.session-phase { color: var(--color-secondary); }
.session-status { padding: 2px 8px; border-radius: 12px; font-weight: 500; }
.session-status.ended { background: var(--border-light); color: var(--text-muted); }
.session-status.active { background: var(--color-primary-light); color: var(--color-primary); }
.loading-spinner { text-align: center; color: var(--text-muted); padding: 20px; }
.empty-state { text-align: center; color: var(--text-muted); padding: 40px 20px; }
