/* =============================================================================
   SSC AI Agents - Modern Light/Corporate Design System
   Clean, Professional Theme Matching Main Dashboard
   ============================================================================= */

/* -----------------------------------------------------------------------------
   CSS Custom Properties (Design Tokens) - Light Corporate Theme
   ----------------------------------------------------------------------------- */
:root {
    /* Primary Brand Colors - SSC Teal/Cyan */
    --color-primary: #00ACC1;
    --color-primary-light: #26C6DA;
    --color-primary-dark: #0097A7;
    --color-primary-bg: #E0F7FA;

    /* Secondary/Accent - Purple */
    --color-secondary: #7E57C2;
    --color-secondary-light: #9575CD;
    --color-secondary-bg: #EDE7F6;

    /* Neutral Colors - Light Theme */
    --color-white: #FFFFFF;
    --color-gray-50: #F5F7FA;
    --color-gray-100: #F1F5F9;
    --color-gray-200: #E2E8F0;
    --color-gray-300: #CBD5E1;
    --color-gray-400: #94A3B8;
    --color-gray-500: #64748B;
    --color-gray-600: #475569;
    --color-gray-700: #334155;
    --color-gray-800: #1E293B;
    --color-gray-900: #0F172A;

    /* Text Colors */
    --text-heading: #2D3748;
    --text-body: #4A5568;
    --text-muted: #718096;
    --text-light: #A0AEC0;
    --text-on-primary: #FFFFFF;

    /* Background Colors */
    --bg-primary: #FFFFFF;
    --bg-secondary: #F5F7FA;
    --bg-tertiary: #EDF2F7;
    --bg-elevated: #FFFFFF;
    --bg-hover: #E2E8F0;
    --bg-active: #CBD5E1;
    --bg-chat: #F7FAFC;

    /* Border Colors */
    --border-default: #E2E8F0;
    --border-light: #EDF2F7;
    --border-focus: #00ACC1;

    /* Semantic Colors */
    --color-success: #38A169;
    --color-success-bg: #C6F6D5;
    --color-warning: #D69E2E;
    --color-warning-bg: #FEFCBF;
    --color-error: #E53E3E;
    --color-error-bg: #FED7D7;
    --color-info: #3182CE;
    --color-info-bg: #BEE3F8;

    /* Quick Action Card Colors */
    --color-orange: #ED8936;
    --color-purple: #9F7AEA;
    --color-green: #48BB78;
    --color-blue: #4299E1;

    /* Typography */
    --font-display: 'Cairo', 'Tajawal', 'Noto Kufi Arabic', sans-serif;
    --font-body: 'Cairo', 'Tajawal', 'Readex Pro', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Font Sizes */
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    --text-4xl: 2.25rem;

    /* Font Weights */
    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;

    /* Shadows - Soft, Professional */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.05), 0 2px 4px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.06), 0 4px 6px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.08), 0 10px 10px rgba(0, 0, 0, 0.04);
    --shadow-sidebar: -2px 0 10px rgba(0, 0, 0, 0.05);
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-input: 0 2px 4px rgba(0, 0, 0, 0.04);

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;
    --radius-pill: 50px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Layout */
    --sidebar-width: 320px;
    --sidebar-collapsed: 80px;
    --header-height: 70px;
    --input-height: 80px;
}

/* -----------------------------------------------------------------------------
   Base Reset & Typography
   ----------------------------------------------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    font-weight: var(--font-normal);
    line-height: 1.6;
    color: var(--text-body);
    background: var(--bg-secondary);
    min-height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* -----------------------------------------------------------------------------
   Clean Background (No Pattern/Glow Effects)
   ----------------------------------------------------------------------------- */
.bg-pattern,
.bg-gradient,
.bg-glow {
    display: none;
}

/* -----------------------------------------------------------------------------
   App Container Layout
   ----------------------------------------------------------------------------- */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    background: var(--bg-secondary);
}

/* -----------------------------------------------------------------------------
   Sidebar - White with Shadow Separator
   ----------------------------------------------------------------------------- */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-primary);
    box-shadow: var(--shadow-sidebar);
    border-left: 1px solid var(--border-default);
    display: flex;
    flex-direction: column;
    transition: width var(--transition-slow), transform var(--transition-slow);
    position: relative;
    z-index: 100;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar.collapsed .nav-label,
.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-title,
.sidebar.collapsed .agents-section,
.sidebar.collapsed .user-details {
    display: none;
}

.sidebar-header {
    padding: var(--space-5);
    border-bottom: 1px solid var(--border-default);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 80px;
    background: var(--bg-primary);
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.logo-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: var(--radius-lg);
    padding: 6px;
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.08),
        0 4px 16px rgba(0, 0, 0, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.06);
    transition: var(--transition-normal);
}

.logo-icon:hover {
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.12),
        0 8px 24px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transform: translateY(-1px);
}

