/* ConferenceHaven Chat UI Styles - Mobile-First Design */

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

:root {
    --primary-color: #0078d4;
    --secondary-color: #f3f2f1;
    --text-color: #323130;
    --border-color: #edebe9;
    --agent-bg: #f3f2f1;
    --user-bg: #0078d4;
    --user-text: #ffffff;
    --error-bg: #fde7e9;
    --error-text: #a80000;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #faf9f8;
    color: var(--text-color);
    line-height: 1.6;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 100%;
    margin: 0 auto;
    background: white;
}

/* Header */
.chat-header {
    background: linear-gradient(135deg, #0078d4 0%, #005a9e 100%);
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    z-index: 10;
}

.header-content h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.header-content .subtitle {
    font-size: 0.875rem;
    opacity: 0.9;
}

.close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 2rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.close-icon {
    line-height: 1;
}

/* Messages Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    scroll-behavior: smooth;
}

.message {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    animation: fadeIn 0.3s ease-in;
}

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

.message.user-message {
    flex-direction: row-reverse;
}

.avatar {
    font-size: 2rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.message-content {
    max-width: 75%;
}

.message-text {
    padding: 0.875rem 1rem;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.agent-message .message-text {
    background: var(--agent-bg);
    border-bottom-left-radius: 4px;
}

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

/* Markdown styling in messages */
.message-text p {
    margin-bottom: 0.75rem;
}

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

.message-text ul,
.message-text ol {
    margin-left: 1.5rem;
    margin-bottom: 0.75rem;
}

.message-text li {
    margin-bottom: 0.25rem;
}

.message-text strong {
    font-weight: 600;
}

.message-text code {
    background: rgba(0, 0, 0, 0.05);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.user-message .message-text code {
    background: rgba(255, 255, 255, 0.2);
}

/* Loading Indicator */
.loading-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    margin: 0 1rem;
    background: var(--agent-bg);
    border-radius: 12px;
    animation: fadeIn 0.3s ease-in;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0, 120, 212, 0.2);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Input Area */
.chat-input-container {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    background: white;
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
}

#messageInput {
    flex: 1;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 24px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

#messageInput:focus {
    outline: none;
    border-color: var(--primary-color);
}

#messageInput:disabled {
    background: var(--secondary-color);
    cursor: not-allowed;
}

#sendButton {
    background: var(--primary-color);
    color: white;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

#sendButton:hover:not(:disabled) {
    background: #005a9e;
    transform: scale(1.05);
}

#sendButton:disabled {
    background: #c8c6c4;
    cursor: not-allowed;
    transform: none;
}

/* Error Toast */
.error-toast {
    position: fixed;
    bottom: 5rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--error-bg);
    color: var(--error-text);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow);
    max-width: 90%;
    z-index: 1000;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        bottom: 4rem;
        opacity: 0;
    }
    to {
        bottom: 5rem;
        opacity: 1;
    }
}

.error-icon {
    font-size: 1.5rem;
}

.error-close {
    background: none;
    border: none;
    color: var(--error-text);
    font-size: 1.5rem;
    cursor: pointer;
    margin-left: 0.5rem;
    line-height: 1;
}

/* Tablet and Desktop */
@media (min-width: 768px) {
    .chat-container {
        max-width: 800px;
        border-radius: 12px;
        margin: 2rem auto;
        height: calc(100vh - 4rem);
        box-shadow: var(--shadow);
    }

    .chat-header {
        border-radius: 12px 12px 0 0;
    }

    .header-content h1 {
        font-size: 1.75rem;
    }

    .message-content {
        max-width: 65%;
    }

    .error-toast {
        max-width: 500px;
    }
}

/* Desktop Large */
@media (min-width: 1200px) {
    .chat-container {
        max-width: 1000px;
    }
}
