/* ============================================
   ATLAS AI - Premium Dark Theme CSS v2.1
   Mini Manus Premium UI - Enhanced Edition
   ============================================ */

:root {
    --bg-primary: #0f1117;
    --bg-secondary: #151820;
    --bg-card: #1a1d28;
    --bg-card-hover: #22263a;
    --bg-input: #1e2130;
    --bg-sidebar: #111420;
    --border-color: #2d3348;
    --border-light: #252a3a;
    --text-primary: #eaedf6;
    --text-secondary: #a0a8c0;
    --text-muted: #6b7394;
    --accent-primary: #6366f1;
    --accent-primary-hover: #818cf8;
    --accent-success: #22c55e;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    --accent-info: #06b6d4;
    --accent-purple: #a855f7;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.5);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --transition: all 0.2s ease;
    --gradient-primary: linear-gradient(135deg, var(--accent-primary), var(--accent-purple));
    --gradient-success: linear-gradient(135deg, #22c55e, #16a34a);
}

* { box-sizing: border-box; }

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent-primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent-primary-hover); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

/* ---- APP LAYOUT ---- */
.atlas-app {
    display: flex;
    min-height: 100vh;
}

/* ---- SIDEBAR ---- */
.atlas-sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    transition: transform 0.3s ease;
}

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

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 700;
}

.brand-icon {
    width: 36px;
    height: 36px;
    background: var(--gradient-primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.nav-section {
    padding: 0 12px;
    margin-bottom: 8px;
}

.nav-section-title {
    display: block;
    padding: 8px 12px 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
    margin: 1px 0;
}

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

.sidebar-nav .nav-link.active {
    background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(168,85,247,0.1));
    color: var(--accent-primary);
    border-left: 3px solid var(--accent-primary);
}

.sidebar-nav .nav-link i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar i { font-size: 1.8rem; color: var(--accent-primary); }
.user-details { flex: 1; }
.user-name { display: block; font-weight: 600; font-size: 0.85rem; }
.user-role { display: block; font-size: 0.7rem; color: var(--text-muted); }
.btn-logout { color: var(--text-muted); font-size: 1.1rem; }
.btn-logout:hover { color: var(--accent-danger); }

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 4px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

/* ---- MAIN ---- */
.atlas-main {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.atlas-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 100;
}

.page-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    flex: 1;
}

.header-badge {
    background: var(--bg-card);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.atlas-content {
    flex: 1;
    padding: 24px;
}

/* ---- CARDS ---- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card:hover {
    border-color: rgba(99,102,241,0.3);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 16px 20px;
    font-weight: 600;
}

.card-body { padding: 20px; }
.card-footer { background: transparent; border-top: 1px solid var(--border-color); padding: 12px 20px; }

/* ---- STAT CARDS ---- */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: rgba(99,102,241,0.3);
}

.stat-card-sm { padding: 14px 16px; }

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: white;
    flex-shrink: 0;
}

.stat-value { display: block; font-size: 1.5rem; font-weight: 800; line-height: 1.2; }
.stat-card-sm .stat-value { font-size: 1.2rem; }
.stat-label { display: block; font-size: 0.75rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }

/* ---- TABLES ---- */
.table { color: var(--text-primary); border-color: var(--border-color); }
.table thead th { background: var(--bg-secondary); border-bottom: 2px solid var(--border-color); font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); padding: 10px 16px; }
.table td { padding: 12px 16px; border-color: var(--border-color); vertical-align: middle; }
.table-hover tbody tr:hover { background: var(--bg-card-hover); }