.logo-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: var(--transition-normal);
    border-radius: var(--radius-sm);
}

.logo-image:hover {
    transform: scale(1.02);
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-title {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--color-primary);
    letter-spacing: -0.02em;
}

.logo-subtitle {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-top: -2px;
}

.sidebar-toggle {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-default);
    background: var(--bg-secondary);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.sidebar-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-body);
    border-color: var(--color-primary);
}

.sidebar-toggle svg {
    width: 18px;
    height: 18px;
    transition: transform var(--transition-normal);
}

.sidebar.collapsed .sidebar-toggle svg {
    transform: rotate(180deg);
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4);
    scrollbar-width: thin;
    scrollbar-color: var(--border-default) transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--border-default);
    border-radius: var(--radius-full);
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: var(--color-gray-400);
}

.nav-section {
    margin-bottom: var(--space-6);
}

.nav-title {
    font-family: var(--font-display);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-2);
}

/* New Chat Button - Primary Teal Style */
.nav-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    border: none;
    background: transparent;
    color: var(--text-body);
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    cursor: pointer;
    transition: var(--transition-fast);
    text-align: right;
}

.nav-item:hover {
    background: var(--color-primary-bg);
    color: var(--color-primary);
}

.nav-item.active {
    background: var(--color-primary);
    color: var(--text-on-primary);
    box-shadow: var(--shadow-md);
}

.nav-item.new-chat {
    background: var(--color-primary);
    color: var(--text-on-primary);
    margin-bottom: var(--space-3);
    box-shadow: var(--shadow-sm);
}

.nav-item.new-chat:hover {
    background: var(--color-primary-dark);
    color: var(--text-on-primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.nav-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-icon svg {
    width: 100%;
    height: 100%;
}

/* Agents Grid */
.agents-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-2);
}

.agent-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-3);
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    cursor: pointer;
    transition: var(--transition-fast);
}

.agent-card:hover {
    background: var(--color-primary-bg);
    border-color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.agent-icon {
    font-size: var(--text-xl);
}

.agent-name {
    font-size: var(--text-xs);
    color: var(--text-body);
    text-align: center;
    line-height: 1.3;
    font-weight: var(--font-medium);
}

.agent-card:hover .agent-name {
    color: var(--color-primary);
}

/* Chat History */
.chat-history {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: var(--space-4);
    border-top: 1px solid var(--border-default);
    background: var(--bg-primary);
}

.user-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-on-primary);
    flex-shrink: 0;
}

.user-avatar svg {
    width: 22px;
    height: 22px;
}

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

.user-name {
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--text-heading);
}

.user-role {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* -----------------------------------------------------------------------------
   Main Content
   ----------------------------------------------------------------------------- */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background: var(--bg-primary);
}

/* Header */
.chat-header {
    height: var(--header-height);
    padding: 0 var(--space-6);
    display: flex;
    align-items: center;
    gap: var(--space-4);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-default);
}

.mobile-menu-btn {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-default);
    background: var(--bg-secondary);
    color: var(--text-muted);
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

.mobile-menu-btn:hover {
    background: var(--bg-hover);
    color: var(--text-body);
}

.mobile-menu-btn svg {
    width: 20px;
    height: 20px;
}

.header-info {
    flex: 1;
}

.header-title {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
    color: var(--text-heading);
}

.header-status {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    background: var(--text-muted);
}

.status-dot.online {
    background: var(--color-success);
    box-shadow: 0 0 8px var(--color-success);
    animation: pulse 2s infinite;
}

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

.header-actions {
    display: flex;
    gap: var(--space-2);
}

.action-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-default);
    background: var(--bg-secondary);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.action-btn:hover {
    background: var(--bg-hover);
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.action-btn svg {
    width: 18px;
    height: 18px;
}

/* Theme Toggle - Hidden in Light-Only Mode */
#themeToggle .moon-icon {
    display: none;
}

#themeToggle .sun-icon {
    display: block;
}

/* -----------------------------------------------------------------------------
   Chat Container
   ----------------------------------------------------------------------------- */
.chat-container {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    background: var(--bg-chat);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border-default);
    border-radius: var(--radius-full);
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--color-gray-400);
}

/* -----------------------------------------------------------------------------
   Welcome Screen - Clean Corporate Style
   ----------------------------------------------------------------------------- */
.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-12) var(--space-6);
    animation: fadeInUp 0.6s ease-out;
}

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

.welcome-icon {
    margin-bottom: var(--space-8);
}

/* Simple Logo Container - No Glow/Animation */
.hexagon-container {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary-bg);
    border-radius: var(--radius-full);
    border: 3px solid var(--color-primary);
}

.hexagon {
    display: none; /* Hide animated hexagons */
}

.ai-core {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-full);
    background: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    animation: none;
}

.ai-core::before {
    content: '🤖';
    font-size: 30px;
}

