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

:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f8fafc;
    --surface-color: #ffffff;
    --border-color: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --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);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

.app-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.app-header {
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    box-shadow: var(--shadow-sm);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1800px;
    margin: 0 auto;
}

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

.logo-image {
    height: 48px;
    width: auto;
    object-fit: contain;
}

.logo-divider {
    width: 2px;
    height: 36px;
    background: var(--border-color);
    margin: 0 0.5rem;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.header-info {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.company-name {
    font-weight: 600;
    color: var(--text-secondary);
}

.help-btn,
.dev-tools-btn {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.help-btn:hover,
.dev-tools-btn:hover {
    background: var(--bg-color);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.dev-tools-btn {
    border-color: #f59e0b;
    color: #f59e0b;
}

.dev-tools-btn:hover {
    background: rgba(245, 158, 11, 0.1);
    border-color: #f59e0b;
    color: #f59e0b;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--warning-color);
    animation: pulse 2s infinite;
}

.status-dot.connected {
    background: var(--success-color);
    animation: none;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Demo Start Screen */
.demo-start-screen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.demo-start-content {
    text-align: center;
    max-width: 600px;
}

.demo-icon {
    margin-bottom: 2rem;
}

.demo-start-content h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.demo-start-content p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.demo-description {
    background: var(--surface-color);
    padding: 1.5rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    margin: 2rem 0;
    line-height: 1.8;
}

.start-demo-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 1.25rem 3rem;
    font-size: 1.125rem;
    font-weight: 600;
    border-radius: 0.5rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s;
    box-shadow: var(--shadow-md);
}

.start-demo-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.start-demo-btn:active {
    transform: translateY(0);
}

.demo-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-top: 3rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 400px;
    background: #fafbfc;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

/* Source Tabs */
.source-tabs {
    display: flex;
    padding: 0.5rem;
    gap: 0.25rem;
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
}

.source-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    border: none;
    background: transparent;
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s;
}

.source-tab:hover {
    background: var(--bg-color);
    color: var(--text-color);
}

.source-tab.active {
    background: var(--primary-color);
    color: white;
}

.source-tab[data-source="whatsapp"].active {
    background: #25D366;
}

.source-tab[data-source="web"].active {
    background: #4A90D9;
}

.source-tab svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* Source indicator for conversations */
.conversation-item .source-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-right: 0.5rem;
}

.conversation-item .source-indicator.whatsapp {
    background: #25D366;
}

.conversation-item .source-indicator.web {
    background: #4A90D9;
}

/* Search Container */
.search-container {
    padding: 1rem;
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
}

.search-input-wrapper {
    position: relative;
    margin-bottom: 0.75rem;
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 0.625rem 2.5rem 0.625rem 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    background: var(--bg-color);
    transition: all 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--surface-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.clear-search {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.clear-search:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.filter-buttons {
    display: flex;
    gap: 0.5rem;
}

.filter-btn {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary);
}

.filter-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.filter-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.filter-count {
    font-size: 0.75rem;
    opacity: 0.9;
}

.stop-demo-btn {
    background: var(--danger-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
}

.stop-demo-btn:hover {
    background: #dc2626;
}

.demo-progress {
    padding: 1rem 1.5rem;
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
}

.progress-bar {
    height: 8px;
    background: var(--border-color);
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--success-color));
    border-radius: 999px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    text-align: center;
}

.conversation-list {
    flex: 1;
    min-height: 0; /* Allow flex child to shrink and enable scroll */
    overflow-y: auto;
    scroll-behavior: smooth;
}

.conversation-item {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}

.conversation-item:hover {
    background: var(--bg-color);
}

.conversation-item.active {
    background: #eef2ff;
    border-left: 3px solid var(--primary-color);
}

/* Green vertical line indicator for unread messages */
.conversation-item.has-unread {
    position: relative;
}

.conversation-item.has-unread::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 8px;
    background: linear-gradient(to right, var(--success-color), rgba(16, 185, 129, 0.5), rgba(16, 185, 129, 0.1), #ffffff);
    pointer-events: none;
}

/* Active conversation overrides the unread indicator */
.conversation-item.active.has-unread::before {
    display: none;
}

.conversation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.conversation-name {
    font-weight: 600;
    color: var(--text-primary);
}

.conversation-time {
    font-size: 0.75rem;
    color: var(--text-light);
}

.conversation-preview {
    font-size: 0.875rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 0.25rem;
}

.conversation-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.conversation-id {
    font-size: 0.75rem;
    color: var(--text-light);
}

.unread-badge {
    background: var(--primary-color);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    min-width: 20px;
    text-align: center;
}

.empty-state {
    padding: 3rem 2rem;
    text-align: center;
    color: var(--text-light);
}

.empty-state p {
    font-size: 0.9rem;
}

/* Loading State */
.loading-skeleton {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.skeleton-line {
    height: 1rem;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 0.25rem;
    margin-bottom: 0.5rem;
}

.skeleton-line:last-child {
    width: 60%;
    margin-bottom: 0;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Improved Chat Empty State */
.chat-empty p {
    font-size: 1rem;
    margin-top: 1rem;
}

/* Notification Toast */
.notification-toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 1000;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification-toast.success {
    border-left: 4px solid var(--success-color);
}

.notification-toast.error {
    border-left: 4px solid var(--danger-color);
}

.notification-toast.info {
    border-left: 4px solid var(--primary-color);
}

/* Chat Area */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-color);
}

.chat-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
}

.chat-empty svg {
    margin-bottom: 1rem;
}

.chat-active {
    flex: 1;
    min-height: 0; /* Allow flex child to shrink and enable scroll */
    display: flex;
    flex-direction: column;
}

.chat-header {
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 1.25rem;
}

.user-details h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.125rem;
}

