/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

:root {
    --primary: #10a37f;
    --primary-dark: #0d8b6a;
    --primary-light: #1ab99a;
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #1c2333;
    --bg-hover: #2d3748;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #484f58;
    --border-color: #30363d;
    --shadow-color: rgba(0, 0, 0, 0.4);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --scrollbar-track: #161b22;
    --scrollbar-thumb: #30363d;
    --message-user-bg: #1c2333;
    --message-assistant-bg: #161b22;
    --success: #10a37f;
    --error: #f85149;
    --warning: #d29922;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f6f8fa;
    --bg-tertiary: #f0f2f5;
    --bg-hover: #e1e4e8;
    --text-primary: #24292f;
    --text-secondary: #57606a;
    --text-muted: #8b949e;
    --border-color: #d0d7de;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --glass-bg: rgba(0, 0, 0, 0.03);
    --glass-border: rgba(0, 0, 0, 0.08);
    --scrollbar-track: #f6f8fa;
    --scrollbar-thumb: #d0d7de;
    --message-user-bg: #f0f2f5;
    --message-assistant-bg: #ffffff;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    display: flex;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}
::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 280px;
    min-width: 280px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    transform: translateX(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s ease;
}

.sidebar.collapsed {
    transform: translateX(-280px);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.logo {
    width: 32px;
    height: 32px;
    animation: pulse-glow 2s ease-in-out infinite;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.new-chat-btn {
    width: 100%;
    padding: 10px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
}

.new-chat-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.02);
    box-shadow: 0 0 20px rgba(16, 163, 127, 0.3);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section h3 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.conversations-header {
    margin-bottom: 8px;
}

.clear-history-btn,
.create-agent-btn {
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.clear-history-btn {
    padding: 6px 10px;
    border-radius: 8px;
    background: rgba(248, 81, 73, 0.12);
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 600;
}

.clear-history-btn:hover {
    background: rgba(248, 81, 73, 0.2);
}

.create-agent-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.create-agent-btn:hover {
    transform: rotate(90deg);
    box-shadow: 0 0 15px rgba(16, 163, 127, 0.4);
}

.chat-history-item,
.agent-item {
    padding: 10px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
    transition: var(--transition);
}

.chat-history-item:hover,
.agent-item:hover {
    background: var(--bg-hover);
}

.chat-history-item {
    position: relative;
    padding-right: 34px;
}

.chat-history-item.active,
.agent-item.active {
    background: var(--bg-hover);
    border-left: 3px solid var(--primary);
}

.chat-history-item .delete-chat-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    width: 22px;
    height: 22px;
    font-size: 14px;
}

.chat-history-item .delete-chat-btn:hover {
    background: rgba(248, 81, 73, 0.15);
    color: var(--error);
}

.agent-item .agent-avatar {
    font-size: 20px;
}

.agent-item .agent-name {
    flex: 1;
    font-size: 14px;
}

.agent-item .agent-actions {
    display: flex;
    gap: 4px;
}

.agent-item .agent-actions button {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: var(--transition);
}

.agent-item .agent-actions button:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toggle-theme-btn {
    padding: 8px 12px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    font-size: 13px;
}

.toggle-theme-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.logout-btn {
    padding: 8px 12px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    font-size: 13px;
}

.logout-btn:hover {
    background: rgba(248, 81, 73, 0.12);
    color: var(--error);
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    margin-left: 280px;
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--bg-primary);
    transition: margin-left 0.3s ease;
}

.sidebar.collapsed ~ .main-content {
    margin-left: 0;
}

/* ===== CHAT HEADER ===== */
.chat-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-secondary);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius);
    transition: var(--transition);
}

.sidebar-toggle:hover {
    background: var(--bg-hover);
}

.agent-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.agent-avatar {
    font-size: 28px;
    animation: float 3s ease-in-out infinite;
}

.agent-select {
    padding: 8px 12px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    min-width: 180px;
}

.agent-select:hover {
    border-color: var(--primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.profile-menu-wrapper {
    position: relative;
}

.profile-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: 40px;
    height: 40px;
    padding: 4px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-primary);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.profile-menu-toggle:hover {
    background: #21262d;
    border-color: transparent;
}

.profile-menu-toggle:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.github-profile-avatar {
    width: 32px;
    height: 32px;
    display: block;
    border-radius: 50%;
    object-fit: cover;
    background: #30363d;
}

.profile-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: min(320px, calc(100vw - 16px));
    max-height: calc(100dvh - 76px);
    overflow-y: auto;
    background: #161b22;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(1, 4, 9, 0.45);
    padding: 8px;
    z-index: 991;
}