.welcome-title {
    font-family: var(--font-display);
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
    color: var(--text-heading);
    margin-bottom: var(--space-3);
}

.welcome-subtitle {
    font-size: var(--text-lg);
    color: var(--text-muted);
    margin-bottom: var(--space-8);
    font-weight: var(--font-normal);
}

/* -----------------------------------------------------------------------------
   Quick Actions - White Cards with Soft Shadows
   ----------------------------------------------------------------------------- */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
    max-width: 500px;
    width: 100%;
}

.quick-action {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-default);
    background: var(--bg-primary);
    color: var(--text-body);
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    cursor: pointer;
    transition: var(--transition-fast);
    text-align: right;
    box-shadow: var(--shadow-card);
}

.quick-action:hover {
    border-color: var(--color-primary);
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.qa-icon {
    font-size: var(--text-2xl);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-lg);
    flex-shrink: 0;
}

/* Colored icon backgrounds */
.quick-action:nth-child(1) .qa-icon {
    background: #FFF3E0;
    color: var(--color-orange);
}

.quick-action:nth-child(2) .qa-icon {
    background: var(--color-secondary-bg);
    color: var(--color-purple);
}

.quick-action:nth-child(3) .qa-icon {
    background: #E8F5E9;
    color: var(--color-green);
}

.quick-action:nth-child(4) .qa-icon {
    background: #E3F2FD;
    color: var(--color-blue);
}

.qa-text {
    flex: 1;
    color: var(--text-body);
}

/* -----------------------------------------------------------------------------
   Message Bubbles - Light Theme
   ----------------------------------------------------------------------------- */
.message {
    display: flex;
    gap: var(--space-3);
    max-width: 85%;
    animation: messageSlide 0.3s ease-out;
}

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

.message.user {
    flex-direction: row-reverse;
    margin-right: auto;
}

.message.assistant {
    margin-left: auto;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.message.user .message-avatar {
    background: var(--color-primary);
    color: var(--text-on-primary);
}

.message.assistant .message-avatar {
    background: var(--bg-tertiary);
    color: var(--color-primary);
    border: 1px solid var(--border-default);
}

.message-avatar svg {
    width: 22px;
    height: 22px;
}

.message-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.message-bubble {
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-xl);
    font-size: var(--text-base);
    line-height: 1.7;
    position: relative;
}

/* User Message - Primary Teal with White Text */
.message.user .message-bubble {
    background: var(--color-primary);
    color: var(--text-on-primary);
    border-bottom-right-radius: var(--radius-sm);
}

/* AI Message - Light Gray with Dark Text */
.message.assistant .message-bubble {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    color: var(--text-body);
    border-bottom-left-radius: var(--radius-sm);
}

.message-meta {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    color: var(--text-muted);
    padding: 0 var(--space-2);
}

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

.agent-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-full);
    background: var(--color-primary-bg);
    color: var(--color-primary);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
}

/* Typing Indicator */
.typing-indicator {
    display: none;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-6);
    animation: fadeIn 0.3s ease-out;
}

.typing-indicator.visible {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.typing-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-lg);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
}

.typing-avatar svg {
    width: 22px;
    height: 22px;
}

.typing-content {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-xl);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
}

.typing-text {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

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

.typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: var(--radius-full);
    background: var(--color-primary);
    animation: typing-bounce 1.4s infinite ease-in-out;
}

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

@keyframes typing-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-8px); }
}

/* -----------------------------------------------------------------------------
   Input Container - Floating Card Style
   ----------------------------------------------------------------------------- */
.input-container {
    padding: var(--space-4) var(--space-6) var(--space-6);
    background: var(--bg-chat);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-pill);
    background: var(--bg-primary);
    border: 1px solid var(--border-default);
    box-shadow: var(--shadow-input);
    transition: var(--transition-fast);
}

.input-wrapper:focus-within {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md), 0 0 0 3px rgba(0, 172, 193, 0.1);
}

.input-glow {
    display: none; /* Remove glow effect */
}

.message-input {
    flex: 1;
    order: 1; /* RTL: Move textarea after buttons so buttons appear on the right */
    background: transparent;
    border: none;
    outline: none;
    font-family: var(--font-body);
    font-size: var(--text-base);
    color: var(--text-body);
    resize: none;
    max-height: 150px;
    padding: var(--space-2) var(--space-3);
    line-height: 1.5;
}

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

.input-actions {
    display: flex;
    gap: var(--space-2);
}

.input-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.input-btn svg {
    width: 20px;
    height: 20px;
}

.attach-btn {
    background: var(--bg-secondary);
    color: var(--text-muted);
}

.attach-btn:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-body);
}

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

.attach-btn.has-file {
    background: var(--color-primary);
    color: var(--text-on-primary);
}

/* Send Button - Primary Teal */
.send-btn {
    background: var(--color-primary);
    color: var(--text-on-primary);
    box-shadow: var(--shadow-sm);
}