.user-id {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.chat-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    border-radius: 0.375rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.action-btn:hover {
    background: var(--bg-color);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Chat Header Right Section */
.chat-header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Session Status Badge (24h Window) */
.session-status {
    display: flex;
    align-items: center;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.status-badge.active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-badge.expired {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* Bot Control Button */
.bot-control {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem !important;
    font-size: 0.8125rem;
}

.bot-control svg {
    width: 16px;
    height: 16px;
}

.bot-control.paused {
    background: rgba(245, 158, 11, 0.1);
    border-color: #f59e0b;
    color: #f59e0b;
}

.bot-control.paused:hover {
    background: rgba(245, 158, 11, 0.2);
}

/* Chat Input Container */
.chat-input-container {
    background: var(--surface-color);
    border-top: 1px solid var(--border-color);
    padding: 1rem 2rem;
}

.chat-input-container.locked .chat-input {
    opacity: 0.5;
    pointer-events: none;
}

.chat-input-container.locked .chat-input input::placeholder {
    color: #ef4444;
}

/* Template Selector */
.template-selector {
    margin-bottom: 0.75rem;
    display: flex;
    gap: 0.5rem;
}

.template-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #25D366;
    color: white;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.template-btn:hover {
    background: #1da851;
}

.template-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.chat-messages {
    flex: 1;
    min-height: 0; /* Allow flex child to shrink and enable scroll */
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: #f7f7f7;
    scroll-behavior: smooth;
}

/* Load More Messages */
.load-more-container {
    display: flex;
    justify-content: center;
    padding: 1rem 0;
    margin-bottom: 0.5rem;
}

.load-more-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 2rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.load-more-btn:hover {
    background: var(--bg-color);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.load-more-btn svg {
    width: 14px;
    height: 14px;
}

/* Loading Messages Indicator */
.loading-messages {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.message {
    display: flex;
    gap: 0.75rem;
    max-width: 70%;
    animation: fadeIn 0.3s ease;
}

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

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

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

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
    position: relative;
}

.message.bot .message-avatar {
    background: #2563eb;
    border: 2px solid #2563eb;
    background-image: url('/infinitix.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Fallback if image doesn't load - show 'Bot' text */
.message.bot .message-avatar::before {
    content: 'Bot';
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    z-index: -1;
}

.message.user .message-avatar {
    background: var(--success-color);
}

.message-content {
    flex: 1;
}

.message-bubble {
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.message.bot .message-bubble {
    background: #2563eb;
    color: white;
    border-bottom-left-radius: 0.25rem;
}

.message.user .message-bubble {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-bottom-right-radius: 0.25rem;
}

.message-sender {
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    padding: 0 0.25rem;
}

.message.bot .message-sender {
    color: rgba(255, 255, 255, 0.9);
}

.message.user .message-sender {
    color: var(--text-secondary);
    text-align: right;
}

.message-time {
    font-size: 0.75rem;
    margin-top: 0.25rem;
    padding: 0 0.25rem;
}

.message.bot .message-time {
    color: rgba(255, 255, 255, 0.7);
}

.message.user .message-time {
    text-align: right;
    color: var(--text-light);
}

/* Session Banner */
.session-banner {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 2rem 0;
    padding: 0 2rem;
}

.session-banner-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--border-color), transparent);
}

.session-banner-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    background: var(--bg-color);
    border-radius: 1rem;
    border: 1px solid var(--border-color);
}

.session-banner-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.session-banner-time {
    font-size: 0.7rem;
    color: var(--text-light);
}

/* Session count badge */
.session-count {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    background: var(--primary-color);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 0.75rem;
    margin-left: 0.5rem;
}

.chat-input {
    background: var(--surface-color);
    border-top: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    gap: 1rem;
}

.chat-input input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    background: var(--bg-color);
}

.chat-input input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.chat-input button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.chat-input button:hover {
    background: var(--primary-hover);
}

.chat-input button:disabled {
    background: var(--border-color);
    cursor: not-allowed;
}

/* Scrollbar Styling - Enhanced with dynamic sizing */
.conversation-list::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar {
    width: 10px;
}

.conversation-list::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 5px;
}

.conversation-list::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--border-color) 0%, #94a3b8 100%);
    border-radius: 5px;
    border: 2px solid var(--bg-color);
    min-height: 40px;
}