/* ---- FORMS ---- */
.form-control, .form-select {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    background: var(--bg-input);
    border-color: var(--accent-primary);
    color: var(--text-primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

.form-control::placeholder { color: var(--text-muted); }
.form-label { font-weight: 500; font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 6px; }
.input-group-text { background: var(--bg-card); border-color: var(--border-color); color: var(--text-muted); }

/* ---- BUTTONS ---- */
.btn { border-radius: var(--radius-sm); font-weight: 500; transition: var(--transition); font-size: 0.875rem; padding: 8px 16px; }
.btn-primary { background: var(--accent-primary); border-color: var(--accent-primary); }
.btn-primary:hover { background: var(--accent-primary-hover); border-color: var(--accent-primary-hover); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99,102,241,0.3); }
.btn-success { background: var(--accent-success); border-color: var(--accent-success); }
.btn-outline-primary { color: var(--accent-primary); border-color: var(--accent-primary); }
.btn-outline-primary:hover { background: var(--accent-primary); color: white; }
.btn-outline-secondary { color: var(--text-secondary); border-color: var(--border-color); }
.btn-outline-secondary:hover { background: var(--bg-card); color: var(--text-primary); border-color: var(--text-muted); }

/* ---- BADGES ---- */
.badge { font-weight: 500; font-size: 0.7rem; padding: 4px 8px; border-radius: 4px; }
.bg-purple { background: var(--accent-purple) !important; }

/* ---- ALERTS ---- */
.alert { border-radius: var(--radius-sm); border: none; font-size: 0.875rem; }
.alert-success { background: rgba(34,197,94,0.1); color: var(--accent-success); border: 1px solid rgba(34,197,94,0.2); }
.alert-danger { background: rgba(239,68,68,0.1); color: var(--accent-danger); border: 1px solid rgba(239,68,68,0.2); }
.alert-info { background: rgba(6,182,212,0.1); color: var(--accent-info); border: 1px solid rgba(6,182,212,0.2); }
.btn-close { filter: invert(1); }

/* ---- EMPTY STATE ---- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 4rem;
    display: block;
    margin-bottom: 16px;
    opacity: 0.3;
}

/* ---- PROJECT CARD ---- */
.project-card {
    transition: var(--transition);
}
.project-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}
.project-card .card-title a { color: var(--text-primary); }
.project-card .card-title a:hover { color: var(--accent-primary); }

/* ---- PROGRESS ---- */
.progress { background: var(--bg-input); border-radius: 4px; }
.progress-bar { background: var(--accent-primary); border-radius: 4px; }

/* ---- PAGINATION ---- */
.pagination .page-link {
    background: var(--bg-card);
    border-color: var(--border-color);
    color: var(--text-secondary);
    font-size: 0.85rem;
    padding: 6px 12px;
    transition: var(--transition);
}
.pagination .page-link:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--accent-primary);
}
.pagination .page-item.active .page-link {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}
.pagination .page-item.disabled .page-link {
    background: var(--bg-input);
    color: var(--text-muted);
    border-color: var(--border-color);
}

/* ---- DROPDOWN ---- */
.dropdown-menu { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); }
.dropdown-item { color: var(--text-primary); padding: 8px 16px; font-size: 0.875rem; }
.dropdown-item:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.dropdown-divider { border-color: var(--border-color); }

/* ============================================
   CHAT LAYOUT - Enhanced v2.1
   ============================================ */
.chat-container {
    display: flex;
    height: calc(100vh - 120px);
    margin: -24px;
    border-radius: 0;
}

.chat-sidebar {
    width: 300px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

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

.chat-sidebar-header h6 { margin: 0; font-size: 0.85rem; }

.chat-sidebar-search {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-sidebar);
}
.chat-sidebar-search .input-group-text {
    background: var(--bg-input);
    border-color: var(--border-color);
    color: var(--text-muted);
    font-size: 0.75rem;
    padding: 4px 10px;
}
.chat-sidebar-search .form-control {
    background: var(--bg-input);
    border-color: var(--border-color);
    color: var(--text-primary);
    font-size: 0.8rem;
    padding: 4px 10px;
}
.chat-sidebar-search .form-control::placeholder {
    color: var(--text-muted);
    font-size: 0.8rem;
}
.chat-sidebar-search .form-control:focus {
    background: var(--bg-input);
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(99,102,241,0.15);
    color: var(--text-primary);
}
.chat-sidebar-search .btn-outline-secondary {
    border-color: var(--border-color);
    color: var(--text-muted);
    font-size: 0.75rem;
    padding: 4px 8px;
}
.chat-sidebar-search .btn-outline-secondary:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.chat-sidebar-list {
    flex: 1;
    overflow-y: auto;
}