.send-btn:hover {
    background: var(--color-primary-dark);
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

.send-btn:active {
    transform: scale(0.95);
}

.input-hint {
    text-align: center;
    padding-top: var(--space-2);
    font-size: var(--text-xs);
    color: var(--text-light);
}

.input-hint kbd {
    display: inline-block;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-muted);
}

/* -----------------------------------------------------------------------------
   File Upload Preview
   ----------------------------------------------------------------------------- */
.file-preview {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    margin-bottom: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-primary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    animation: slideUp 0.2s ease-out;
}

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

.file-preview-content {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.file-preview .file-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.file-preview .file-name {
    flex: 1;
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--text-body);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-preview .file-size {
    font-size: var(--text-xs);
    color: var(--text-muted);
    flex-shrink: 0;
}

.file-remove-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.file-remove-btn:hover {
    background: var(--color-error-bg);
    color: var(--color-error);
}

.file-remove-btn svg {
    width: 14px;
    height: 14px;
}

/* Drag and drop overlay */
.input-wrapper.drag-over {
    border-color: var(--color-primary);
    background: rgba(0, 172, 193, 0.05);
}

.input-wrapper.drag-over::after {
    content: 'أفلت الملف هنا';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 172, 193, 0.1);
    border-radius: var(--radius-pill);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--color-primary);
    z-index: 10;
}

/* -----------------------------------------------------------------------------
   Toast Notifications
   ----------------------------------------------------------------------------- */
.toast-container {
    position: fixed;
    bottom: var(--space-6);
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.toast {
    padding: var(--space-4) var(--space-6);
    border-radius: var(--radius-xl);
    background: var(--bg-primary);
    border: 1px solid var(--border-default);
    color: var(--text-body);
    font-size: var(--text-sm);
    box-shadow: var(--shadow-xl);
    animation: toastSlide 0.3s ease-out;
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.toast.error {
    border-color: var(--color-error);
    background: var(--color-error-bg);
    color: var(--color-error);
}

.toast.success {
    border-color: var(--color-success);
    background: var(--color-success-bg);
    color: var(--color-success);
}

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

/* -----------------------------------------------------------------------------
   Responsive Design
   ----------------------------------------------------------------------------- */
@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        right: 0;
        top: 0;
        transform: translateX(100%);
        z-index: 200;
        box-shadow: var(--shadow-xl);
    }

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

    .mobile-menu-btn {
        display: flex;
    }

    .quick-actions {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .chat-header {
        padding: 0 var(--space-4);
    }

    .chat-messages {
        padding: var(--space-4);
    }

    .input-container {
        padding: var(--space-3) var(--space-4) var(--space-4);
    }

    .message {
        max-width: 95%;
    }

    .welcome-title {
        font-size: var(--text-2xl);
    }

    .hexagon-container {
        width: 100px;
        height: 100px;
    }

    .ai-core {
        width: 50px;
        height: 50px;
    }

    .ai-core::before {
        font-size: 24px;
    }
}

/* -----------------------------------------------------------------------------
   Utilities
   ----------------------------------------------------------------------------- */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.hide-scrollbar::-webkit-scrollbar {
    display: none;
}

.hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* -----------------------------------------------------------------------------
   Message Content Formatting (Markdown)
   ----------------------------------------------------------------------------- */
.message-bubble p {
    margin-bottom: var(--space-3);
}

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

.message-bubble ul,
.message-bubble ol {
    padding-right: var(--space-5);
    margin-bottom: var(--space-3);
}

.message-bubble li {
    margin-bottom: var(--space-1);
}

.message-bubble code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--color-primary-dark);
}

.message-bubble pre {
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    overflow-x: auto;
    margin: var(--space-3) 0;
}

.message-bubble pre code {
    background: transparent;
    padding: 0;
    color: var(--text-body);
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 150;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.sidebar-overlay.visible {
    display: block;
    opacity: 1;
}

/* -----------------------------------------------------------------------------
   Markdown Styling for Chat Messages
   ----------------------------------------------------------------------------- */

/* Headers */
.message-bubble h1,
.message-bubble h2,
.message-bubble h3,
.message-bubble h4,
.message-bubble h5,
.message-bubble h6 {
    font-family: var(--font-display);
    font-weight: var(--font-semibold);
    color: var(--text-heading);
    margin: var(--space-4) 0 var(--space-2);
    line-height: 1.4;
}

.message-bubble h1:first-child,
.message-bubble h2:first-child,
.message-bubble h3:first-child {
    margin-top: 0;
}

.message-bubble h1 { font-size: var(--text-2xl); }
.message-bubble h2 { font-size: var(--text-xl); }
.message-bubble h3 { font-size: var(--text-lg); }
.message-bubble h4 { font-size: var(--text-base); }
.message-bubble h5 { font-size: var(--text-sm); }
.message-bubble h6 { font-size: var(--text-xs); }

/* Tables - RTL Optimized */
.message-bubble table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--space-4) 0;
    font-size: var(--text-sm);
    direction: rtl;
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-default);
}

