/* =====================================================================
   AXONWA AGENT - MASTER DESIGN SYSTEM
   Theme: High-fidelity Clean Glassmorphic Light Theme (Modern Premium Slate)
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&family=Fira+Code:wght@400;500&display=swap');

:root {
    /* HSL Color System - Clean Light Palette */
    --bg-base: 210 30% 98%;
    /* Crisp Pale Blue-Gray */
    --bg-surface: 0 0% 100%;
    /* Pure White */
    --bg-surface-elevated: 210 20% 95%;
    /* Subtle Light Gray */
    --border-color: 210 16% 89%;
    /* Soft Border Gray */
    --border-glow: 215 90% 70%;

    /* Compatibility variables for legacy templates */
    --card: 0, 0%, 100%;
    --border: 210, 16%, 89%;

    --primary: 217 91% 56%;
    /* Vibrant Blue */
    --secondary: 203 89% 53%;
    /* Lighter Clean Tech Blue */
    --accent: 210 100% 45%;
    /* Deep Royal Blue */

    --text-primary: 220 20% 12%;
    /* Deep Slate Gray */
    --text-secondary: 220 12% 35%;
    /* Medium Slate Gray */
    --text-muted: 220 10% 55%;
    /* Soft Charcoal Gray */

    /* System Gradients */
    --grad-primary: linear-gradient(135deg, hsl(var(--primary)) 0%, hsl(var(--secondary)) 100%);
    --grad-accent: linear-gradient(135deg, hsl(var(--primary)) 0%, hsl(var(--accent)) 100%);
    --grad-dark: linear-gradient(180deg, #ffffff 0%, hsl(var(--bg-base)) 100%);
    --grad-glass: rgba(255, 255, 255, 0.75);

    /* Shadows & Glows */
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 10px 40px -15px rgba(15, 23, 42, 0.08);
    --shadow-glow: 0 4px 20px -2px hsla(var(--primary) / 0.2);

    /* Layout Tokens */
    --sidebar-collapsed-width: 72px;
    --sidebar-expanded-width: 260px;
    --header-height: 70px;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;

    --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --transition-fast: all 0.15s ease;
}

/* =====================================================================
   GLOBAL RESETS
   ===================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: hsl(var(--border-color)) transparent;
}

body {
    background-color: hsl(var(--bg-base));
    color: hsl(var(--text-primary));
    font-family: 'Inter', sans-serif;
    overflow-x: hidden;
    min-height: 100vh;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: hsl(var(--text-primary));
}

button,
input,
textarea,
select {
    font-family: inherit;
    color: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: hsla(var(--text-muted) / 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: hsla(var(--primary) / 0.4);
}

/* =====================================================================
   BACKGROUND EFFECT - Soft coordinate lines & light-mode dynamic color pools
   ===================================================================== */
.bg-grid-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -100;
    background-image:
        radial-gradient(circle at 10% 20%, hsla(var(--primary) / 0.05) 0%, transparent 40%),
        radial-gradient(circle at 85% 80%, hsla(var(--secondary) / 0.05) 0%, transparent 45%),
        linear-gradient(to right, hsla(var(--text-muted) / 0.05) 1px, transparent 1px),
        linear-gradient(to bottom, hsla(var(--text-muted) / 0.05) 1px, transparent 1px);
    background-size: 100% 100%, 100% 100%, 40px 40px, 40px 40px;
    opacity: 0.9;
}

/* =====================================================================
   LAYOUT STRUCTURE
   ===================================================================== */
.app-wrapper {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-left: var(--sidebar-collapsed-width);
    transition: var(--transition-smooth);
    min-width: 0;
    height: 100vh;
    overflow: hidden;
}

.app-wrapper.sidebar-open .main-content {
    margin-left: var(--sidebar-expanded-width);
}