.chat-sidebar-item {
    display: flex;
    flex-direction: column;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
    transition: var(--transition);
    text-decoration: none;
    gap: 4px;
}

.chat-sidebar-item:hover { background: var(--bg-card); color: var(--text-primary); }
.chat-sidebar-item.active {
    background: rgba(99,102,241,0.08);
    border-left: 3px solid var(--accent-primary);
    color: var(--text-primary);
}
.chat-sidebar-title { font-weight: 500; font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-sidebar-footer { padding: 12px; border-top: 1px solid var(--border-color); }

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

.chat-header {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    scroll-behavior: smooth;
}

.chat-welcome, .chat-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: var(--text-muted);
}

.chat-welcome-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    opacity: 0.8;
}

.chat-welcome-icon i {
    font-size: 2.5rem;
    color: white;
}

.chat-welcome h4, .chat-empty h4 {
    color: var(--text-primary);
    margin-bottom: 8px;
}

/* Chat suggestions */
.chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 20px;
    max-width: 600px;
    justify-content: center;
}

.chat-suggestion {
    font-size: 0.8rem !important;
    padding: 6px 14px !important;
    border-radius: 20px !important;
    white-space: nowrap;
}

.chat-suggestion:hover {
    transform: translateY(-1px);
}

/* Chat messages */
.chat-message {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    max-width: 85%;
    animation: messageIn 0.3s ease;
}

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

.chat-message.usuario { margin-left: auto; flex-direction: row-reverse; }
.chat-message.sistema { max-width: 100%; }
.chat-message.pinned .message-content {
    border-left: 3px solid var(--accent-warning);
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.chat-message.usuario .message-avatar { background: var(--accent-primary); color: white; }
.chat-message.ia .message-avatar { background: var(--gradient-primary); color: white; }
.chat-message.sistema .message-avatar { background: var(--accent-warning); color: white; }

.message-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    min-width: 200px;
    position: relative;
}

.chat-message.usuario .message-content {
    background: rgba(99,102,241,0.08);
    border-color: rgba(99,102,241,0.2);
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.message-sender { font-weight: 600; font-size: 0.8rem; }
.message-time { font-size: 0.7rem; color: var(--text-muted); }
.message-body { font-size: 0.9rem; line-height: 1.7; word-wrap: break-word; }
.message-body pre {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px;
    overflow-x: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    position: relative;
    margin: 8px 0;
}
.message-body code { font-family: 'JetBrains Mono', monospace; font-size: 0.85em; }
.message-meta { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border-light); }

/* Message actions */
.msg-actions { opacity: 0; transition: var(--transition); }
.message-content:hover .msg-actions,
.msg-actions.show { opacity: 1; }
.msg-action-btn:hover { color: var(--accent-primary) !important; }

/* Code copy button */
.code-copy-btn {
    position: absolute !important;
    top: 6px;
    right: 6px;
    background: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-muted) !important;
    font-size: 0.7rem !important;
    padding: 3px 8px !important;
    border-radius: 4px !important;
    opacity: 0;
    transition: var(--transition);
    z-index: 5;
}
.message-body pre:hover .code-copy-btn { opacity: 1; }
.code-copy-btn:hover { color: var(--accent-primary) !important; border-color: var(--accent-primary) !important; }

/* Attachment chips */
.message-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}

.attachment-chip:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* Attachment preview */
.attachment-preview {
    padding: 8px 0;
}