.message-bubble thead {
    background: var(--color-primary);
}

.message-bubble th {
    padding: var(--space-3) var(--space-4);
    text-align: right;
    font-weight: var(--font-semibold);
    color: var(--text-on-primary);
    border: none;
    font-family: var(--font-display);
}

.message-bubble td {
    padding: var(--space-3) var(--space-4);
    text-align: right;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-body);
}

.message-bubble tbody tr:last-child td {
    border-bottom: none;
}

.message-bubble tbody tr:hover {
    background: var(--bg-secondary);
}

.message-bubble tbody tr:nth-child(even) {
    background: var(--bg-secondary);
}

/* Blockquotes */
.message-bubble blockquote {
    margin: var(--space-4) 0;
    padding: var(--space-4);
    padding-right: var(--space-5);
    border-right: 4px solid var(--color-primary);
    background: var(--color-primary-bg);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    color: var(--text-body);
    font-style: italic;
}

.message-bubble blockquote p {
    margin: 0;
}

/* Horizontal Rules */
.message-bubble hr {
    border: none;
    height: 1px;
    background: var(--border-default);
    margin: var(--space-6) 0;
}

/* Links */
.message-bubble a {
    color: var(--color-primary);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: var(--transition-fast);
    font-weight: var(--font-medium);
}

.message-bubble a:hover {
    border-bottom-color: var(--color-primary);
}

/* Strong and Emphasis */
.message-bubble strong {
    font-weight: var(--font-bold);
    color: var(--text-heading);
}

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

/* Del (strikethrough) */
.message-bubble del {
    text-decoration: line-through;
    color: var(--text-light);
}

/* Images in messages */
.message-bubble img {
    max-width: 100%;
    border-radius: var(--radius-lg);
    margin: var(--space-3) 0;
}

/* Code blocks with better styling */
.message-bubble pre {
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    overflow-x: auto;
    margin: var(--space-4) 0;
    direction: ltr;
    text-align: left;
}

.message-bubble pre code {
    background: transparent;
    padding: 0;
    font-size: var(--text-sm);
    line-height: 1.6;
    color: var(--text-body);
}

/* Inline code */
.message-bubble code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--color-primary-dark);
    border: 1px solid var(--border-light);
}

/* Lists with better RTL support */
.message-bubble ul,
.message-bubble ol {
    padding-right: var(--space-6);
    padding-left: 0;
    margin: var(--space-3) 0;
}

.message-bubble li {
    margin-bottom: var(--space-2);
    line-height: 1.6;
}

.message-bubble li::marker {
    color: var(--color-primary);
}

.message-bubble ul ul,
.message-bubble ol ol,
.message-bubble ul ol,
.message-bubble ol ul {
    margin-top: var(--space-2);
    margin-bottom: 0;
}

/* Task lists (GFM) */
.message-bubble input[type="checkbox"] {
    margin-left: var(--space-2);
    accent-color: var(--color-primary);
}

/* Definition lists */
.message-bubble dl {
    margin: var(--space-4) 0;
}

.message-bubble dt {
    font-weight: var(--font-semibold);
    color: var(--color-primary);
    margin-bottom: var(--space-1);
}

.message-bubble dd {
    margin-right: var(--space-4);
    margin-bottom: var(--space-2);
    color: var(--text-muted);
}

/* Keyboard shortcuts */
.message-bubble kbd {
    display: inline-block;
    padding: 2px 8px;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    box-shadow: 0 2px 0 var(--border-default);
    color: var(--text-body);
}

/* Warning/Info boxes */
.message-bubble .warning,
.message-bubble .info,
.message-bubble .success,
.message-bubble .error {
    padding: var(--space-4);
    border-radius: var(--radius-md);
    margin: var(--space-4) 0;
}

.message-bubble .warning {
    background: var(--color-warning-bg);
    border-right: 4px solid var(--color-warning);
}

.message-bubble .info {
    background: var(--color-info-bg);
    border-right: 4px solid var(--color-info);
}

.message-bubble .success {
    background: var(--color-success-bg);
    border-right: 4px solid var(--color-success);
}

.message-bubble .error {
    background: var(--color-error-bg);
    border-right: 4px solid var(--color-error);
}

/* Responsive table wrapper */
.message-bubble .table-wrapper {
    overflow-x: auto;
    margin: var(--space-4) 0;
}

/* User message markdown adjustments */
.message.user .message-bubble table {
    background: rgba(255, 255, 255, 0.15);
}

.message.user .message-bubble th {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-on-primary);
}

.message.user .message-bubble td {
    border-bottom-color: rgba(255, 255, 255, 0.2);
    color: var(--text-on-primary);
}

.message.user .message-bubble code {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-on-primary);
    border-color: rgba(255, 255, 255, 0.3);
}

