/* ====================================
   CREIMS Agent Chat UI Styles
   ChatGPT-style interface - Aligned to Platform UI Standards
   ==================================== */

/* CSS Variables - Allineati con Platform UI Standards (tokens.css + theme-system.css) */
/* Tema Chiaro (Default) - Light Mode */
:root {
    --agent-bg: var(--bg-body, #f9fafb);
    --agent-sidebar-bg: var(--gray-100, #f3f4f6);
    --agent-sidebar-hover: var(--gray-200, #e5e7eb);
    --agent-sidebar-active: var(--gray-300, #d1d5db);
    --agent-chat-bg: var(--bg-card, #ffffff);
    --agent-input-bg: var(--gray-100, #f3f4f6);
    --agent-input-border: var(--border-color, #e5e7eb);
    --agent-text-primary: var(--text-primary, #1f2937);
    --agent-text-secondary: var(--text-secondary, #4b5563);
    --agent-text-muted: var(--text-muted, #9ca3af);
    --agent-accent: var(--success, #10b981);
    --agent-accent-hover: #059669;
    --agent-user-bubble: var(--gray-100, #f3f4f6);
    --agent-assistant-bubble: transparent;
    --agent-border: var(--border-color, #e5e7eb);
    --agent-shadow: rgba(0, 0, 0, 0.1);
    --agent-code-bg: var(--gray-100, #f3f4f6);
    --agent-scrollbar: var(--gray-400, #9ca3af);
    --agent-scrollbar-hover: var(--gray-500, #6b7280);
    --agent-surface: var(--bg-card, #ffffff);
}

/* Tema Scuro - Dark Mode */
html[data-theme='dark'] {
    --agent-bg: var(--gray-900, #111827);
    --agent-sidebar-bg: var(--gray-800, #1f2937);
    --agent-sidebar-hover: var(--gray-700, #374151);
    --agent-sidebar-active: var(--gray-600, #4b5563);
    --agent-chat-bg: var(--gray-900, #111827);
    --agent-input-bg: var(--gray-800, #1f2937);
    --agent-input-border: var(--gray-700, #374151);
    --agent-text-primary: var(--gray-100, #f3f4f6);
    --agent-text-secondary: var(--gray-400, #9ca3af);
    --agent-text-muted: var(--gray-500, #6b7280);
    --agent-accent: var(--success, #10b981);
    --agent-accent-hover: #059669;
    --agent-user-bubble: var(--gray-800, #1f2937);
    --agent-assistant-bubble: transparent;
    --agent-border: var(--gray-700, #374151);
    --agent-shadow: rgba(0, 0, 0, 0.3);
    --agent-code-bg: var(--gray-950, #030712);
    --agent-scrollbar: var(--gray-600, #4b5563);
    --agent-scrollbar-hover: var(--gray-500, #6b7280);
    --agent-surface: var(--gray-800, #1f2937);
}

/* Base Layout */
.agent-body {
    margin: 0;
    padding: 0;
    background: var(--agent-bg);
    color: var(--agent-text-primary);
    font-family: var(--font-sans, 'Inter'), -apple-system, BlinkMacSystemFont, sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.agent-layout {
    display: flex;
    min-height: calc(100vh - var(--header-height, 70px));
    width: 100%;
}

/* ====================================
   Sidebar Styles
   ==================================== */
.agent-sidebar {
    width: 260px;
    background: var(--agent-sidebar-bg);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--agent-border);
    transition: transform 0.3s ease, width 0.3s ease;
}

.agent-sidebar.collapsed {
    width: 52px;
    min-width: 52px;
}

.agent-sidebar.collapsed .sidebar-header {
    flex-direction: column;
    padding: 0.75rem 0.5rem;
    gap: 0.75rem;
}

.agent-sidebar.collapsed .btn-new-chat {
    width: 36px;
    height: 36px;
    padding: 0;
    justify-content: center;
}

.agent-sidebar.collapsed .btn-new-chat span {
    display: none;
}

.agent-sidebar.collapsed .btn-sidebar-toggle i {
    transform: rotate(180deg);
}

.agent-sidebar.collapsed .sidebar-client-selector,
.agent-sidebar.collapsed .sidebar-chats,
.agent-sidebar.collapsed .sidebar-footer {
    display: none;
}

/* Sidebar Header */
.sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
}

.btn-new-chat {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--agent-sidebar-hover);
    border: 1px solid var(--agent-border);
    border-radius: 0.5rem;
    color: var(--agent-text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-new-chat:hover {
    background: var(--agent-sidebar-active);
}

.btn-new-chat i {
    width: 18px;
    height: 18px;
}

.btn-sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    border-radius: 0.5rem;
    color: var(--agent-text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    z-index: 10;
    position: relative;
}

.btn-sidebar-toggle:hover {
    background: var(--agent-sidebar-hover);
    color: var(--agent-text-primary);
}

.btn-sidebar-toggle:active {
    background: var(--agent-sidebar-active);
}

/* Client Selector */
.sidebar-client-selector {
    padding: 0 0.75rem 0.75rem;
}

.selector-label {
    display: block;
    font-size: var(--font-size-xs, 0.75rem);
    font-weight: var(--font-weight-medium, 500);
    color: var(--text-muted, #9ca3af);
    margin-bottom: var(--space-1, 4px);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Chat History */
.sidebar-chats {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.chats-section {
    margin-bottom: 1rem;
}

.chats-section-header {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--agent-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.chats-list {
    display: flex;
    flex-direction: column;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem;
    margin: 0 0.375rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
}

.chat-item:hover {
    background: var(--agent-sidebar-hover);
}

.chat-item.active {
    background: var(--agent-sidebar-active);
}

.chat-item-icon {
    width: 18px;
    height: 18px;
    color: var(--agent-text-muted);
    flex-shrink: 0;
}

.chat-item-content {
    flex: 1;
    min-width: 0;
}

.chat-item-title {
    font-size: 0.875rem;
    color: var(--agent-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item-client {
    font-size: 0.75rem;
    color: var(--agent-text-muted);
    margin-top: 0.125rem;
}

.chat-item-actions {
    display: none;
    gap: 0.25rem;
}

.chat-item:hover .chat-item-actions {
    display: flex;
}

.chat-item-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    border-radius: 0.25rem;
    color: var(--agent-text-muted);
    cursor: pointer;
    transition: all 0.15s;
}

.chat-item-btn:hover {
    background: var(--agent-sidebar-hover);
    color: var(--agent-text-primary);
}

.chat-item-btn i {
    width: 14px;
    height: 14px;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 0.5rem;
    border-top: 1px solid var(--agent-border);
}

/* Model Selector in Sidebar */
.sidebar-model-selector {
    padding: var(--space-2, 8px) var(--space-3, 12px);
    margin-bottom: var(--space-2, 8px);
}

.model-label {
    display: flex;
    align-items: center;
    gap: var(--space-2, 8px);
    font-size: var(--font-size-xs, 0.75rem);
    font-weight: var(--font-weight-medium, 500);
    color: var(--text-muted, #9ca3af);
    margin-bottom: var(--space-2, 8px);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.model-label i {
    width: 14px;
    height: 14px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: 0.5rem;
    color: var(--agent-text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
}

.sidebar-link:hover {
    background: var(--agent-sidebar-hover);
    color: var(--agent-text-primary);
}

.sidebar-link i {
    width: 18px;
    height: 18px;
}

/* ====================================
   Main Chat Area
   ==================================== */
.agent-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
}

/* Mobile Header */
.agent-mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--agent-bg);
    border-bottom: 1px solid var(--agent-border);
}

.mobile-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.mobile-logo {
    width: 24px;
    height: 24px;
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    border-radius: 0.5rem;
    color: var(--agent-text-primary);
    cursor: pointer;
    transition: background 0.2s;
}

.btn-icon:hover {
    background: var(--agent-sidebar-hover);
}

/* Chat Container */
.chat-container {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Welcome Screen */
.welcome-screen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.welcome-content {
    max-width: 720px;
    text-align: center;
}

.welcome-logo {
    margin-bottom: 1.5rem;
}

.welcome-logo img {
    width: 64px;
    height: 64px;
    filter: drop-shadow(0 4px 12px var(--agent-shadow));
}

.welcome-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--agent-text-primary);
    margin: 0 0 0.5rem;
}

.welcome-subtitle {
    font-size: 1rem;
    color: var(--agent-text-secondary);
    margin: 0 0 2.5rem;
}

/* Welcome Steps */
.welcome-step {
    width: 100%;
    max-width: 500px;
    margin-bottom: 2rem;
}

.step-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--agent-text-secondary);
}

.step-label i {
    width: 18px;
    height: 18px;
    color: var(--agent-accent);
}

.welcome-client-select {
    /* Usa CSS da components/forms.css - classe .select */
}

/* Support Type Cards */
.support-type-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.support-card {
    background: var(--agent-input-bg);
    border: 2px solid var(--agent-border);
    border-radius: 1rem;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.support-card:hover {
    border-color: var(--agent-accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.support-card.selected {
    border-color: var(--agent-accent);
    background: rgba(59, 130, 246, 0.1);
}

.support-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: var(--agent-accent);
    border-radius: 1rem;
    margin: 0 auto 1rem;
}

.support-card-icon i {
    width: 28px;
    height: 28px;
    color: white;
}

.support-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--agent-text-primary);
    margin: 0 0 0.5rem;
}

.support-card p {
    font-size: 0.85rem;
    color: var(--agent-text-secondary);
    margin: 0;
    line-height: 1.4;
}

/* Legacy feature cards - keeping for compatibility */
.welcome-features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.feature-card {
    background: var(--agent-input-bg);
    border: 1px solid var(--agent-border);
    border-radius: 0.75rem;
    padding: 1.25rem;
    text-align: left;
    transition: all 0.2s;
}

.feature-card:hover {
    border-color: var(--agent-accent);
    transform: translateY(-2px);
}

.feature-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--agent-accent);
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
}

.feature-icon i {
    width: 20px;
    height: 20px;
    color: white;
}

.feature-card h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--agent-text-primary);
    margin: 0 0 0.375rem;
}

.feature-card p {
    font-size: 0.8rem;
    color: var(--agent-text-secondary);
    margin: 0;
    line-height: 1.4;
}

.welcome-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--agent-input-bg);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: var(--agent-text-secondary);
}

.welcome-hint i {
    width: 16px;
    height: 16px;
    color: var(--agent-accent);
}

/* Messages Area */
.messages-area {
    flex: 1;
    padding: 1.5rem 0;
}

.messages-list {
    max-width: 768px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Message Styles */
.message {
    margin-bottom: 1.5rem;
    animation: messageIn 0.3s ease;
}

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

.message-wrapper {
    display: flex;
    gap: 1rem;
}

.message.user .message-wrapper {
    justify-content: flex-end;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 0.375rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.message.assistant .message-avatar {
    background: var(--agent-accent);
}

.message.assistant .message-avatar img {
    width: 20px;
    height: 20px;
    filter: brightness(0) invert(1);
}

/* Model badge in avatar */
.message.assistant .message-avatar.model-badge {
    background: linear-gradient(135deg, var(--agent-accent) 0%, #2563eb 100%);
    color: white;
    font-weight: 600;
    font-size: 0.625rem;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    cursor: help;
}

.message.user .message-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
}

.message-content {
    max-width: 85%;
    min-width: 0;
}

.message.user .message-content {
    background: var(--agent-user-bubble);
    padding: 0.875rem 1rem;
    border-radius: 1rem 1rem 0 1rem;
}

.message.assistant .message-content {
    flex: 1;
}

.message-text {
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--agent-text-primary);
}

.message-text p {
    margin: 0 0 0.75rem;
}

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

.message-text pre {
    background: var(--agent-code-bg);
    border: 1px solid var(--agent-border);
    border-radius: 0.5rem;
    padding: 1rem;
    overflow-x: auto;
    margin: 0.75rem 0;
    font-size: 0.8125rem;
}

.message-text code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.85em;
}

.message-text code:not(pre code) {
    background: var(--agent-code-bg);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
}

.message-text ul, .message-text ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

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

.message-actions {
    display: flex;
    gap: 0.25rem;
    margin-top: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.message:hover .message-actions {
    opacity: 1;
}

.message-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    border-radius: 0.25rem;
    color: var(--agent-text-muted);
    cursor: pointer;
    transition: all 0.15s;
}

.message-action-btn:hover {
    background: var(--agent-input-bg);
    color: var(--agent-text-primary);
}

.message-action-btn i {
    width: 14px;
    height: 14px;
}

/* Tool Call Indicator */
.tool-call {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--agent-code-bg);
    border: 1px solid var(--agent-border);
    border-radius: 0.5rem;
    margin: 0.75rem 0;
    font-size: 0.8125rem;
    color: var(--agent-text-secondary);
}

.tool-call i {
    width: 14px;
    height: 14px;
    color: var(--agent-accent);
}

.tool-call-name {
    font-family: 'JetBrains Mono', monospace;
    color: var(--agent-accent);
}

/* Typing Indicator */
.typing-indicator {
    max-width: 768px;
    margin: 0 auto;
    padding: 0 1.5rem 1rem;
    display: flex;
    gap: 1rem;
}

.typing-avatar {
    width: 32px;
    height: 32px;
    background: var(--agent-accent);
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.typing-avatar img {
    width: 20px;
    height: 20px;
    filter: brightness(0) invert(1);
}

.typing-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--agent-text-muted);
    border-radius: 50%;
    animation: typingPulse 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingPulse {
    0%, 100% { opacity: 0.4; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1); }
}

.typing-text {
    font-size: 0.8125rem;
    color: var(--agent-text-muted);
}

/* ====================================
   Input Area
   ==================================== */
.input-area {
    padding: 1rem 1.5rem 1.5rem;
    background: linear-gradient(to top, var(--agent-bg) 70%, transparent);
}

.input-container {
    max-width: 768px;
    margin: 0 auto;
}

.input-client-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.5rem 0.375rem 0.75rem;
    background: var(--agent-accent);
    border-radius: 2rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: white;
    margin-bottom: 0.5rem;
}

.input-client-badge i {
    width: 14px;
    height: 14px;
}

.badge-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    transition: background 0.15s;
}

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

.badge-close i {
    width: 12px;
    height: 12px;
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--agent-input-bg);
    border: 1px solid var(--agent-input-border);
    border-radius: 1.5rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-wrapper:focus-within {
    border-color: var(--agent-accent);
    box-shadow: 0 0 0 2px rgba(16, 163, 127, 0.15);
}

.input-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: 1px solid var(--agent-border);
    border-radius: 50%;
    color: var(--agent-text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}

.input-action-btn:hover {
    background: var(--agent-sidebar-hover);
    color: var(--agent-text-primary);
}

.message-input {
    flex: 1;
    max-height: 200px;
    padding: 0.375rem 0;
    background: transparent;
    border: none;
    color: var(--agent-text-primary);
    font-size: 0.9375rem;
    font-family: inherit;
    line-height: 1.5;
    resize: none;
    outline: none;
}

.message-input::placeholder {
    color: var(--agent-text-muted);
}

.send-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--agent-text-muted);
    border: none;
    border-radius: 50%;
    color: var(--agent-bg);
    cursor: not-allowed;
    transition: all 0.15s;
    flex-shrink: 0;
}

.send-btn:not(:disabled) {
    background: var(--agent-accent);
    cursor: pointer;
}

.send-btn:not(:disabled):hover {
    background: var(--agent-accent-hover);
}

.send-btn i {
    width: 18px;
    height: 18px;
}

.input-hint {
    text-align: center;
    font-size: 0.75rem;
    color: var(--agent-text-muted);
    margin: 0.75rem 0 0;
}

/* ====================================
   Modal Styles
   ==================================== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 480px;
    background: var(--agent-sidebar-bg);
    border: 1px solid var(--agent-border);
    border-radius: 1rem;
    overflow: hidden;
    animation: modalIn 0.2s ease;
}

.modal-content.modal-lg {
    max-width: 560px;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

.modal-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--agent-text-primary);
    margin: 0;
}

.modal-title i {
    width: 20px;
    height: 20px;
    color: var(--agent-accent);
}

.modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 0.5rem;
    color: var(--agent-text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}

.modal-close:hover {
    background: var(--agent-sidebar-hover);
    color: var(--agent-text-primary);
}

.modal-body {
    padding: 1.25rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--agent-border);
}

/* Form Styles */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--agent-text-secondary);
    margin-bottom: 0.375rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.625rem 0.75rem;
    background: var(--agent-input-bg);
    border: 1px solid var(--agent-border);
    border-radius: 0.5rem;
    color: var(--agent-text-primary);
    font-size: 0.875rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--agent-accent);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-primary {
    background: var(--agent-accent);
    border: none;
    color: white;
}

.btn-primary:hover {
    background: var(--agent-accent-hover);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--agent-border);
    color: var(--agent-text-primary);
}

.btn-secondary:hover {
    background: var(--agent-sidebar-hover);
}

.btn i {
    width: 16px;
    height: 16px;
}

/* Context Menu */
.context-menu {
    position: fixed;
    z-index: 1001;
    min-width: 160px;
    background: var(--agent-sidebar-bg);
    border: 1px solid var(--agent-border);
    border-radius: 0.5rem;
    padding: 0.375rem;
    box-shadow: 0 4px 20px var(--agent-shadow);
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: transparent;
    border: none;
    border-radius: 0.375rem;
    color: var(--agent-text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.15s;
}

.context-menu-item:hover {
    background: var(--agent-sidebar-hover);
}

.context-menu-item.danger {
    color: #ef4444;
}

.context-menu-item.danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

.context-menu-item i {
    width: 16px;
    height: 16px;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 1002;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: var(--agent-sidebar-bg);
    border: 1px solid var(--agent-border);
    border-radius: 0.5rem;
    box-shadow: 0 4px 20px var(--agent-shadow);
    animation: toastIn 0.3s ease;
}

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

.toast.success {
    border-left: 3px solid var(--agent-accent);
}

.toast.error {
    border-left: 3px solid #ef4444;
}

.toast-icon {
    width: 20px;
    height: 20px;
}

.toast.success .toast-icon {
    color: var(--agent-accent);
}

.toast.error .toast-icon {
    color: #ef4444;
}

.toast-message {
    font-size: 0.875rem;
    color: var(--agent-text-primary);
}

/* Scrollbar Styles */
.chat-container::-webkit-scrollbar,
.sidebar-chats::-webkit-scrollbar {
    width: 8px;
}

.chat-container::-webkit-scrollbar-track,
.sidebar-chats::-webkit-scrollbar-track {
    background: transparent;
}

.chat-container::-webkit-scrollbar-thumb,
.sidebar-chats::-webkit-scrollbar-thumb {
    background: var(--agent-scrollbar);
    border-radius: 4px;
}

.chat-container::-webkit-scrollbar-thumb:hover,
.sidebar-chats::-webkit-scrollbar-thumb:hover {
    background: var(--agent-scrollbar-hover);
}

/* ====================================
   Responsive Styles
   ==================================== */
@media (max-width: 768px) {
    .agent-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 100;
        transform: translateX(-100%);
    }

    .agent-sidebar.open {
        transform: translateX(0);
    }

    .agent-mobile-header {
        display: flex;
    }

    .welcome-features {
        grid-template-columns: 1fr;
    }

    .feature-card {
        display: flex;
        align-items: flex-start;
        gap: 1rem;
    }

    .feature-icon {
        margin-bottom: 0;
    }

    .messages-list {
        padding: 0 1rem;
    }

    .input-area {
        padding: 0.75rem 1rem 1rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Mobile Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

.sidebar-overlay.active {
    display: block;
}
