:root {
    --primary-color: #0F766E;
    /* Teal 700 */
    --primary-light: #14B8A6;
    /* Teal 500 */
    --primary-dark: #0D9488;
    --accent-gold: #D4AF37;
    --bg-page: #F0FDF4;
    /* Mint 50 */
    --bg-chat: #FFFFFF;
    --text-main: #111827;
    --text-muted: #6B7280;
    --msg-user-bg: #0F766E;
    --msg-user-text: #FFFFFF;
    --msg-bot-bg: #F3F4F6;
    --msg-bot-text: #1F2937;
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Outfit', sans-serif;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

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

body {
    font-family: var(--font-body);
    background: linear-gradient(135deg, #F0FDFA 0%, #CCFBF1 100%);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.app-container {
    width: 100%;
    max-width: 480px;
    /* Mobile-first feel, but looks good on desktop */
    height: 95vh;
    background: var(--bg-chat);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.4);
}

/* Header */
.chat-header {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 1rem;
    border-bottom: 1px solid #E5E7EB;
    z-index: 10;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.admin-settings-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(15, 118, 110, 0.1);
    border-radius: 10px;
    color: var(--primary-color);
    transition: all 0.2s ease;
    text-decoration: none;
}

.admin-settings-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: rotate(90deg);
}

.admin-settings-btn svg {
    transition: transform 0.3s ease;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: var(--primary-color);
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: bold;
    font-size: 1.2rem;
}

.logo-text h1 {
    font-family: var(--font-heading);
    font-size: 1rem;
    color: var(--primary-color);
    font-weight: 600;
}

.logo-text p {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.agent-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-top: 0.5rem;
}

.avatar {
    position: relative;
}

.avatar img {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: var(--shadow-sm);
}

.status-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    background: #10B981;
    border-radius: 50%;
    border: 1.5px solid white;
}

.agent-info h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
}

.agent-info p {
    font-size: 0.8rem;
    color: var(--primary-dark);
}

/* Messages */
.chat-interface {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background: #FAFAFA;
    scroll-behavior: smooth;
    display: flex;
    flex-direction: column;
}

.messages-container {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.message {
    max-width: 85%;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    animation: fadeIn 0.3s ease-out;
}

.message-content {
    padding: 1rem;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.5;
    box-shadow: var(--shadow-sm);
}

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

.bot-message .message-content {
    background: var(--msg-bot-bg);
    color: var(--msg-bot-text);
    border-top-left-radius: 4px;
    /* Distinctive shape */
}

/* HTML5 Content Styling for Bot Messages */
.bot-message .message-content h1,
.bot-message .message-content h2,
.bot-message .message-content h3,
.bot-message .message-content h4,
.bot-message .message-content h5,
.bot-message .message-content h6 {
    font-family: var(--font-heading);
    color: var(--primary-color);
    margin: 0.75em 0 0.5em 0;
    line-height: 1.3;
}

.bot-message .message-content h1:first-child,
.bot-message .message-content h2:first-child,
.bot-message .message-content h3:first-child,
.bot-message .message-content h4:first-child {
    margin-top: 0;
}

.bot-message .message-content h1 {
    font-size: 1.4rem;
}

.bot-message .message-content h2 {
    font-size: 1.2rem;
}

.bot-message .message-content h3 {
    font-size: 1.1rem;
}

.bot-message .message-content h4 {
    font-size: 1rem;
}

.bot-message .message-content p {
    margin: 0.5em 0;
}

.bot-message .message-content p:first-child {
    margin-top: 0;
}

.bot-message .message-content p:last-child {
    margin-bottom: 0;
}

.bot-message .message-content ul,
.bot-message .message-content ol {
    margin: 0.75em 0;
    padding-left: 1.5em;
}

.bot-message .message-content li {
    margin: 0.35em 0;
    line-height: 1.5;
}

.bot-message .message-content li::marker {
    color: var(--primary-color);
}

.bot-message .message-content strong,
.bot-message .message-content b {
    font-weight: 600;
    color: var(--text-main);
}

.bot-message .message-content em,
.bot-message .message-content i {
    font-style: italic;
}

.bot-message .message-content a {
    color: var(--primary-color);
    text-decoration: underline;
    font-weight: 500;
    transition: color 0.2s;
}

.bot-message .message-content a:hover {
    color: var(--primary-dark);
}

.bot-message .message-content code {
    background: rgba(15, 118, 110, 0.1);
    padding: 0.15em 0.4em;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
    color: var(--primary-dark);
}

.bot-message .message-content pre {
    background: #1F2937;
    color: #E5E7EB;
    padding: 1em;
    border-radius: 8px;
    overflow-x: auto;
    margin: 0.75em 0;
    font-size: 0.85em;
}

.bot-message .message-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.bot-message .message-content blockquote {
    border-left: 3px solid var(--primary-color);
    padding-left: 1em;
    margin: 0.75em 0;
    color: var(--text-muted);
    font-style: italic;
}

.bot-message .message-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.75em 0;
    font-size: 0.9em;
}

.bot-message .message-content th,
.bot-message .message-content td {
    padding: 0.5em 0.75em;
    text-align: left;
    border-bottom: 1px solid #E5E7EB;
}

.bot-message .message-content th {
    background: rgba(15, 118, 110, 0.1);
    font-weight: 600;
    color: var(--primary-color);
}

.bot-message .message-content tr:hover {
    background: rgba(15, 118, 110, 0.05);
}

.bot-message .message-content hr {
    border: none;
    border-top: 1px solid #E5E7EB;
    margin: 1em 0;
}

.bot-message .message-content mark {
    background: rgba(212, 175, 55, 0.3);
    padding: 0.1em 0.3em;
    border-radius: 3px;
}

.bot-message .message-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 0.5em 0;
}

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

.user-message .message-content {
    background: var(--msg-user-bg);
    color: var(--msg-user-text);
    border-top-right-radius: 4px;
}

.timestamp {
    font-size: 0.7rem;
    color: #9CA3AF;
    margin: 0 0.5rem;
}

.user-message .timestamp {
    text-align: right;
}

/* Input Area */
.input-area {
    padding: 1rem;
    background: white;
    border-top: 1px solid #E5E7EB;
}

.input-wrapper {
    display: flex;
    gap: 0.5rem;
    background: #F3F4F6;
    padding: 0.5rem;
    border-radius: 50px;
    /* Pill shape */
    transition: all 0.2s;
    border: 1px solid transparent;
}

.input-wrapper:focus-within {
    background: white;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.1);
}

#user-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0.5rem 1rem;
    font-family: var(--font-body);
    font-size: 1rem;
    outline: none;
}

#send-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

#send-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

#send-btn:active {
    transform: scale(0.95);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

/* Custom Scrollbar */
.chat-interface::-webkit-scrollbar {
    width: 6px;
}

.chat-interface::-webkit-scrollbar-track {
    background: transparent;
}

.chat-interface::-webkit-scrollbar-thumb {
    background-color: #D1D5DB;
    border-radius: 10px;
}

/* Loading Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 1rem;
    background: var(--msg-bot-bg);
    border-radius: 16px;
    border-top-left-radius: 4px;
    width: fit-content;
    align-self: flex-start;
}

.dot {
    width: 8px;
    height: 8px;
    background: #9CA3AF;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

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

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

@keyframes bounce {

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

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