.profile-menu[hidden] {
    display: none;
}

.profile-menu-header {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    padding: 4px 4px 4px 8px;
}

.profile-menu-avatar {
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
    border-radius: 50%;
    object-fit: cover;
    background: #30363d;
}

.profile-menu-identity {
    min-width: 0;
    flex: 1;
    display: grid;
    gap: 2px;
}

.profile-menu-identity strong,
.profile-menu-identity span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-menu-identity strong {
    color: #f0f6fc;
    font-size: 14px;
    font-weight: 600;
}

.profile-menu-identity span {
    color: #8b949e;
    font-size: 12px;
}

.profile-menu-close {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #8b949e;
    cursor: pointer;
}

.profile-menu-close:hover {
    background: #21262d;
    color: #f0f6fc;
}

.profile-menu-close svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.menu-item {
    width: 100%;
    min-height: 32px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    text-align: left;
    padding: 6px 8px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    transition: var(--transition);
}

.menu-item:hover {
    background: #2f81f7;
    color: #ffffff;
}

.plan-menu-label {
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
}

.plan-free { background: rgba(46, 160, 67, 0.18); color: #3fb950; }
.plan-pro { background: rgba(88, 166, 255, 0.18); color: #58a6ff; }
.plan-enterprise { background: rgba(188, 140, 255, 0.18); color: #bc8cff; }

.menu-item:focus-visible {
    outline: 2px solid #58a6ff;
    outline-offset: -2px;
}

.menu-icon {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.menu-item-upgrade {
    color: var(--text-primary);
    background: transparent;
}

.menu-item-danger {
    color: var(--text-primary);
}

.menu-divider {
    height: 1px;
    background: #30363d;
    margin: 7px -8px;
}

.plans-modal {
    width: min(920px, 94vw);
    max-height: min(720px, 88vh);
    overflow-y: auto;
}

.plans-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    padding: 18px 20px;
}

.plan-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 310px;
    padding: 20px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
}

.plan-card.current { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.plan-card.popular { border-color: #d29922; }
.plan-card h3 { font-size: 18px; margin-bottom: 12px; }
.plan-price { font-size: 24px; color: var(--text-primary); }
.plan-price small { color: var(--text-secondary); font-size: 12px; font-weight: 400; }
.plan-card ul { list-style: none; margin: 18px 0; padding: 0; flex: 1; }
.plan-card li { padding: 8px 0; border-bottom: 1px solid var(--border-color); color: var(--text-secondary); font-size: 12px; }
.plan-card button { border: 0; border-radius: 6px; padding: 10px; background: var(--primary); color: #fff; cursor: pointer; font-weight: 700; }
.plan-card button:disabled { background: var(--bg-hover); color: var(--text-secondary); cursor: default; }
.plan-tag { position: absolute; top: -10px; right: 14px; border-radius: 999px; padding: 4px 8px; background: #d29922; color: #111; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.plans-message { min-height: 22px; padding: 0 20px 20px; color: var(--text-secondary); font-size: 13px; }

@media (max-width: 760px) { .plans-grid { grid-template-columns: 1fr; } .plan-card { min-height: auto; } }

.clear-chat-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 20px;
    padding: 4px 8px;
    border-radius: var(--radius);
    transition: var(--transition);
}

.clear-chat-btn:hover {
    color: var(--error);
    background: var(--bg-hover);
}

/* ===== CHAT CONTAINER ===== */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.messages-wrapper {
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    padding: 60px 20px;
    animation: fadeInUp 0.6s ease;
}

.welcome-icon {
    font-size: 72px;
    margin-bottom: 24px;
    display: inline-block;
    animation: float 3s ease-in-out infinite;
}

.welcome-message h2 {
    font-size: 28px;
    margin-bottom: 12px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-message p {
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 32px;
}

.quick-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.quick-action {
    padding: 10px 20px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
    backdrop-filter: blur(10px);
}

.quick-action:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(16, 163, 127, 0.3);
}

/* ===== MESSAGES ===== */
.message {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    margin-bottom: 16px;
    border-radius: var(--radius-lg);
    animation: slideIn 0.4s ease;
}

.message-user {
    background: var(--primary);
    color: white;
    margin-left: auto;
    max-width: 85%;
    border-radius: 18px 18px 4px 18px;
    border: none;
}

.message-user .message-content {
    color: white;
}

.message-user .message-time {
    color: rgba(255, 255, 255, 0.7);
}

.message-assistant {
    background: var(--message-assistant-bg);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--primary);
    max-width: 85%;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    background: var(--bg-tertiary);
}

.message-user .message-avatar {
    display: none;
}

.message-content {
    flex: 1;
    line-height: 1.6;
    word-wrap: break-word;
}

.message-content p {
    margin-bottom: 8px;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content pre {
    background: var(--bg-tertiary);
    padding: 12px;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 8px 0;
    border: 1px solid var(--border-color);
}

.message-content code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

.message-content ul,
.message-content ol {
    padding-left: 24px;
    margin: 8px 0;
}

.message-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
    display: block;
}

.message-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.message-actions button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    transition: var(--transition);
}

.message-actions button:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.message-user .message-actions button {
    color: rgba(255, 255, 255, 0.7);
}

.message-user .message-actions button:hover {
    color: white;
    background: rgba(255, 255, 255, 0.2);
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typing-bounce 1.4s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}
.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

/* ===== INPUT AREA ===== */
.input-area {
    padding: 24px 24px 32px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.attachment-preview {
    width: 100%;
    max-width: 900px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    min-height: 0;
}

.attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 12px;
    max-width: 220px;
}

.attachment-chip img {
    width: 28px;
    height: 28px;
    object-fit: cover;
    border-radius: 8px;
}

.attachment-chip .remove-attachment {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
    padding: 0 2px;
}

.attachment-chip .remove-attachment:hover {
    color: var(--error);
}

.input-wrapper {
    display: flex;
    gap: 12px;
    background: var(--bg-secondary);
    border-radius: 24px;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    transition: var(--transition);
    width: 100%;
    max-width: 900px;
}

.input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(16, 163, 127, 0.2);
}

.attach-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.attach-btn:hover {
    border-color: var(--primary);
    background: rgba(16, 163, 127, 0.08);
}

#messageInput {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    resize: none;
    outline: none;
    padding: 8px 0;
    font-family: inherit;
    max-height: 150px;
    line-height: 1.5;
}

#messageInput::placeholder {
    color: var(--text-muted);
}