.message.user .message-bubble strong {
    color: var(--text-on-primary);
}

.message.user .message-bubble a {
    color: #B2EBF2;
}

.message.user .message-bubble blockquote {
    background: rgba(255, 255, 255, 0.1);
    border-right-color: rgba(255, 255, 255, 0.5);
}

.message.user .message-bubble h1,
.message.user .message-bubble h2,
.message.user .message-bubble h3,
.message.user .message-bubble h4,
.message.user .message-bubble h5,
.message.user .message-bubble h6 {
    color: var(--text-on-primary);
}

/* =============================================================================
   Voice Mode Styles
   ============================================================================= */

/* Voice Mode Button */
.voice-btn {
    position: relative;
}

.voice-btn.active {
    background: var(--color-primary);
    color: var(--text-on-primary);
    border-color: var(--color-primary);
}

.voice-btn.active:hover {
    background: var(--color-primary-dark);
}

.voice-btn.active .mic-icon {
    animation: voice-pulse 1.5s infinite;
}

/* Loading state for voice button */
.voice-btn.loading {
    opacity: 0.7;
    pointer-events: none;
    background: var(--color-primary-dark);
}

.voice-btn.loading .mic-icon {
    animation: voice-spin 1s linear infinite;
}

@keyframes voice-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Voice Status Bar */
.voice-status-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 0.75rem 1.5rem;
    background: var(--color-primary);
    color: var(--text-on-primary);
    font-weight: var(--font-medium);
    font-family: var(--font-body);
    box-shadow: var(--shadow-md);
    z-index: 10;
}

/* Voice Visualizer - Sound Wave Bars */
.voice-visualizer {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 24px;
}

.voice-visualizer .bar {
    width: 4px;
    background: var(--text-on-primary);
    border-radius: 2px;
    animation: sound-wave 0.5s ease-in-out infinite;
}

.voice-visualizer .bar:nth-child(1) {
    animation-delay: 0s;
    height: 8px;
}

.voice-visualizer .bar:nth-child(2) {
    animation-delay: 0.1s;
    height: 16px;
}

.voice-visualizer .bar:nth-child(3) {
    animation-delay: 0.2s;
    height: 24px;
}

.voice-visualizer .bar:nth-child(4) {
    animation-delay: 0.1s;
    height: 16px;
}

.voice-visualizer .bar:nth-child(5) {
    animation-delay: 0s;
    height: 8px;
}

/* Voice Status Text */
.voice-status-text {
    font-size: var(--text-sm);
    min-width: 120px;
    text-align: center;
}

/* Voice Stop Button */
.voice-stop-btn {
    padding: 0.5rem 1rem;
    background: var(--bg-primary);
    color: var(--text-body);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: var(--font-body);
    font-weight: var(--font-medium);
    font-size: var(--text-sm);
    transition: var(--transition-fast);
}

.voice-stop-btn:hover {
    background: var(--bg-secondary);
    transform: scale(1.02);
}

.voice-stop-btn:active {
    transform: scale(0.98);
}

/* Voice Mode Animations */
@keyframes sound-wave {
    0%, 100% {
        transform: scaleY(0.5);
    }
    50% {
        transform: scaleY(1);
    }
}

@keyframes voice-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

/* Voice Status States */
.voice-status-bar[data-status="connecting"] {
    background: var(--color-info);
}

.voice-status-bar[data-status="listening"] .voice-visualizer .bar {
    animation-play-state: running;
}

.voice-status-bar[data-status="speaking"] {
    background: var(--color-success);
}

.voice-status-bar[data-status="speaking"] .voice-visualizer .bar {
    animation: sound-wave-fast 0.3s ease-in-out infinite;
}

.voice-status-bar[data-status="error"] {
    background: var(--color-error);
}

@keyframes sound-wave-fast {
    0%, 100% {
        transform: scaleY(0.3);
    }
    50% {
        transform: scaleY(1.2);
    }
}

/* Mobile Responsiveness for Voice Mode */
@media (max-width: 768px) {
    .voice-status-bar {
        padding: 0.5rem 1rem;
        gap: 0.75rem;
    }

    .voice-status-text {
        font-size: var(--text-xs);
        min-width: auto;
    }

    .voice-stop-btn {
        padding: 0.375rem 0.75rem;
        font-size: var(--text-xs);
    }

    .voice-visualizer .bar {
        width: 3px;
    }
}

/* =============================================================================
   Enhanced Scrollbar
   ============================================================================= */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border-default);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-gray-400);
}

/* =============================================================================
   Focus Visible States for Accessibility
   ============================================================================= */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: var(--radius-md);
}

/* =============================================================================
   Agentic Progress Panel
   ============================================================================= */
.agentic-panel {
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    margin: var(--space-4);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: var(--transition-normal);
}

.agentic-panel.collapsed .agentic-panel-content {
    display: none;
}