/* Top Navigation Bar */
.top-nav {
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid hsla(var(--border-color) / 0.8);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-left h2 {
    font-size: 1.25rem;
    font-weight: 700;
    background: var(--grad-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-badge {
    background: #ffffff;
    border: 1px solid hsla(var(--border-color) / 0.8);
    box-shadow: var(--shadow-sm);
    padding: 6px 14px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: hsl(var(--text-secondary));
}

.user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--grad-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
    color: #fff;
}

.api-badge {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    border: 1px solid transparent;
}

.api-badge.active {
    background: hsla(142 70% 45% / 0.1);
    color: #1b8a5a;
    border-color: hsla(142 70% 45% / 0.2);
}

.api-badge.mock {
    background: hsla(38 90% 50% / 0.1);
    color: #b25900;
    border-color: hsla(38 90% 50% / 0.2);
}

/* =====================================================================
   SIDEBAR COMPONENT - Elegant Clean Glass Pane
   ===================================================================== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-collapsed-width);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-right: 1px solid hsla(var(--border-color) / 0.8);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: var(--transition-smooth);
    overflow: hidden;
}

.app-wrapper.sidebar-open .sidebar {
    width: var(--sidebar-expanded-width);
}

/* Sidebar Header */
.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid hsla(var(--border-color) / 0.4);
    position: relative;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    opacity: 0;
    transform: translateX(-10px);
    transition: var(--transition-smooth);
}

.app-wrapper.sidebar-open .brand {
    opacity: 1;
    transform: translateX(0);
}

.brand-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--grad-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-size: 1.1rem;
    color: #fff;
    box-shadow: var(--shadow-glow);
}

.brand-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.brand-name {
    font-size: 1.15rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, hsl(var(--text-primary)) 30%, hsl(var(--text-secondary)) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hamburger-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: hsl(var(--text-secondary));
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: var(--transition-fast);
    position: absolute;
    right: 20px;
}

.hamburger-btn:hover {
    background: hsla(var(--border-color) / 0.6);
    color: hsl(var(--text-primary));
}

/* Sidebar Menu Navigation */
.sidebar-nav {
    flex: 1;
    padding: 24px 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.menu-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    color: hsl(var(--text-muted));
    letter-spacing: 0.1em;
    margin-left: 12px;
    margin-bottom: 4px;
    opacity: 0;
    transition: var(--transition-fast);
}

.app-wrapper.sidebar-open .menu-label {
    opacity: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    color: hsl(var(--text-secondary));
    gap: 16px;
    transition: var(--transition-fast);
    cursor: pointer;
    position: relative;
    white-space: nowrap;
    border: 1px solid transparent;
}

.nav-item i {
    font-size: 1.15rem;
    width: 24px;
    text-align: center;
    transition: var(--transition-fast);
}

.nav-item span {
    font-size: 0.9rem;
    font-weight: 600;
    opacity: 0;
    transform: translateX(-10px);
    transition: var(--transition-smooth);
}

.app-wrapper.sidebar-open .nav-item span {
    opacity: 1;
    transform: translateX(0);
}

.app-wrapper.sidebar-open .superuser-badge {
    opacity: 1 !important;
}

.nav-item:hover {
    background: hsla(var(--border-color) / 0.5);
    color: hsl(var(--text-primary));
}

.nav-item:hover i {
    color: hsl(var(--primary));
    transform: scale(1.1);
}

.nav-item.active {
    background: hsla(var(--primary) / 0.08);
    color: hsl(var(--primary));
    border: 1px solid hsla(var(--primary) / 0.15);
}

.nav-item.active i {
    color: hsl(var(--primary));
}

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

/* =====================================================================
   DASHBOARD COMPONENT
   ===================================================================== */
.dashboard-container {
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.dashboard-hero {
    background: var(--grad-glass);
    border: 1px solid hsla(var(--border-color) / 0.6);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.dashboard-hero::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, hsla(var(--primary) / 0.08) 0%, transparent 70%);
    z-index: -1;
}

.hero-text h1 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 8px;
    background: linear-gradient(135deg, hsl(var(--text-primary)) 40%, hsl(var(--text-secondary)) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-text p {
    color: hsl(var(--text-secondary));
    font-size: 1.02rem;
    max-width: 600px;
    line-height: 1.5;
}

/* Cards Grid */
.agents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
}