.attachment-item {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Processing status bar */
.chat-processing-bar {
    background: rgba(99,102,241,0.05);
    border-bottom: 1px solid rgba(99,102,241,0.15);
    flex-shrink: 0;
}

/* Chat input */
.chat-input {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.chat-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.chat-input textarea {
    resize: none;
    min-height: 44px;
    max-height: 150px;
}

.chat-input .btn { height: 44px; width: 44px; padding: 0; display: flex; align-items: center; justify-content: center; }

/* ---- AUTH ---- */
.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-primary);
}

.auth-container { width: 100%; max-width: 420px; padding: 20px; }

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px 32px;
    box-shadow: var(--shadow-lg);
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo i {
    font-size: 3rem;
    color: var(--accent-primary);
    display: block;
    margin-bottom: 12px;
}

.auth-logo h1 {
    font-size: 1.8rem;
    font-weight: 800;
    margin: 0;
}

.auth-logo p { margin: 4px 0 0; }

/* ---- RESPONSIVE ---- */
@media (max-width: 991.98px) {
    .atlas-sidebar {
        transform: translateX(-100%);
    }
    .atlas-sidebar.show {
        transform: translateX(0);
    }
    .atlas-sidebar.show + .atlas-main .sidebar-overlay,
    .sidebar-overlay.show {
        display: block;
    }
    .atlas-main {
        margin-left: 0;
    }
    .chat-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 1001;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    .chat-sidebar.show {
        transform: translateX(0);
    }
    .chat-message { max-width: 95%; }
}

@media (max-width: 575.98px) {
    .atlas-content { padding: 16px; }
    .stat-value { font-size: 1.2rem; }
    .chat-suggestions { flex-direction: column; align-items: center; }
}

/* ---- LIST GROUP ---- */
.list-group-item {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-primary);
}

/* ---- PROVIDER ITEM ---- */
.provider-item {
    background: var(--bg-input);
    border: 1px solid var(--border-light);
}

/* ---- CODE ---- */
code {
    background: var(--bg-input);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.85em;
    color: var(--accent-info);
}

pre {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 16px;
    color: var(--text-primary);
    overflow-x: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
}

/* ---- FORM CHECK ---- */
.form-check-input {
    background-color: var(--bg-input);
    border-color: var(--border-color);
}
.form-check-input:checked {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
}

/* ---- MODAL ---- */
.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}
.modal-header { border-color: var(--border-color); }
.modal-footer { border-color: var(--border-color); }

/* ---- TOAST ANIMATION ---- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---- SKELETON LOADING ---- */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

/* ---- TYPING INDICATOR ---- */
.typing-indicator {
    display: inline-flex;
    gap: 4px;
    padding: 8px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typing 1.4s infinite;
}

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

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* ---- SMOOTH TRANSITIONS ---- */
.fade-in {
    animation: fadeIn 0.3s ease;
}

/* ---- SEARCH HIGHLIGHT ---- */
.search-highlight {
    background: rgba(245, 158, 11, 0.3);
    padding: 1px 3px;
    border-radius: 2px;
}

/* ============================================
   ATLAS AI v2.2 - Advanced Features CSS
   Terminal, Monaco Editor, Web Search, Streaming
   ============================================ */

/* ---- CHAT CONTENT AREA (split layout) ---- */
.chat-content-area {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.chat-content-area .chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    min-width: 0;
}

/* ---- TOOLS SIDE PANEL ---- */
.chat-tools-panel {
    width: 45%;
    max-width: 600px;
    min-width: 350px;
    border-left: 1px solid var(--border-color);
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideInRight 0.3s ease;
}

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

.tools-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
    flex-shrink: 0;
}

.tools-panel-tabs {
    display: flex;
    gap: 4px;
}

.tools-tab {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.tools-tab:hover {
    background: var(--bg-input);
    color: var(--text-secondary);
}

.tools-tab.active {
    background: rgba(99,102,241,0.15);
    color: var(--accent-primary);
}

.tools-tab-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ---- TERMINAL ---- */
.terminal-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
    flex-shrink: 0;
}

.terminal-editor-area {
    flex: 1;
    min-height: 120px;
    display: flex;
}