.agentic-panel.collapsed .agentic-toggle-btn svg {
    transform: rotate(180deg);
}

.agentic-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    background: linear-gradient(135deg, var(--color-primary-bg), var(--color-secondary-bg));
    border-bottom: 1px solid var(--border-light);
}

.agentic-panel-title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: var(--font-semibold);
    color: var(--text-heading);
    font-size: var(--text-sm);
}

.agentic-icon {
    font-size: var(--text-lg);
    animation: spin 2s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.agentic-panel.completed .agentic-icon {
    animation: none;
}

.agentic-toggle-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: var(--transition-fast);
}

.agentic-toggle-btn:hover {
    background: var(--bg-hover);
    color: var(--text-body);
}

.agentic-toggle-btn svg {
    width: 16px;
    height: 16px;
    transition: transform var(--transition-normal);
}

.agentic-panel-content {
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

/* Status Row */
.agentic-status-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.agentic-status-label {
    font-size: var(--text-sm);
    color: var(--text-muted);
    font-weight: var(--font-medium);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
}

.status-badge.planning {
    background: var(--color-info-bg);
    color: var(--color-info);
}

.status-badge.executing {
    background: var(--color-warning-bg);
    color: var(--color-warning);
}

.status-badge.evaluating {
    background: var(--color-secondary-bg);
    color: var(--color-secondary);
}

.status-badge.completed {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.status-badge.failed {
    background: var(--color-error-bg);
    color: var(--color-error);
}

/* Progress Bar */
.agentic-progress {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.agentic-progress-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    overflow: hidden;
    border: 1px solid var(--border-light);
}

.agentic-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-primary-light));
    border-radius: var(--radius-full);
    transition: width 0.5s ease-out;
    position: relative;
}

.agentic-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.agentic-progress-text {
    font-size: var(--text-sm);
    font-weight: var(--font-bold);
    color: var(--color-primary);
    min-width: 45px;
    text-align: left;
}

/* Objectives List */
.agentic-objectives {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.agentic-objectives-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--text-sm);
    color: var(--text-muted);
    font-weight: var(--font-medium);
}

.agentic-objectives-count {
    background: var(--bg-secondary);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    color: var(--text-body);
}

.agentic-objectives-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    max-height: 200px;
    overflow-y: auto;
}

.agentic-objective-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    transition: var(--transition-fast);
    border-right: 3px solid transparent;
}

.agentic-objective-item.pending {
    border-right-color: var(--color-gray-300);
    opacity: 0.7;
}

.agentic-objective-item.in_progress {
    border-right-color: var(--color-warning);
    background: var(--color-warning-bg);
    animation: pulse-border 1.5s ease-in-out infinite;
}

@keyframes pulse-border {
    0%, 100% { border-right-color: var(--color-warning); }
    50% { border-right-color: var(--color-primary); }
}

.agentic-objective-item.completed {
    border-right-color: var(--color-success);
    background: var(--color-success-bg);
}

.agentic-objective-item.failed {
    border-right-color: var(--color-error);
    background: var(--color-error-bg);
}

.objective-icon {
    font-size: var(--text-base);
    flex-shrink: 0;
    line-height: 1.4;
}

.objective-text {
    flex: 1;
    color: var(--text-body);
    line-height: 1.4;
}

.objective-status {
    font-size: var(--text-xs);
    color: var(--text-muted);
    white-space: nowrap;
}

.agentic-objective-item.in_progress .objective-status {
    color: var(--color-warning);
    font-weight: var(--font-semibold);
}

/* Iteration Counter */
.agentic-iteration {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding-top: var(--space-2);
    border-top: 1px solid var(--border-light);
}

.agentic-iteration-label {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.agentic-iteration-value {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--text-body);
    background: var(--bg-secondary);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
}

/* Responsive Agentic Panel */
@media (max-width: 768px) {
    .agentic-panel {
        margin: var(--space-2);
    }

    .agentic-panel-header {
        padding: var(--space-2) var(--space-3);
    }

    .agentic-panel-content {
        padding: var(--space-3);
    }

    .agentic-objectives-list {
        max-height: 150px;
    }

    .agentic-objective-item {
        padding: var(--space-2);
        font-size: var(--text-xs);
    }
}

/* =============================================================================
   Inline Thinking Block (Claude-style)
   ============================================================================= */
.thinking-block {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-3);
    overflow: hidden;
    transition: all 0.3s ease;
}

.thinking-block[data-expanded="false"] .thinking-content {
    max-height: 0;
    opacity: 0;
    padding: 0;
}

.thinking-block[data-expanded="true"] .thinking-content {
    max-height: 500px;
    opacity: 1;
}

.thinking-block[data-expanded="false"] .thinking-chevron svg {
    transform: rotate(-90deg);
}

.thinking-block.completed {
    border-color: var(--color-success);
    background: var(--color-success-bg);
}