.conversation-list::-webkit-scrollbar-thumb:hover,
.chat-messages::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #94a3b8 0%, var(--primary-color) 100%);
}

.conversation-list::-webkit-scrollbar-thumb:active,
.chat-messages::-webkit-scrollbar-thumb:active {
    background: var(--primary-color);
}

/* Firefox scrollbar styling */
.conversation-list,
.chat-messages {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) var(--bg-color);
}

/* Scroll to Bottom Button */
.scroll-to-bottom-btn {
    position: absolute;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 44px;
    height: 44px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    box-shadow: var(--shadow-lg);
    transition: all 0.2s ease;
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
}

.scroll-to-bottom-btn.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-to-bottom-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.scroll-to-bottom-btn:hover .scroll-arrow,
.scroll-to-bottom-btn:hover .scroll-line {
    stroke: white;
}

.scroll-to-bottom-btn:active {
    transform: translateY(0);
}

.scroll-arrow {
    stroke: var(--text-secondary);
    stroke-width: 2;
    fill: none;
    transition: stroke 0.2s;
}

.scroll-line {
    stroke: var(--text-secondary);
    stroke-width: 2;
    stroke-linecap: round;
    transition: stroke 0.2s;
}

/* Wrapper for chat messages to contain the scroll button */
.chat-messages-wrapper {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Info Panel */
.info-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 2rem;
}

.info-panel {
    background: var(--surface-color);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.info-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.info-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    line-height: 1;
    transition: color 0.2s;
}

.info-close:hover {
    color: var(--text-primary);
}

.info-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.info-section {
    margin-bottom: 1.5rem;
}

.info-section:last-child {
    margin-bottom: 0;
}