.agent-card {
    background: var(--grad-glass);
    border: 1px solid hsla(var(--border-color) / 0.6);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.agent-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 100% 0%, hsla(var(--primary) / 0.04) 0%, transparent 50%);
    z-index: -1;
}

.agent-card:hover {
    transform: translateY(-5px);
    border-color: hsla(var(--primary) / 0.4);
    box-shadow: var(--shadow-md), 0 8px 24px -6px hsla(var(--primary) / 0.1);
}

.agent-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.agent-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: hsla(var(--primary) / 0.08);
    border: 1px solid hsla(var(--primary) / 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: hsl(var(--primary));
    transition: var(--transition-fast);
}

.agent-card:hover .agent-card-icon {
    background: var(--grad-primary);
    color: #fff;
    box-shadow: var(--shadow-glow);
    border-color: transparent;
}

.agent-card h3 {
    font-size: 1.25rem;
    font-weight: 700;
}

.agent-card p {
    color: hsl(var(--text-secondary));
    font-size: 0.9rem;
    line-height: 1.6;
    flex-grow: 1;
}

.btn-card-action {
    background: hsla(var(--border-color) / 0.6);
    border: 1px solid hsla(var(--border-color) / 0.9);
    color: hsl(var(--text-primary));
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: var(--transition-fast);
    width: 100%;
}

.agent-card:hover .btn-card-action {
    background: var(--grad-primary);
    border-color: transparent;
    color: #fff;
    box-shadow: var(--shadow-glow);
}

/* Dashboard Bottom Grid */
.dashboard-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

@media (max-width: 1024px) {
    .dashboard-row {
        grid-template-columns: 1fr;
    }
}

.panel-card {
    background: var(--grad-glass);
    border: 1px solid hsla(var(--border-color) / 0.6);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    backdrop-filter: blur(10px);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid hsla(var(--border-color) / 0.4);
    padding-bottom: 14px;
}

.panel-header h3 {
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-header h3 i {
    color: hsl(var(--primary));
}

/* Reminders List Styles */
.reminders-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 380px;
    overflow-y: auto;
    padding-right: 4px;
}

.reminder-item {
    background: #ffffff;
    border: 1px solid hsla(var(--border-color) / 0.6);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition-fast);
    gap: 12px;
}

.reminder-item:hover {
    border-color: hsla(var(--primary) / 0.3);
    background: hsla(var(--bg-surface-elevated) / 0.2);
}

.reminder-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.reminder-checkbox {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 2px solid hsla(var(--text-muted) / 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
    background: #fff;
}

.reminder-checkbox.checked {
    background: hsl(var(--primary));
    border-color: hsl(var(--primary));
}

.reminder-checkbox i {
    font-size: 0.65rem;
    color: #fff;
}

.reminder-details {
    display: flex;
    flex-direction: column;
}

.reminder-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: hsl(var(--text-primary));
    transition: var(--transition-fast);
}

.reminder-title.completed {
    text-decoration: line-through;
    color: hsl(var(--text-muted));
}

.reminder-due {
    font-size: 0.75rem;
    color: hsl(var(--text-muted));
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}

.btn-reminder-delete {
    background: none;
    border: none;
    color: hsl(var(--text-muted));
    cursor: pointer;
    transition: var(--transition-fast);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-reminder-delete:hover {
    color: hsl(var(--accent));
    background: rgba(255, 0, 0, 0.08);
}

/* Reminder Form Creator */
.reminder-form-inline {
    display: flex;
    gap: 8px;
}

.reminder-form-inline input {
    background: #ffffff;
    border: 1px solid hsla(var(--border-color) / 0.8);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    outline: none;
    color: hsl(var(--text-primary));
    transition: var(--transition-fast);
}

.reminder-form-inline input:focus {
    border-color: hsl(var(--primary));
    box-shadow: 0 0 10px -2px hsla(var(--primary) / 0.15);
}

.reminder-form-inline input[type="text"] {
    flex: 2;
}

.reminder-form-inline input[type="text"]::placeholder {
    color: hsl(var(--text-muted));
}

.reminder-form-inline input[type="text"].due-input {
    flex: 1;
}

.btn-reminder-add {
    background: var(--grad-primary);
    border: none;
    border-radius: var(--radius-sm);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-glow);
    transition: var(--transition-fast);
}

