/* Chat Styles */
.chat-icon {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #6f2da8, #4361ee);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(111, 45, 168, 0.3);
    z-index: 1000;
    transition: all 0.3s;
    animation: pulse 2s infinite;
}

.chat-icon:hover {
    transform: scale(1.1);
}

@keyframes pulse {
    0% { box-shadow: 0 4px 12px rgba(111, 45, 168, 0.3); }
    50% { box-shadow: 0 4px 20px rgba(111, 45, 168, 0.5); }
    100% { box-shadow: 0 4px 12px rgba(111, 45, 168, 0.3); }
}

.chat-box {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 450px;
    height: 600px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    display: none;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
    border: 2px solid #f0f0f0;
}

.chat-header {
    background: linear-gradient(135deg, #6f2da8, #4361ee);
    color: white;
    padding: 15px;
    text-align: center;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header .close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
}

.memory-panel-btn {
    margin-left: auto;
    margin-right: 10px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: white;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
}

.memory-panel-btn:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.24);
}

.learned-memory-panel {
    background: linear-gradient(180deg, #ffffff, #f6f7fb);
    border-bottom: 1px solid #e9ecef;
    max-height: 180px;
    overflow-y: auto;
    padding: 12px;
}

.learned-memory-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 10px;
}

.learned-memory-header strong {
    color: #2f343a;
    font-size: 13px;
}

.learned-memory-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 14px;
    padding: 10px 12px;
    margin-bottom: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.learned-memory-question {
    font-size: 12px;
    font-weight: 700;
    color: #6f2da8;
    margin-bottom: 6px;
}

.learned-memory-answer {
    font-size: 13px;
    color: #2f343a;
    line-height: 1.4;
}

.learned-memory-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
    font-size: 11px;
    color: #6c757d;
}

.learned-memory-meta span {
    background: #f3f4f6;
    border-radius: 999px;
    padding: 3px 8px;
}

.learned-memory-empty,
.learned-memory-loading {
    font-size: 12px;
    color: #6c757d;
    padding: 6px 2px;
}

.chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message {
    margin-bottom: 0;
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 85%;
    word-wrap: break-word;
    animation: fadeIn 0.3s ease-in;
    font-size: 14px;
    line-height: 1.4;
    white-space: pre-line;
}

.message.bot {
    background: #e9ecef;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 5px;
    margin-right: auto;
}

.message.user {
    background: linear-gradient(135deg, #6f2da8, #4361ee);
    color: white;
    align-self: flex-end;
    margin-left: auto;
    border-bottom-right-radius: 5px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-input-area {
    padding: 15px;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 10px;
    background: white;
}

.chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 15px;
    outline: none;
    font-size: 14px;
}

.chat-send {
    background: linear-gradient(135deg, #6f2da8, #4361ee);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.chat-send:hover {
    transform: scale(1.1);
}

.typing-indicator {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background: #e9ecef;
    border-radius: 15px;
    align-self: flex-start;
    margin-bottom: 10px;
    border-bottom-left-radius: 5px;
}

.typing-dots {
    display: flex;
    gap: 4px;
    margin-right: 10px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6f2da8;
    animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

.typing-text {
    font-size: 12px;
    color: #6c757d;
    font-style: italic;
}

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-8px); opacity: 1; }
}

@media (max-width: 400px) {
    .chat-box {
        width: 90%;
        right: 5%;
    }
}

/* Quick Suggestions */
.quick-suggestions {
    margin: 10px 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.suggestions-title {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 8px;
    font-weight: 600;
}

.suggestion-btn {
    display: inline-block;
    background: linear-gradient(135deg, #6f2da8, #4361ee);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 6px 12px;
    margin: 2px 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.suggestion-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(111, 45, 168, 0.3);
}

/* Feedback System */
.feedback-container {
    margin: 10px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    text-align: center;
    border: 1px solid #e9ecef;
}

.feedback-stars {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-bottom: 8px;
}

.star-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    transition: transform 0.2s;
    opacity: 0.6;
}

.star-btn:hover {
    transform: scale(1.2);
    opacity: 1;
}

.feedback-text {
    font-size: 12px;
    color: #6c757d;
    font-weight: 500;
}

.learning-insights {
    margin-top: 8px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 3px solid #6f2da8;
}

.learning-insights small {
    color: #6f2da8;
    font-weight: 500;
}
