/* Agent Gateway — Base Styles */

:root {
    --bg: #f5f5f5;
    --sidebar-bg: #1a1a2e;
    --sidebar-text: #e0e0e0;
    --sidebar-active: #16213e;
    --primary: #2B7DE9;
    --primary-hover: #1a5fc4;
    --text: #333;
    --text-muted: #888;
    --border: #ddd;
    --msg-user-bg: #2B7DE9;
    --msg-user-text: #fff;
    --msg-agent-bg: #fff;
    --msg-agent-text: #333;
    --card-bg: #fff;
    --error: #e74c3c;
    --radius: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
}

/* --- Login --- */

.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.login-card {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.login-title {
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 0.25rem;
}

.login-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.login-switch {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.login-switch a {
    color: var(--primary);
    text-decoration: none;
    margin-left: 0.25rem;
}

/* --- Forms --- */

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

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: var(--text);
}

.form-group input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: var(--primary);
}

.error-msg {
    background: #fde8e8;
    color: var(--error);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

/* --- Buttons --- */

.btn {
    cursor: pointer;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    padding: 0.6rem 1.2rem;
    transition: background 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    width: 100%;
}

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

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-small {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    background: rgba(255,255,255,0.1);
    color: var(--sidebar-text);
    border: 1px solid rgba(255,255,255,0.15);
}

.btn-small:hover {
    background: rgba(255,255,255,0.2);
}

.btn-muted {
    color: var(--text-muted);
}

/* --- App Layout --- */

.app {
    display: flex;
    height: 100vh;
}

/* --- Sidebar --- */

.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand-name {
    font-size: 1.1rem;
    font-weight: 600;
}

.sidebar-section {
    padding: 0.75rem 1rem;
}

.sidebar-section h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255,255,255,0.4);
    margin-bottom: 0.5rem;
}

.agent-list, .conv-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.agent-item, .conv-item {
    padding: 0.5rem 0.6rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.15s;
}

.agent-item:hover, .conv-item:hover {
    background: var(--sidebar-active);
}

.agent-item.active, .conv-item.active {
    background: var(--primary);
    color: #fff;
}

.agent-item .agent-desc {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.5);
    margin-top: 2px;
}

.conv-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.conv-item .conv-delete {
    opacity: 0;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    padding: 2px 4px;
}

.conv-item:hover .conv-delete {
    opacity: 1;
}

.sidebar-footer {
    margin-top: auto;
    padding: 0.75rem 1rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
}

.sidebar-section .conv-list {
    max-height: calc(100vh - 400px);
    overflow-y: auto;
}

/* --- Chat Area --- */

.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.chat-header {
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--card-bg);
}

.chat-header h2 {
    font-size: 1rem;
    font-weight: 500;
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.welcome-message {
    margin: auto;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.message {
    max-width: 75%;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

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

.message-agent {
    background: var(--msg-agent-bg);
    color: var(--msg-agent-text);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.message-typing {
    color: var(--text-muted);
    font-style: italic;
}

/* --- Chat Input --- */

.chat-input {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--card-bg);
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

.chat-input textarea {
    flex: 1;
    resize: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.6rem 0.75rem;
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    max-height: 120px;
    transition: border-color 0.2s;
}

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

.chat-input .btn {
    width: auto;
    padding: 0.6rem 1.5rem;
}