.info-section h4 {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.info-section div {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
    color: var(--text-primary);
}

.info-section div:last-child {
    border-bottom: none;
}

.info-session {
    background: var(--bg-color);
    padding: 0.75rem;
    border-radius: 0.375rem;
    margin-bottom: 0.75rem;
    border: 1px solid var(--border-color);
}

.info-session:last-child {
    margin-bottom: 0;
}

.info-session strong {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.info-session div {
    padding: 0.25rem 0;
    border: none;
    font-size: 0.8125rem;
}

/* Export Modal Buttons */
.export-format-btn {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--surface-color);
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.export-format-btn:hover {
    border-color: var(--primary-color);
    background: #f8f9ff;
    transform: translateX(4px);
}

.export-format-btn svg {
    color: var(--primary-color);
    flex-shrink: 0;
}

.export-format-btn div {
    flex: 1;
}

.export-format-btn strong {
    display: block;
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.export-format-btn small {
    display: block;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Focus States for Accessibility */
.search-input:focus,
.filter-btn:focus,
.action-btn:focus,
.help-btn:focus,
.export-format-btn:focus,
.info-close:focus,
button:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.filter-btn:focus {
    outline-offset: -2px;
}

/* Responsive */
/* Agent Message Styles (Manual/HITL messages) */
.message.agent {
    align-self: flex-start;
}

.message.agent .message-avatar {
    background: #f59e0b;
    border: 2px solid #f59e0b;
}

.message.agent .message-bubble {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
    border-bottom-left-radius: 0.25rem;
}

.message.agent .message-sender {
    color: #b45309;
}

.message.agent .message-time {
    color: #d97706;
}

.message.agent .message-status {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.7rem;
    margin-top: 0.25rem;
    padding: 0 0.25rem;
}

.message.agent .message-status.sent {
    color: var(--success-color);
}

.message.agent .message-status.failed {
    color: var(--danger-color);
}

.message.agent .message-status.pending {
    color: var(--warning-color);
}

/* Dev Tools Panel */
.dev-tools-panel {
    position: fixed;
    top: 70px;
    right: 1rem;
    width: 400px;
    max-height: 70vh;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-xl);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dev-tools-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #fef3c7;
    border-bottom: 1px solid #fcd34d;
}

.dev-tools-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #92400e;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dev-tools-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: #b45309;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

.dev-tools-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.dev-tools-section {
    margin-bottom: 1.5rem;
}

.dev-tools-section:last-child {
    margin-bottom: 0;
}

.dev-tools-section h4 {
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dev-tools-section h4 .status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.dev-tools-section h4 .status-indicator.ok {
    background: var(--success-color);
}

.dev-tools-section h4 .status-indicator.error {
    background: var(--danger-color);
}

.dev-tools-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
}

.dev-tools-item:last-child {
    border-bottom: none;
}

.dev-tools-item .label {
    color: var(--text-secondary);
}

.dev-tools-item .value {
    color: var(--text-primary);
    font-weight: 500;
    font-family: monospace;
}

.dev-tools-item .value.success {
    color: var(--success-color);
}

.dev-tools-item .value.error {
    color: var(--danger-color);
}

.dev-tools-item .value.warning {
    color: var(--warning-color);
}

.dev-tools-logs {
    max-height: 200px;
    overflow-y: auto;
    background: #1e293b;
    border-radius: 0.375rem;
    padding: 0.75rem;
    font-family: monospace;
    font-size: 0.75rem;
    color: #e2e8f0;
}

.dev-tools-log-entry {
    padding: 0.25rem 0;
    border-bottom: 1px solid #334155;
}

.dev-tools-log-entry:last-child {
    border-bottom: none;
}

.dev-tools-log-entry.success {
    color: #4ade80;
}

.dev-tools-log-entry.error {
    color: #f87171;
}

.dev-tools-log-entry.info {
    color: #60a5fa;
}

.dev-tools-log-entry .timestamp {
    color: #94a3b8;
    margin-right: 0.5rem;
}

.dev-tools-btn-refresh {
    width: 100%;
    padding: 0.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.dev-tools-btn-refresh:hover {
    background: var(--primary-hover);
}

/* Send message input styling improvements */
.chat-input.sending input {
    opacity: 0.6;
}

.chat-input.sending button {
    background: var(--warning-color);
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
    }

    .main-content {
        flex-direction: column;
    }

    .message {
        max-width: 85%;
    }

    .stats-widget {
        grid-template-columns: repeat(3, 1fr);
    }

    .logo h1 {
        font-size: 1.25rem;
    }

    .logo-image {
        height: 36px;
    }

    .header-info {
        flex-direction: column;
        align-items: flex-end;
        gap: 0.5rem;
    }

    /* Mobile notification positioning */
    .notification-toast {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
        max-width: calc(100% - 2rem);
    }

    /* Dev tools panel mobile */
    .dev-tools-panel {
        width: calc(100% - 2rem);
        right: 1rem;
        left: 1rem;
    }
}
