:root {
    --primary-color: #5e35b1;
    --primary-light: #7e57c2;
    --primary-dark: #4527a0;
    --background: #f5f7fb;
    --card-bg: #ffffff;
    --text-color: #333333;
    --border-color: #e0e0e0;
    --placeholder-color: #9e9e9e;
    --message-user-bg: #e3f2fd;
    --message-bot-bg: #f3e5f5;
    --error-color: #f44336;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--background);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.chat-container {
    width: 90%;
    max-width: 1000px;
    height: 90vh;
    max-height: 800px;
    background-color: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.header {
    padding: 20px;
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.header h1 {
    margin-bottom: 10px;
    font-weight: 600;
}

.avatar-container {
    display: flex;
    justify-content: center;
    margin: 10px 0;
}

.avatar {
    width: 80px;
    height: 80px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.5s ease;
}

.avatar.circle {
    background-color: #ffeb3b;
    border-radius: 50%;
}

.avatar.triangle {
    width: 0;
    height: 0;
    border-left: 40px solid transparent;
    border-right: 40px solid transparent;
    border-bottom: 80px solid #ff5722;
}

.avatar.square {
    background-color: #2196f3;
    border-radius: 5px;
}

.face {
    position: relative;
    width: 60%;
    height: 60%;
}

.eyes {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
}

.eyes::before, .eyes::after {
    content: '';
    width: 10px;
    height: 10px;
    background-color: black;
    border-radius: 50%;
}

.mouth {
    width: 20px;
    height: 10px;
    border-bottom: 3px solid black;
    border-radius: 50%;
    margin: 10px auto;
}

.emotion-bars {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

.emotion-bar {
    flex: 1;
    min-width: 100px;
    font-size: 12px;
}

.bar-container {
    height: 8px;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 2px;
}

.bar {
    height: 100%;
    background-color: #ffeb3b;
    transition: width 0.5s ease;
}

#joy-bar { background-color: #ffeb3b; }
#sadness-bar { background-color: #2196f3; }
#anger-bar { background-color: #f44336; }
#fear-bar { background-color: #9c27b0; }
#curiosity-bar { background-color: #4caf50; }

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

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.5;
    animation: fadeIn 0.3s ease;
    position: relative;
}

.message-content {
    word-break: break-word;
}

.message.user {
    align-self: flex-end;
    background-color: var(--message-user-bg);
    border-bottom-right-radius: 4px;
}

.message.bot {
    align-self: flex-start;
    background-color: var(--message-bot-bg);
    border-bottom-left-radius: 4px;
}

.message.system {
    align-self: center;
    background-color: #f5f5f5;
    max-width: 90%;
    text-align: center;
    border-radius: 8px;
    font-style: italic;
    color: #666;
}

.message .emotion {
    font-size: 12px;
    margin-top: 5px;
    opacity: 0.7;
}

.status-container {
    position: absolute;
    bottom: 70px;
    left: 0;
    right: 0;
    text-align: center;
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    z-index: 10;
}

.status-container.error {
    background-color: var(--error-color);
}

.status-container.success {
    background-color: #4caf50;
}

.chat-input-container {
    display: flex;
    padding: 20px;
    border-top: 1px solid var(--border-color);
    background-color: white;
}

#user-input {
    flex: 1;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    resize: none;
    font-family: inherit;
    outline: none;
    transition: border-color 0.3s;
}

#user-input:focus {
    border-color: var(--primary-color);
}

#send-button {
    width: 48px;
    height: 48px;
    margin-left: 10px;
    background-color: var(--primary-color);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.3s;
}

#send-button:hover {
    background-color: var(--primary-dark);
}

#send-button svg {
    width: 24px;
    height: 24px;
}

.typing-indicator {
    display: flex;
    align-items: center;
    padding: 15px 20px;
}

.typing-indicator span {
    height: 8px;
    width: 8px;
    background-color: var(--primary-color);
    border-radius: 50%;
    display: inline-block;
    margin-right: 3px;
    animation: bounce 1.5s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) {
    animation-delay: 0s;
}

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

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
    margin-right: 0;
}

@keyframes bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-10px); }
}

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

/* Responsive adjustments */
@media (max-width: 768px) {
    .chat-container {
        width: 100%;
        height: 100vh;
        max-height: none;
        border-radius: 0;
    }
    
    .message {
        max-width: 90%;
    }
    
    .emotion-bars {
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .emotion-bar {
        min-width: 80px;
    }
}

/* Add these styles to your CSS file */

.sentiment-indicator {
    position: absolute;
    bottom: 15%;
    width: 40%;
    height: 20%;
    border-radius: 50%;
    left: 30%;
    transition: all 0.5s ease;
    opacity: 0;
}

.sentiment-positive .mouth {
    border-radius: 0 0 100px 100px;
    height: 20px;
    width: 40%;
    left: 30%;
    top: 65%;
}

.sentiment-negative .mouth {
    border-radius: 100px 100px 0 0;
    height: 20px;
    width: 40%;
    left: 30%;
    top: 65%;
}

.sentiment-neutral .mouth {
    height: 5px;
    width: 40%;
    left: 30%;
    top: 70%;
}

/* Add these styles for angry expressions */

.sentiment-angry .mouth {
    border-radius: 0;  /* Straight line for mouth */
    height: 5px;
    width: 40%;
    left: 30%;
    top: 70%;
    transform: rotate(-10deg);  /* Slight angle for angry look */
    background-color: #ff3b30;  /* Red color for anger */
}

.sentiment-angry .eyes {
    background-color: #ff3b30;  /* Red eyes for anger */
}

.sentiment-angry .face {
    background-color: rgba(255, 59, 48, 0.2);  /* Light red tint */
}

/* Add angry pulsing animation */
@keyframes angryPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.sentiment-angry {
    animation: angryPulse 0.5s infinite;
}

/* Loading Screen Styles */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    animation: fadeIn 0.5s ease-in-out;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-avatar {
    margin-bottom: 30px;
    animation: float 3s ease-in-out infinite;
}

.loading-avatar .avatar {
    width: 120px;
    height: 120px;
    margin: 0 auto;
}

.loading-content h2 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 20px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    margin: 20px auto;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

#loading-status {
    font-size: 16px;
    opacity: 0.9;
    margin-top: 20px;
    min-height: 24px;
}

.loading-bar {
    width: 300px;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    margin: 20px auto 0;
    overflow: hidden;
}

.loading-progress {
    height: 100%;
    background: white;
    border-radius: 10px;
    width: 0%;
    transition: width 0.5s ease;
    animation: loadingPulse 1.5s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

@keyframes loadingPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.loading-screen.fade-out {
    animation: fadeOut 0.5s ease-in-out forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        visibility: hidden;
    }
}