.terminal-code-input {
    width: 100%;
    background: #0d0f14;
    color: #e0e0e0;
    border: none;
    padding: 12px;
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 13px;
    line-height: 1.6;
    resize: none;
    outline: none;
    tab-size: 4;
}

.terminal-code-input::placeholder {
    color: #555;
}

.terminal-output-area {
    flex-shrink: 0;
    max-height: 200px;
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--border-color);
}

.terminal-output-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.terminal-output {
    background: #0d0f14;
    color: #a0a8c0;
    padding: 12px;
    margin: 0;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 12px;
    line-height: 1.5;
    overflow-y: auto;
    flex: 1;
    white-space: pre-wrap;
    word-break: break-all;
    border: none;
    border-radius: 0;
}

.terminal-output.success {
    color: var(--accent-success);
}

.terminal-output.error {
    color: var(--accent-danger);
}

/* ---- CODE RUN BUTTON ---- */
.code-run-btn {
    position: absolute !important;
    top: 6px;
    right: 42px;
    background: rgba(34,197,94,0.15) !important;
    border: 1px solid rgba(34,197,94,0.3) !important;
    color: var(--accent-success) !important;
    font-size: 0.7rem !important;
    padding: 3px 8px !important;
    border-radius: 4px !important;
    opacity: 0;
    transition: var(--transition);
    z-index: 5;
}

.message-body pre:hover .code-run-btn {
    opacity: 1;
}

.code-run-btn:hover {
    background: rgba(34,197,94,0.3) !important;
    border-color: var(--accent-success) !important;
}

/* ---- CHAT TOOL PANEL (Web Search, etc.) ---- */
.chat-tool-panel {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    animation: slideDown 0.2s ease;
}

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

.web-search-result:hover {
    background: var(--bg-card-hover) !important;
}

/* ---- STREAMING CURSOR ---- */
.streaming-cursor-blink {
    animation: blink 0.8s infinite;
    color: var(--accent-primary);
    font-weight: bold;
}

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

/* ---- MONACO EDITOR CONTAINER ---- */
#monacoEditorContainer {
    background: #1a1d23;
}

#monacoEditorContainer .monaco-editor {
    border-radius: 0;
}

/* ---- FORM SWITCH DARK THEME ---- */
.form-switch .form-check-input {
    background-color: var(--bg-input);
    border-color: var(--border-color);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23666'/%3e%3c/svg%3e");
}

.form-switch .form-check-input:checked {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
}

/* ---- DROPDOWN DARK THEME ---- */
.dropdown-menu {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
}

.dropdown-item {
    color: var(--text-secondary);
    font-size: 0.85rem;
    padding: 8px 16px;
}

.dropdown-item:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

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

.dropdown-divider {
    border-color: var(--border-color);
}

/* ---- RESPONSIVE TOOLS PANEL ---- */
@media (max-width: 991.98px) {
    .chat-tools-panel {
        position: fixed;
        right: 0;
        top: 0;
        bottom: 0;
        z-index: 1002;
        width: 100%;
        max-width: 100%;
        min-width: auto;
    }
}

@media (min-width: 992px) and (max-width: 1199.98px) {
    .chat-tools-panel {
        width: 50%;
        min-width: 300px;
    }
}

/* ---- TOAST NOTIFICATION ---- */
.atlas-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    animation: fadeIn 0.3s ease;
    box-shadow: var(--shadow-lg);
}

.atlas-toast.success {
    background: rgba(34,197,94,0.15);
    color: var(--accent-success);
    border: 1px solid rgba(34,197,94,0.3);
}

.atlas-toast.error {
    background: rgba(239,68,68,0.15);
    color: var(--accent-danger);
    border: 1px solid rgba(239,68,68,0.3);
}

.atlas-toast.info {
    background: rgba(6,182,212,0.15);
    color: var(--accent-info);
    border: 1px solid rgba(6,182,212,0.3);
}