.thinking-block.completed .thinking-icon svg {
    animation: none;
}

.thinking-block.completed .thinking-label {
    color: var(--color-success);
}

.thinking-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: right;
    color: var(--text-body);
    font-size: var(--text-sm);
    transition: background 0.2s ease;
}

.thinking-toggle:hover {
    background: var(--bg-hover);
}

.thinking-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--color-primary);
}

.thinking-icon svg {
    width: 100%;
    height: 100%;
}

.thinking-spinner {
    animation: spin 1s linear infinite;
}

.thinking-label {
    flex: 1;
    font-weight: var(--font-medium);
    color: var(--text-muted);
}

.thinking-chevron {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.thinking-chevron svg {
    width: 100%;
    height: 100%;
}

.thinking-content {
    padding: 0 var(--space-3) var(--space-3);
    transition: all 0.3s ease;
    overflow: hidden;
}

.thinking-steps {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.thinking-step {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    padding: var(--space-2);
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    border-right: 3px solid var(--border-light);
    transition: all 0.3s ease;
}

.thinking-step.active {
    border-right-color: var(--color-warning);
    background: var(--color-warning-bg);
}

.thinking-step.completed {
    border-right-color: var(--color-success);
}

.thinking-step.failed {
    border-right-color: var(--color-error);
    background: var(--color-error-bg);
}

.step-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-sm);
}

.step-icon.spinner {
    animation: spin 1s linear infinite;
    color: var(--color-warning);
}

.step-text {
    flex: 1;
    color: var(--text-body);
    line-height: 1.4;
}

/* Auto-collapse animation */
.thinking-block.auto-collapsing {
    animation: collapse-hint 0.5s ease;
}

@keyframes collapse-hint {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(0.98); }
}

/* Responsive */
@media (max-width: 768px) {
    .thinking-toggle {
        padding: var(--space-2);
    }

    .thinking-content {
        padding: 0 var(--space-2) var(--space-2);
    }

    .thinking-step {
        padding: var(--space-1) var(--space-2);
        font-size: var(--text-xs);
    }
}

/* =============================================================================
   Print Styles
   ============================================================================= */
@media print {
    .sidebar,
    .chat-header,
    .input-container,
    .bg-pattern,
    .bg-gradient,
    .bg-glow,
    .agentic-panel,
    .thinking-block {
        display: none !important;
    }

    .main-content {
        width: 100%;
    }

    .chat-messages {
        overflow: visible;
    }
}

/* =============================================================================
   PDF Preview Modal
   ============================================================================= */

.pdf-modal {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.pdf-modal:not([hidden]) {
    opacity: 0;
    visibility: hidden;
}

.pdf-modal.visible {
    opacity: 1;
    visibility: visible;
}

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

.pdf-modal-container {
    position: relative;
    width: 90vw;
    max-width: 1000px;
    height: 90vh;
    max-height: 850px;
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    transform: scale(0.95);
    transition: transform var(--transition-normal);
    overflow: hidden;
}

.pdf-modal.visible .pdf-modal-container {
    transform: scale(1);
}

/* Header */
.pdf-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    flex-shrink: 0;
}

.pdf-modal-title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: white;
    font-weight: 600;
    font-size: var(--text-base);
    min-width: 0;
}

.pdf-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.pdf-filename {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

.pdf-modal-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
}

.pdf-action-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.15);
    color: white;
    cursor: pointer;
    transition: background var(--transition-fast), transform var(--transition-fast);
    text-decoration: none;
}

.pdf-action-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.pdf-action-btn:active {
    transform: scale(0.95);
}

.pdf-action-btn svg {
    width: 18px;
    height: 18px;
}

.pdf-close-btn {
    background: rgba(255, 255, 255, 0.2);
}

.pdf-close-btn:hover {
    background: rgba(239, 68, 68, 0.8);
}

/* Content */
.pdf-modal-content {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: var(--bg-tertiary);
}

.pdf-viewer {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

/* Loading State */
.pdf-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    background: var(--bg-primary);
    color: var(--text-body);
    font-size: var(--text-base);
    z-index: 10;
}

.pdf-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.pdf-modal .pdf-loading[hidden] {
    display: none;
}

/* Mobile Responsive - Full Screen */
@media (max-width: 768px) {
    .pdf-modal-container {
        width: 100vw;
        height: 100vh;
        max-width: none;
        max-height: none;
        border-radius: 0;
    }

    .pdf-modal-header {
        border-radius: 0;
        padding: var(--space-2) var(--space-3);
    }

    .pdf-filename {
        max-width: 150px;
        font-size: var(--text-sm);
    }

    .pdf-action-btn {
        width: 32px;
        height: 32px;
    }

    .pdf-action-btn svg {
        width: 16px;
        height: 16px;
    }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
    .pdf-modal-container {
        width: 95vw;
        height: 90vh;
    }
}