.btn-reminder-add:hover {
    transform: scale(1.05);
}

/* Recent Chats Panel */
.recent-chats-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.recent-chat-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    background: #ffffff;
    border: 1px solid hsla(var(--border-color) / 0.6);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.01);
    transition: var(--transition-fast);
}

.recent-chat-item:hover {
    background: hsla(var(--bg-surface-elevated) / 0.2);
    border-color: hsla(var(--primary) / 0.3);
}

.chat-item-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-item-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: hsla(var(--primary) / 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    color: hsl(var(--primary));
    font-size: 0.95rem;
}

.chat-item-name {
    font-size: 0.9rem;
    font-weight: 700;
}

.chat-item-meta {
    font-size: 0.75rem;
    color: hsl(var(--text-muted));
}

.btn-chat-resume {
    color: hsl(var(--primary));
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-chat-resume:hover {
    text-decoration: underline;
}

/* =====================================================================
   REAL-TIME CHAT PANEL (SPLIT LAYOUT)
   ===================================================================== */
.chat-container-split {
    display: flex;
    flex: 1;
    height: calc(100vh - var(--header-height));
    overflow: hidden;
}

/* Central Chat Screen */
.chat-main-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: radial-gradient(circle at 50% 10%, hsla(var(--primary) / 0.02) 0%, transparent 60%);
    position: relative;
    min-width: 0;
}

/* Chat Header */
.chat-agent-header {
    padding: 16px 32px;
    border-bottom: 1px solid hsla(var(--border-color) / 0.8);
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.agent-profile {
    display: flex;
    align-items: center;
    gap: 16px;
}

.agent-avatar {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--grad-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.25rem;
    box-shadow: var(--shadow-glow);
}

.agent-profile-text h3 {
    font-size: 1.05rem;
    font-weight: 700;
}

.agent-status {
    font-size: 0.72rem;
    color: hsl(var(--primary));
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 1px;
    font-weight: 600;
}

.agent-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: hsl(var(--primary));
    box-shadow: 0 0 8px hsl(var(--primary));
}

/* Chat Messages Viewport */
.chat-messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.message-wrapper {
    display: flex;
    gap: 16px;
    max-width: 85%;
    animation: messageReveal 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
}

@keyframes messageReveal {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.message-wrapper.agent {
    align-self: flex-start;
}

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

.message-wrapper.user .message-icon {
    background: var(--grad-primary);
    color: #fff;
    box-shadow: var(--shadow-glow);
}

.message-wrapper.agent .message-icon {
    background: hsla(var(--primary) / 0.08);
    color: hsl(var(--primary));
    border: 1px solid hsla(var(--primary) / 0.15);
}

.message-bubble {
    padding: 16px 20px;
    border-radius: var(--radius-md);
    line-height: 1.6;
    font-size: 0.95rem;
}

.message-wrapper.user .message-bubble {
    background: var(--grad-primary);
    color: #fff;
    border-bottom-right-radius: 2px;
    box-shadow: 0 4px 15px -3px hsla(var(--primary) / 0.35);
}

.message-wrapper.agent .message-bubble {
    background: #ffffff;
    border: 1px solid hsla(var(--border-color) / 0.8);
    box-shadow: var(--shadow-sm);
    color: hsl(var(--text-primary));
    border-bottom-left-radius: 2px;
    backdrop-filter: blur(5px);
}

/* Markdown parsing within bubble */
.message-bubble h1,
.message-bubble h2,
.message-bubble h3 {
    margin-bottom: 10px;
    font-size: 1.1rem;
    color: hsl(var(--text-primary));
}

.message-bubble p {
    margin-bottom: 12px;
}

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

.message-bubble ul,
.message-bubble ol {
    margin-left: 20px;
    margin-bottom: 12px;
}

.message-bubble li {
    margin-bottom: 4px;
}

/* Simulated Thoughts Box (OpenClaw style) - Clean Slate Light Mode Box */
.thought-box {
    margin-bottom: 16px;
    background: #f1f5f9;
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-left: 3px solid hsl(var(--primary));
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-family: 'Fira Code', monospace;
    font-size: 0.8rem;
    color: hsl(var(--text-secondary));
}

.thought-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    margin-bottom: 8px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: hsl(var(--primary));
}

