:root {
    --primary-color: #8B1A1A;
    /* MEU Red */
    --primary-gradient: linear-gradient(135deg, #8B1A1A 0%, #600f0f 100%);
    --bg-color: #f0f2f5;
    --chat-bg: rgba(255, 255, 255, 0.85);
    --glass-border: 1px solid rgba(255, 255, 255, 0.5);
    --user-msg-bg: #8B1A1A;
    --user-msg-text: #ffffff;
    --bot-msg-bg: #ffffff;
    --bot-msg-text: #1a1a1a;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.12);
}

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

body {
    font-family: 'Tajawal', sans-serif;
    background: linear-gradient(135deg, #f6f8fb 0%, #e2e6ea 100%);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* Background aesthetic elements */
body::before {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: var(--primary-color);
    filter: blur(80px);
    opacity: 0.1;
    border-radius: 50%;
    top: -50px;
    right: -50px;
    z-index: -1;
}

body::after {
    content: '';
    position: absolute;
    width: 250px;
    height: 250px;
    background: #2c3e50;
    filter: blur(80px);
    opacity: 0.08;
    border-radius: 50%;
    bottom: -50px;
    left: -50px;
    z-index: -1;
}

.chat-container {
    width: 100%;
    max-width: 420px;
    /* Slightly narrower for mobile-app feel */
    height: 90vh;
    max-height: 800px;
    background: var(--chat-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: var(--glass-border);
    border-radius: 24px;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    transition: all 0.3s ease;
}

/* Header */
.chat-header {
    background: var(--primary-gradient);
    color: white;
    padding: 18px 24px;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 12px rgba(139, 26, 26, 0.2);
    z-index: 10;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 16px;
}

.avatar-bot {
    width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 13px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.chat-header h1 {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 2px;
    letter-spacing: 0.3px;
}

.status {
    font-size: 11px;
    opacity: 0.85;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.status::before {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    background: #4ade80;
    border-radius: 50%;
}

/* Messages Area */
.messages-area {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
    /* Subtle texture pattern */
    background-image: radial-gradient(#cbd5e1 1px, transparent 1px);
    background-size: 24px 24px;
    background-position: 0 0;
    opacity: 0.95;
}

.messages-area::-webkit-scrollbar {
    width: 5px;
}

.messages-area::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

/* Message Bubbles */
.message {
    max-width: 80%;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.bot {
    align-self: flex-start;
}

.message.user {
    align-self: flex-end;
}

.message-content {
    padding: 14px 18px;
    font-size: 14px;
    line-height: 1.6;
    position: relative;
    box-shadow: var(--shadow-sm);
    word-wrap: break-word;
}

.message.bot .message-content {
    background: var(--bot-msg-bg);
    color: var(--bot-msg-text);
    border-radius: 20px 20px 20px 4px;
    border: 1px solid rgba(0, 0, 0, 0.03);
}

.message.user .message-content {
    background: var(--user-msg-bg);
    /* Fallback */
    background: var(--primary-gradient);
    color: var(--user-msg-text);
    border-radius: 20px 20px 4px 20px;
}

/* Suggested Chips */
.suggestions-area {
    padding: 12px 24px;
    display: flex;
    justify-content: center;
    gap: 10px;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    /* smooth scroll ios */
    mask-image: linear-gradient(to right, transparent 0%, black 5%, black 95%, transparent 100%);
    /* Fade edges */
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 5%, black 95%, transparent 100%);
    scrollbar-width: none;
}

.suggestions-area::-webkit-scrollbar {
    display: none;
}

.suggestion-chip {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #e2e8f0;
    padding: 10px 18px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 500;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
    flex-shrink: 0;
}

.suggestion-chip:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 26, 26, 0.25);
    border-color: transparent;
}

/* Input Area */
.input-area {
    padding: 16px 24px 24px;
    background: rgba(255, 255, 255, 0.9);
    border-top: 1px solid rgba(0, 0, 0, 0.03);
}

#chatForm {
    display: flex;
    gap: 10px;
    background: #f3f4f6;
    padding: 6px;
    border-radius: 50px;
    border: 2px solid transparent;
    /* Reserve space for border transition */
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

#chatForm:focus-within {
    background: white;
    border-color: rgba(139, 26, 26, 0.15);
    /* Light primary outline */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    /* Glow effect */
}

#userInput {
    flex: 1;
    border: none;
    background: transparent;
    padding: 12px 16px;
    outline: none;
    font-family: inherit;
    font-size: 14px;
    color: #1f2937;
}

#userInput::placeholder {
    color: #9ca3af;
}

#sendBtn {
    background: var(--primary-gradient);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    /* Bouncy pop */
    box-shadow: 0 4px 10px rgba(139, 26, 26, 0.3);
}

#sendBtn:hover {
    transform: scale(1.08) rotate(-10deg);
}

#sendBtn i {
    width: 20px;
    height: 20px;
    stroke-width: 2.5px;
    margin-right: 2px;
    /* Visual centering adjustment for icon */
    margin-top: 2px;
}

#sendBtn:disabled {
    background: #d1d5db;
    transform: none;
    box-shadow: none;
    cursor: not-allowed;
}

/* Loading Dots */
.loading-dots {
    display: inline-flex;
    gap: 5px;
    padding: 4px 0;
}

.dot {
    width: 6px;
    height: 6px;
    background: #94a3b8;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.dot:nth-child(1) {
    animation-delay: -0.32s;
}

.dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Formatting inside messages */
.message-content ul {
    margin-left: 20px;
    margin-top: 8px;
    color: inherit;
}

.message-content li {
    margin-bottom: 4px;
}

/* Disclaimer */
.disclaimer-text {
    font-size: 10px;
    color: #9ca3af;
    text-align: center;
    margin-top: 8px;
    font-weight: 500;
    opacity: 0.8;
}

@media (min-width: 768px) {
    .chat-container {
        max-width: 900px;
        /* Larger width for PC */
        height: 92vh;
        max-height: 900px;
    }
}