/* Reset and base styles */
:root {
    --primary-color: #1C627B;      /* Blue - Header & Footer */
    --secondary-color: #E9E4D9;    /* Beige for accents */
    --background-color: #F8F8F8;   /* Very Light Gray Background */
    --text-color: #333333;         /* Dark Gray Text */
    --chat-bot-bg: #E8E6FA;        /* Soft lavender for Bot messages */
    --chat-user-bg: #E9E4D9;       /* Beige for User messages */
    --input-bg: #fff;              /* White Input Background */
    --shadow-color: rgba(233, 228, 217, 0.3); /* Beige shadow with medium opacity */
    --accent-color: #ABAFD8;       /* Muted Lavender for accents */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header styles */
header {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 2px 4px var(--shadow-color);
    position: relative;
}

/* Language selector styles */
.lang-selector {
    position: absolute;
    top: 1rem;
    right: 1rem;
}

#language-select {
    padding: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background-color: transparent;
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

#language-select:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

#language-select:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.5);
}

#language-select option {
    background-color: var(--primary-color);
    color: white;
}

header h1 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

header h2 {
    font-size: 1.2rem;
    font-weight: normal;
    opacity: 0.9;
}

/* Main content styles */
main {
    flex: 1;
    padding: 2rem 1rem;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

#chat-container {
    background-color: var(--input-bg);
    border-radius: 12px;
    box-shadow: 0 4px 6px var(--shadow-color);
    overflow: hidden;
    height: 70vh;
    display: flex;
    flex-direction: column;
}

#chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    scroll-behavior: smooth;
}

/* Chat message styles */
.message {
    max-width: 80%;
    margin-bottom: 1rem;
    padding: 0.8rem 1.2rem;
    border-radius: 12px;
    animation: fadeIn 0.3s ease-in-out;
    line-height: 1.5;
    white-space: pre-line;
}

/* Message content styling */
.message.bot br {
    display: block;
    content: "";
    margin-top: 0.5em;
}

.message.bot strong {
    font-weight: 600;
    color: var(--primary-color);
    transition: color 0.2s ease;
}

.message.bot strong:hover {
    color: var(--secondary-color);
}

/* Bullet point styling */
.message.bot {
    position: relative;
}

.message.bot::before {
    content: none;
}

/* Style for bullet points (•) */
.message.bot span.bullet {
    display: inline-block;
    margin-right: 0.5em;
    color: var(--primary-color);
}

/* Add spacing between paragraphs */
.message.bot p {
    margin: 0.75em 0;
}

/* First paragraph no top margin */
.message.bot p:first-child {
    margin-top: 0;
}

/* Last paragraph no bottom margin */
.message.bot p:last-child {
    margin-bottom: 0;
}

.message.bot {
    background-color: var(--chat-bot-bg);
    margin-right: auto;
    border-bottom-left-radius: 4px;
}

.message.user {
    background-color: var(--chat-user-bg);
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

/* Input area styles */
#input-area {
    padding: 1rem;
    background-color: var(--input-bg);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 0.5rem;
    position: relative;
}

.input-group {
    flex: 1;
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}

#emoji-button {
    padding: 0;
    width: 44px;
    height: 44px;
    background: none;
    border: 1px solid var(--secondary-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#emoji-button:hover {
    background-color: var(--secondary-color);
}

#mic-button {
    padding: 0;
    width: 44px;
    height: 44px;
    background: none;
    border: 1px solid var(--secondary-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#mic-button:hover {
    background-color: var(--secondary-color);
}

#mic-button.recording {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    animation: pulse 1.5s ease infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

#emoji-picker {
    position: absolute;
    bottom: 100%;
    left: 1rem;
    background-color: var(--input-bg);
    border: 1px solid var(--secondary-color);
    border-radius: 8px;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

#emoji-picker.hidden {
    display: none;
}

.emoji-container {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
}

.emoji {
    padding: 0.5rem;
    font-size: 1.2rem;
    background: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.emoji:hover {
    transform: scale(1.2);
    background-color: var(--secondary-color);
}

#message-input {
    flex: 1;
    padding: 0.8rem 1rem;
    border: 1px solid var(--secondary-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    resize: none;
    min-height: 44px;
    max-height: 150px;
    line-height: 1.5;
    overflow-y: auto;
    font-family: inherit;
}

#message-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(28, 98, 123, 0.2);
}

#send-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    width: 44px;
    height: 44px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: background-color 0.3s ease;
    transform: rotate(0deg);
    display: flex;
    align-items: center;
    justify-content: center;
}

#send-button span {
    display: inline-block;
    transform: rotate(-45deg);
}

#send-button:hover {
    background-color: var(--secondary-color);
    color: var(--text-color);
}

#send-button:active {
    transform: scale(0.98);
}

/* Footer styles */
footer {
    text-align: center;
    padding: 1rem;
    background-color: var(--primary-color);
    color: white;
    font-size: 0.9rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Voice message styles */
.voice-message {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 16px;
}

.voice-icon {
    font-size: 1.2em;
}

.voice-wave {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 20px;
}

.voice-wave span {
    width: 3px;
    height: 100%;
    background: #666;
    border-radius: 3px;
    animation: wave 1s ease-in-out infinite;
}

.voice-wave span:nth-child(2) {
    animation-delay: 0.2s;
}

.voice-wave span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes wave {
    0%, 100% { height: 8px; }
    50% { height: 16px; }
}

.voice-text {
    color: #666;
    font-size: 0.9em;
}

.play-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.play-button:hover {
    background: rgba(0, 0, 0, 0.1);
}

.play-icon {
    font-size: 1.2em;
    line-height: 1;
}

.voice-wave {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 20px;
}

.voice-wave span {
    width: 3px;
    height: 100%;
    background: #666;
    border-radius: 3px;
    animation: wave 1s ease-in-out infinite;
}

.voice-wave span:nth-child(2) {
    animation-delay: 0.2s;
}

.voice-wave span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes wave {
    0%, 100% { height: 8px; }
    50% { height: 16px; }
}

.voice-text {
    color: #666;
    font-size: 0.9em;
}

/* Responsive design */
@media (max-width: 600px) {
    header h1 {
        font-size: 1.5rem;
    }

    header h2 {
        font-size: 1rem;
    }

    main {
        padding: 1rem 0.5rem;
    }

    .message {
        max-width: 90%;
    }

    #send-button {
        padding: 0.8rem 1rem;
    }
}