.thought-content {
    line-height: 1.5;
    white-space: pre-wrap;
    opacity: 0.95;
}

/* Actions list box */
.actions-taken-box {
    display: none !important;
}

/* Typing Bubble Indicator */
.typing-indicator {
    display: flex;
    gap: 5px;
    align-items: center;
    justify-content: center;
    height: 20px;
    width: 40px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: hsl(var(--primary));
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typingBounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1.0);
    }
}

/* Chat Input Bar */
.chat-input-container {
    padding: 24px 32px;
    background: rgba(255, 255, 255, 0.7);
    border-top: 1px solid hsla(var(--border-color) / 0.8);
    backdrop-filter: blur(16px);
}

.chat-input-wrapper {
    background: #ffffff;
    border: 1px solid hsla(var(--border-color) / 0.9);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-md);
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition-smooth);
}

.chat-input-wrapper:focus-within {
    border-color: hsla(var(--primary) / 0.5);
    box-shadow: 0 0 20px -5px hsla(var(--primary) / 0.15);
}

.chat-input-wrapper textarea {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    resize: none;
    height: 44px;
    padding: 10px 0;
    font-size: 0.95rem;
    line-height: 1.5;
    color: hsl(var(--text-primary));
}

.chat-input-wrapper textarea::placeholder {
    color: hsl(var(--text-muted));
}

.btn-send-message {
    background: var(--grad-primary);
    border: none;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    box-shadow: var(--shadow-glow);
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.btn-send-message:hover {
    transform: scale(1.05);
}

.btn-send-message i {
    font-size: 0.95rem;
}

/* =====================================================================
   RIGHT PANEL: MARKDOWN FILE COCKPIT (SLIDING DRAWER)
   ===================================================================== */
.markdown-editor-panel {
    position: fixed;
    right: -480px;
    top: var(--header-height);
    width: 450px;
    height: calc(100vh - var(--header-height));
    background: #ffffff;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.05);
    border-left: 1px solid hsla(var(--border-color) / 0.8);
    transition: right 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 90;
    display: flex;
    flex-direction: column;
}

.markdown-editor-panel.open {
    right: 0;
}

.editor-header {
    padding: 16px 24px;
    border-bottom: 1px solid hsla(var(--border-color) / 0.8);
    background: hsla(var(--bg-base) / 0.3);
}

.editor-header h3 {
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
    color: hsl(var(--text-primary));
}

.editor-header h3 i {
    color: hsl(var(--primary));
}

/* Tabs switcher */
.editor-tabs {
    display: flex;
    background: hsla(var(--bg-base) / 0.8);
    border: 1px solid hsla(var(--border-color) / 0.8);
    border-radius: 8px;
    padding: 3px;
    margin-top: 14px;
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    color: hsl(var(--text-secondary));
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.tab-btn:hover {
    color: hsl(var(--text-primary));
}

.tab-btn.active {
    background: #ffffff;
    color: hsl(var(--primary));
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.02);
}

/* Editor Workspace */
.editor-workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 24px;
    gap: 16px;
    overflow: hidden;
}

.editor-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    font-weight: 700;
    color: hsl(var(--text-muted));
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.editor-status {
    font-size: 0.72rem;
    font-weight: 600;
    color: #1b8a5a;
    display: none;
    animation: pulse 1s infinite alternate;
}

@keyframes pulse {
    from {
        opacity: 0.5;
    }

    to {
        opacity: 1;
    }
}

.editor-textarea-wrapper {
    flex: 1;
    border: 1px solid hsla(var(--border-color) / 0.8);
    border-radius: var(--radius-sm);
    background: #f8fafc;
    padding: 16px;
    overflow: hidden;
    display: flex;
}