.send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.send-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(16, 163, 127, 0.4);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.input-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
    font-size: 12px;
    color: var(--text-muted);
    padding: 0 20px;
    width: 100%;
    max-width: 900px;
}

/* ===== MODAL ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    max-width: 560px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 60px var(--shadow-color);
    animation: scaleIn 0.3s ease;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 20px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius);
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
    transition: var(--transition);
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

.form-group input[type="range"] {
    padding: 0;
    background: transparent;
    -webkit-appearance: none;
}

.form-group input[type="range"]::-webkit-slider-runnable-track {
    height: 4px;
    background: var(--bg-hover);
    border-radius: 2px;
}

.form-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    margin-top: -6px;
}

.form-group input[type="color"] {
    padding: 4px;
    height: 44px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn-primary,
.btn-secondary {
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(16, 163, 127, 0.3);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes float {
    0%,
    100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes pulse-glow {
    0%,
    100% {
        filter: drop-shadow(0 0 0px rgba(16, 163, 127, 0));
    }
    50% {
        filter: drop-shadow(0 0 10px rgba(16, 163, 127, 0.5));
    }
}

@keyframes pulse-dot {
    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(0.8);
        opacity: 0.5;
    }
}

@keyframes pulse-dot-loading {
    0%,
    100% {
        transform: scale(1);
        opacity: 1;
        background: var(--warning);
    }
    50% {
        transform: scale(1.3);
        opacity: 0.7;
        background: var(--warning);
    }
}

@keyframes typing-bounce {
    0%,
    60%,
    100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .sidebar {
        width: 240px;
        min-width: 240px;
    }
    .main-content {
        margin-left: 240px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-280px);
        width: 280px;
        min-width: 280px;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: block;
    }

    .main-content {
        margin-left: 0;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .chat-header {
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .chat-container {
        padding: 16px;
    }

    .input-area {
        padding: 12px 16px;
    }

    .quick-actions {
        flex-direction: column;
        align-items: center;
    }

    .quick-action {
        width: 100%;
        text-align: center;
    }

    .agent-select {
        min-width: 120px;
        font-size: 12px;
    }

    .message {
        padding: 12px 16px;
    }

    .modal-content {
        width: 95%;
        margin: 10px;
    }

}

@media (max-width: 480px) {
    .agent-selector {
        flex-direction: column;
        gap: 4px;
    }

    .agent-select {
        min-width: 100px;
    }

    .welcome-message h2 {
        font-size: 22px;
    }

    .welcome-icon {
        font-size: 48px;
    }

    .chat-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-right {
        width: 100%;
        justify-content: flex-end;
    }
}