.editor-textarea-wrapper textarea {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    resize: none;
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    color: #475569;
    line-height: 1.6;
    overflow-y: auto;
}

.editor-textarea-wrapper textarea::placeholder {
    color: hsl(var(--text-muted));
}

.btn-save-file {
    background: var(--grad-primary);
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    box-shadow: var(--shadow-glow);
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-save-file:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow), 0 4px 12px hsla(var(--primary) / 0.2);
}

.btn-save-file i {
    font-size: 0.9rem;
}

/* =====================================================================
   PREMIUM GLASS LOGIN PAGE
   ===================================================================== */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: radial-gradient(circle at 10% 20%, hsla(var(--primary) / 0.05) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, hsla(var(--secondary) / 0.04) 0%, transparent 45%),
        hsl(var(--bg-base));
}

/* Split Layout Container */
.login-split-container {
    display: flex;
    width: 100vw;
    height: 100vh;
    min-height: 100vh;
    margin: 0;
    background: rgba(255, 255, 255, 0.75);
    border: none;
    border-radius: 0;
    box-shadow: none;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    overflow: hidden;
    position: relative;
    z-index: 10;
}

.login-split-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--grad-primary);
    z-index: 10;
}

/* Left Image Column */
.login-image-side {
    flex: 1.1;
    position: relative;
    background: linear-gradient(135deg, hsl(var(--primary)) 0%, hsl(var(--secondary)) 100%);
    padding: 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #ffffff;
    overflow: hidden;
    text-align: center;
}

.login-side-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.35;
    mix-blend-mode: overlay;
    z-index: 1;
}

/* Glassy grid effect on the image side */
.login-image-side::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.15) 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: 0.8;
    z-index: 1;
}

.login-side-content {
    position: relative;
    z-index: 2;
    max-width: 340px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.login-side-icon {
    font-size: 2.2rem;
    color: rgba(255, 255, 255, 0.95);
    background: rgba(255, 255, 255, 0.12);
    width: 70px;
    height: 70px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 8px;
    animation: pulseGlow 3s infinite ease-in-out;
}

@keyframes pulseGlow {

    0%,
    100% {
        box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.15), 0 0 15px rgba(255, 255, 255, 0.1);
        transform: scale(1);
    }

    50% {
        box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.25), 0 0 25px rgba(255, 255, 255, 0.3);
        transform: scale(1.05);
    }
}

.login-side-content h2 {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.login-side-content p {
    font-size: 0.92rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

/* Glowing aesthetic blobs inside image side */
.login-glow-1,
.login-glow-2 {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.6;
    z-index: 1;
}

.login-glow-1 {
    width: 250px;
    height: 250px;
    background: #1d4ed8;
    top: -50px;
    left: -50px;
}

.login-glow-2 {
    width: 300px;
    height: 300px;
    background: #60a5fa;
    bottom: -80px;
    right: -80px;
}

/* Right Form Column */
.login-form-side {
    flex: 1;
    padding: 48px;
    background: rgba(255, 255, 255, 0.65);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 28px;
    z-index: 2;
}

/* Responsive Rules */
@media (max-width: 768px) {
    .login-image-side {
        display: none;
    }

    .login-split-container {
        max-width: 100%;
        width: 100vw;
        height: 100vh;
        min-height: 100vh;
    }

    .login-form-side {
        padding: 36px 24px;
        background: rgba(255, 255, 255, 0.75);
    }
}

.login-header {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.login-logo {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--grad-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-size: 1.5rem;
    color: #fff;
    box-shadow: var(--shadow-glow);
    margin-bottom: 8px;
}

.login-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.login-header h1 {
    font-size: 1.8rem;
    font-weight: 800;
}

.login-header p {
    color: hsl(var(--text-secondary));
    font-size: 0.88rem;
}

/* Forms */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    color: hsl(var(--text-secondary));
    letter-spacing: 0.05em;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper i {
    position: absolute;
    left: 14px;
    color: hsl(var(--text-muted));
    font-size: 0.95rem;
}

.input-wrapper input,
.input-wrapper select {
    width: 100%;
    background: #ffffff;
    border: 1px solid hsla(var(--border-color) / 0.8);
    border-radius: var(--radius-sm);
    padding: 12px 14px 12px 42px;
    font-size: 0.9rem;
    outline: none;
    color: hsl(var(--text-primary));
    transition: var(--transition-smooth);
}

.input-wrapper input:focus,
.input-wrapper select:focus {
    border-color: hsl(var(--primary));
    box-shadow: 0 0 12px -2px hsla(var(--primary) / 0.15);
}

.login-error {
    background: rgba(255, 0, 0, 0.05);
    border: 1px solid rgba(255, 0, 0, 0.15);
    border-radius: 6px;
    padding: 10px 14px;
    color: #cc0000;
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-auth-submit {
    background: var(--grad-primary);
    border: none;
    padding: 14px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.95rem;
    color: #fff;
    cursor: pointer;
    box-shadow: var(--shadow-glow);
    transition: var(--transition-fast);
}

.btn-auth-submit:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow), 0 4px 12px hsla(var(--primary) / 0.2);
}

.auth-toggle {
    text-align: center;
    font-size: 0.85rem;
    color: hsl(var(--text-secondary));
}

.auth-toggle-link {
    color: hsl(var(--primary));
    font-weight: 600;
    cursor: pointer;
}

.auth-toggle-link:hover {
    text-decoration: underline;
}

/* =====================================================================
   SETTINGS PAGE STYLES
   ===================================================================== */
.settings-box {
    background: var(--grad-glass);
    border: 1px solid hsla(var(--border-color) / 0.6);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 600px;
    backdrop-filter: blur(10px);
}

.settings-box h2 {
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.settings-box h2 i {
    color: hsl(var(--primary));
}

.settings-box p {
    color: hsl(var(--text-secondary));
    font-size: 0.95rem;
    line-height: 1.6;
}

.settings-success {
    background: rgba(27, 138, 90, 0.08);
    border: 1px solid rgba(27, 138, 90, 0.2);
    border-radius: 6px;
    padding: 12px;
    color: #1b8a5a;
    font-size: 0.88rem;
    font-weight: 600;
}

/* Scroll to Bottom Button */
.btn-scroll-bottom {
    position: absolute;
    bottom: 110px;
    right: 32px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid hsla(var(--border-color) / 0.8);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    color: hsl(var(--primary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    cursor: pointer;
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), background-color 0.15s ease, color 0.15s ease;
    transform: translateY(15px);
}

.btn-scroll-bottom.show {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.btn-scroll-bottom:hover {
    background: hsl(var(--primary));
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

/* Clear Chat Button */
.btn-clear-chat {
    background: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #ef4444;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-clear-chat:hover {
    background: #ef4444;
    color: #ffffff;
    border-color: #ef4444;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
    transform: translateY(-1px);
}

/* Custom Agent Initializer Styling */
.add-agent-card:hover {
    border-color: hsl(var(--primary)) !important;
    background: hsla(var(--primary) / 0.02) !important;
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.add-agent-card:hover .agent-card-icon {
    background: hsl(var(--primary)) !important;
    color: #ffffff !important;
    transform: scale(1.05);
}

.modal-card {
    animation: modalSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

#createAgentForm input:focus,
#createAgentForm textarea:focus,
#createAgentForm select:focus {
    border-color: hsl(var(--primary)) !important;
    box-shadow: 0 0 0 3px hsla(var(--primary) / 0.15);
}

/* Workspace Edit/Preview Mode Buttons */
.mode-btn {
    border: none;
    background: transparent;
    font-family: 'Inter', sans-serif;
    color: hsl(var(--text-muted));
    cursor: pointer;
    transition: var(--transition-fast);
}

.mode-btn:hover {
    color: hsl(var(--primary));
}

.mode-btn.active {
    background: #ffffff !important;
    color: hsl(var(--primary)) !important;
    box-shadow: var(--shadow-sm);
}

.btn-delete-agent {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.btn-delete-agent:hover {
    background: #ef4444 !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35) !important;
    transform: scale(1.1) !important;
}