/* ================================================================
   1. CSS VARIABLES & DESIGN TOKENS
   ================================================================ */
:root {
    /* Color Palette */
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --button-gradient: linear-gradient(135deg, #3498db, #2980b9);
    --success-gradient: linear-gradient(135deg, #27ae60, #219653);
    --danger-gradient: linear-gradient(135deg, #e74c3c, #c0392b);
    --warning-gradient: linear-gradient(135deg, #f39c12, #e67e22);
    
    /* Base Colors */
    --white: #ffffff;
    --gray-50: #f8f9fa;
    --gray-100: #f1f3f4;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #6c757d;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;
    
    /* Semantic Colors */
    --text-primary: #2c3e50;
    --text-secondary: #5a6c7d;
    --text-muted: #7f8c8d;
    --text-light: #95a5a6;
    
    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;
    
    /* Borders & Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 50%;
    
    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 25px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.2);
    
    /* Typography */
    --font-family: 'PingFang SC', 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-size-xs: 12px;
    --font-size-sm: 14px;
    --font-size-base: 16px;
    --font-size-lg: 18px;
    --font-size-xl: 20px;
    --font-size-2xl: 24px;
    --font-size-3xl: 32px;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* ================================================================
   2. RESET & BASE STYLES
   ================================================================ */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    background: var(--secondary-gradient);
    color: var(--text-primary);
    position: relative;
    height: 100vh;
    overflow-x: hidden;
    font-size: var(--font-size-base);
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Custom scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: var(--radius-sm);
    transition: background var(--transition-base);
}

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

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--gray-400) var(--gray-100);
}

/* ================================================================
   3. LAYOUT FOUNDATION
   ================================================================ */

/* App Container */
.app-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
    position: relative;
    background: var(--secondary-gradient);
}

.main-content {
    flex: 1;
    height: 100vh;
    overflow: hidden;
    transition: margin-left var(--transition-base);
    margin-left: 300px;
    background: var(--secondary-gradient);
    display: flex;
    flex-direction: column;
}

.sidebar-collapsed .main-content {
    margin-left: 0;
}

.main-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    flex: 1;
    padding: var(--space-lg);
    max-width: 1400px;
    margin: 0 auto;
}

/* Main Content Flexbox Structure */
.main-content > .header {
    flex-shrink: 0;
}

.main-content > .mobile-badges {
    flex-shrink: 0;
}

.main-content > .dual-window-container {
    flex: 1;
    min-height: 0;
}

/* Dual Window Container */
.dual-window-container {
    display: flex;
    gap: var(--space-lg);
    flex: 1;
    min-height: 0;
}

/* Chat and Thinking Windows Structure */
.chat-window,
.thinking-window {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.chat-messages,
.thinking-content {
    flex: 1;
    overflow-y: auto;
}

.chat-input-container,
.window-header {
    flex-shrink: 0;
}

/* ================================================================
   4. MODERN SIDEBAR DESIGN
   ================================================================ */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 300px;
    height: 100vh;
    background: var(--white);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition-base);
}

.sidebar.collapsed {
    transform: translateX(-300px);
}

/* Sidebar Header */
.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-xl) var(--space-lg);
    border-bottom: 1px solid var(--gray-200);
    background: linear-gradient(135deg, var(--white) 0%, var(--gray-50) 100%);
    flex-shrink: 0;
    margin-left: 60px; /* Space for toggle button */
}

.sidebar-header h3 {
    margin: 0;
    font-size: var(--font-size-lg);
    color: var(--text-primary);
    font-weight: 600;
}

/* New Chat Button */
.btn-new-chat {
    background: var(--success-gradient);
    color: var(--white);
    border: none;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
}

.btn-new-chat:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-new-chat:disabled {
    background: var(--gray-400);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Sidebar Content */
.sidebar-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Conversations List */
.conversations-list {
    flex: 1;
    list-style: none;
    padding: var(--space-md);
    margin: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--gray-400) var(--gray-100);
}

/* Conversation Items */
.conversation-item {
    padding: var(--space-md);
    margin-bottom: var(--space-sm);
    border-radius: var(--radius-lg);
    cursor: pointer;
    position: relative;
    transition: all var(--transition-base);
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
}

.conversation-item:hover {
    background: var(--gray-100);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.conversation-item.active {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-color: #2196f3;
    box-shadow: var(--shadow-md);
}

.conversation-title {
    font-weight: 600;
    margin: 0 0 var(--space-xs) 0;
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 30px;
}

.conversation-time {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin: 0;
}

/* Delete Button */
.delete-conversation {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--danger-gradient);
    color: var(--white);
    font-size: 12px;
    opacity: 0;
    cursor: pointer;
    transition: all var(--transition-base);
}

.conversation-item:hover .delete-conversation {
    opacity: 0.8;
}

.delete-conversation:hover {
    opacity: 1 !important;
    transform: scale(1.1);
}

/* Sidebar Footer */
.sidebar-footer {
    flex-shrink: 0;
    padding: var(--space-lg);
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.profile-link-button {
    width: 100%;
    background: var(--gray-600);
    color: var(--white);
    border: none;
    padding: var(--space-md);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-sm);
    font-weight: 600;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
}

.profile-link-button:hover {
    background: var(--gray-700);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.profile-icon {
    margin-right: var(--space-sm);
    font-size: var(--font-size-base);
}

/* Empty States */
.empty-conversations-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 120px;
    padding: var(--space-lg);
    color: var(--text-light);
    font-size: var(--font-size-sm);
    text-align: center;
    background: var(--gray-50);
    border-radius: var(--radius-lg);
    border: 2px dashed var(--gray-300);
}

/* ================================================================
   5. SIDEBAR CONTROLS & TOGGLE
   ================================================================ */
.sidebar-toggle-btn {
    position: fixed;
    top: var(--space-lg);
    left: var(--space-lg);
    z-index: 101;
    width: 48px;
    height: 48px;
    background: var(--white);
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: all var(--transition-base);
}

.sidebar-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.toggle-icon,
.toggle-icon::before,
.toggle-icon::after {
    content: '';
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    position: relative;
    transition: all var(--transition-base);
    border-radius: 1px;
}

.toggle-icon::before {
    position: absolute;
    top: -7px;
}

.toggle-icon::after {
    position: absolute;
    top: 7px;
}

.hamburger-active .toggle-icon {
    background-color: transparent;
}

.hamburger-active .toggle-icon::before {
    transform: rotate(45deg);
    top: 0;
}

.hamburger-active .toggle-icon::after {
    transform: rotate(-45deg);
    top: 0;
}

/* Mobile Sidebar Controls */
.mobile-sidebar-button {
    display: none;
    background: none;
    border: none;
    padding: var(--space-md);
    margin: 0;
    cursor: pointer;
    position: relative;
    width: 48px;
    height: 48px;
}

.hamburger-icon,
.hamburger-icon:before,
.hamburger-icon:after {
    content: '';
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-primary);
    position: relative;
    transition: all var(--transition-base);
    border-radius: 1px;
}

.hamburger-icon:before {
    position: absolute;
    top: -6px;
}

.hamburger-icon:after {
    position: absolute;
    top: 6px;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 99;
    opacity: 0;
    transition: opacity var(--transition-base);
}

/* ================================================================
   6. MODERN HEADER DESIGN
   ================================================================ */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    position: relative;
    min-height: 60px; /* Reduced from 120px */
    flex-shrink: 0;
}

.header-title {
    flex: 1;
    text-align: center;
}

.header-title h1 {
    color: var(--text-primary);
    margin: 0; /* Remove all margins */
    font-size: var(--font-size-2xl);
    font-weight: 700;
    background: var(--button-gradient);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Header badges - horizontal layout */
.header-badges {
    display: flex;
    flex-direction: row; /* Changed from column to row */
    align-items: center;
    gap: var(--space-sm);
    margin-right: var(--space-lg);
    min-width: 200px;
}

.header-instruction-notice,
.header-survey-notice {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-md);
    border: 1px solid #a5d6a7;
    font-size: var(--font-size-xs);
    text-align: center;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
}

.header-survey-notice {
    background: linear-gradient(135deg, #e8f4fd 0%, #d1ecf1 100%);
    border: 1px solid #bbdefb;
}

.header-instruction-notice:hover,
.header-survey-notice:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.header-instruction-notice span {
    color: #2e7d32;
    font-weight: 600;
}

.header-survey-notice span {
    color: #0277bd;
    font-weight: 600;
}

.header-instruction-notice a,
.header-survey-notice a {
    color: inherit;
    text-decoration: none;
    font-weight: 700;
    transition: color var(--transition-base);
}

.header-instruction-notice a:hover {
    color: #1b5e20;
    text-decoration: underline;
}

.header-survey-notice a:hover {
    color: #0d47a1;
    text-decoration: underline;
}

/* Mobile badges container */
.mobile-badges {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    margin-bottom: var(--space-sm);
}

/* Logout Button */
.logout-button {
    background: var(--danger-gradient);
    color: var(--white);
    border: none;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    font-size: var(--font-size-sm);
    font-weight: 600;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
    position: static; /* Remove absolute positioning */
}

.logout-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.logout-icon {
    width: 16px;
    height: 16px;
    margin-left: var(--space-sm);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1' /%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
}

/* Back Button (for profile page) */
.back-button {
    position: absolute;
    top: var(--space-lg);
    right: var(--space-lg);
    background: var(--gray-600);
    color: var(--white);
    border: none;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    font-size: var(--font-size-sm);
    font-weight: 600;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
}

.back-button:hover {
    background: var(--gray-700);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.back-icon {
    margin-right: var(--space-sm);
    font-size: var(--font-size-base);
}

/* ================================================================
   7. MODERN CHAT INTERFACE
   ================================================================ */

/* Instruction Notice */
.instruction-notice {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    padding: var(--space-sm) var(--space-md);
    text-align: center;
    font-size: var(--font-size-xs);
    color: #2e7d32;
    border-radius: var(--radius-md);
    margin-bottom: var(--space-xs);
    border: 1px solid #a5d6a7;
    box-shadow: var(--shadow-sm);
}

.instruction-notice a {
    color: #1b5e20;
    font-weight: 700;
    text-decoration: none;
    transition: color var(--transition-base);
}

.instruction-notice a:hover {
    color: #0d5016;
    text-decoration: underline;
}

.promo-section .instruction-notice {
    font-size: var(--font-size-base);
    padding: var(--space-md) var(--space-lg);
    margin-bottom: var(--space-md);
    line-height: 1.5;
}

/* Survey Notice */
.survey-notice {
    background: linear-gradient(135deg, #e8f4fd 0%, #d1ecf1 100%);
    padding: var(--space-sm) var(--space-md);
    text-align: center;
    font-size: var(--font-size-xs);
    color: #0277bd;
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
    border: 1px solid #bbdefb;
    box-shadow: var(--shadow-sm);
}

.survey-notice a {
    color: #1565c0;
    font-weight: 700;
    text-decoration: none;
    transition: color var(--transition-base);
}

.survey-notice a:hover {
    color: #0d47a1;
    text-decoration: underline;
}

/* Dual Window Container */
.dual-window-container {
    display: flex;
    gap: var(--space-lg);
    height: calc(100vh - 220px);
    flex: 1;
}

/* Window Headers */
.window-header {
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
    padding: var(--space-md) var(--space-lg);
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    font-size: var(--font-size-base);
}

.window-header span {
    flex: 1;
    text-align: center;
}

/* Chat Window */
.chat-window {
    flex: 3;
    display: flex;
    flex-direction: column;
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-lg);
    background: linear-gradient(to bottom, var(--white) 0%, var(--gray-50) 100%);
}

/* Chat Input Container */
.chat-input-container {
    display: flex;
    padding: var(--space-lg);
    border-top: 1px solid var(--gray-200);
    align-items: center;
    background: var(--white);
    gap: var(--space-md);
}

.chat-input-container input {
    flex: 1;
    padding: var(--space-md);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    font-size: var(--font-size-base);
    background: var(--gray-50);
    transition: all var(--transition-base);
}

.chat-input-container input:focus {
    outline: none;
    border-color: #3498db;
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.chat-input-container input:disabled {
    background: var(--gray-100);
    color: var(--gray-600);
    cursor: not-allowed;
    border-color: var(--gray-300);
}

/* ================================================================
   8. CHAT MESSAGES DESIGN
   ================================================================ */
.message {
    display: flex;
    margin-bottom: var(--space-lg);
    max-width: 100%;
    animation: fadeInUp 0.3s ease-out;
}

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

/* Avatars */
.avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: var(--font-size-xs);
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.user-avatar {
    background-image: url('/static/images/user.png');
}

.assistant-avatar {
    background-image: url('/static/images/agent.png');
}

.avatar::after {
    content: attr(data-label);
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    white-space: nowrap;
    font-weight: 500;
}

/* Message Content */
.message-content {
    max-width: 75%;
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-lg);
    margin: 0 var(--space-md);
    position: relative;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
}

.message.user .message-content {
    background: var(--button-gradient);
    color: var(--white);
    border-bottom-right-radius: var(--radius-sm);
}

.message.assistant .message-content {
    background: var(--white);
    color: var(--text-primary);
    border: 1px solid var(--gray-200);
    border-bottom-left-radius: var(--radius-sm);
    position: relative;
    padding-bottom: 40px;
}

.message.system .message-content {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    color: #e65100;
    max-width: 100%;
    margin: 0 auto;
    border: 1px solid #ffcc02;
    text-align: center;
}

/* ================================================================
   9. THINKING WINDOW DESIGN
   ================================================================ */
.thinking-window {
    flex: 2;
    display: flex;
    flex-direction: column;
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.thinking-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-lg);
    background: linear-gradient(to bottom, #f8fafc 0%, #f1f5f9 100%);
    font-size: var(--font-size-sm);
    line-height: 1.6;
    color: var(--text-primary);
}

.thinking-entry {
    margin-bottom: var(--space-md);
    border-radius: var(--radius-lg);
    overflow: hidden;
    animation: fadeInUp 0.4s ease-out;
}

.state-info {
    background: linear-gradient(135deg, #eaf4ff 0%, #d6edff 100%);
    padding: var(--space-md);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-sm);
    border: 1px solid #bde0ff;
}

.state-header {
    font-weight: 600;
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
}

.state-detail {
    margin: var(--space-xs) 0;
    display: flex;
    flex-wrap: wrap;
}

.state-label {
    font-weight: 600;
    margin-right: var(--space-sm);
    color: var(--text-secondary);
    min-width: 80px;
}

.state-value {
    color: #1a73e8;
    font-family: 'SFMono-Regular', Consolas, monospace;
    font-size: var(--font-size-xs);
    background: rgba(26, 115, 232, 0.1);
    padding: 2px var(--space-xs);
    border-radius: var(--radius-sm);
}

.reasoning-box {
    background: linear-gradient(135deg, var(--white) 0%, var(--gray-50) 100%);
    padding: var(--space-md);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-sm);
    border: 1px solid var(--gray-200);
}

.search-box {
    background: linear-gradient(135deg, #f2f8ef 0%, #e8f5e5 100%);
    padding: var(--space-md);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-sm);
    border: 1px solid #c8e6c9;
}

.thinking-header {
    font-weight: 600;
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
}

.thinking-text {
    white-space: pre-wrap;
    font-family: 'SFMono-Regular', Consolas, monospace;
    font-size: var(--font-size-xs);
    line-height: 1.6;
    overflow-x: auto;
    background: rgba(255, 255, 255, 0.5);
    padding: var(--space-sm);
    border-radius: var(--radius-sm);
}

.thinking-divider {
    height: 1px;
    background: linear-gradient(to right, transparent, var(--gray-300), transparent);
    margin: var(--space-sm) 0;
}

.state-transition-message {
    margin: var(--space-sm) 0;
    padding: var(--space-md);
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border-left: 4px solid #ff9800;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.state-transition-message .header {
    font-weight: 600;
    margin-bottom: var(--space-sm);
    color: #e65100;
}

/* ================================================================
   10. MODERN BUTTON SYSTEM
   ================================================================ */
.btn {
    background: var(--button-gradient);
    color: var(--white);
    border: none;
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: var(--font-size-base);
    font-weight: 600;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    min-height: 44px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.btn.disabled,
.btn:disabled {
    background: var(--gray-400);
    color: var(--gray-600);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    pointer-events: none;
}

/* Button Variants */
.btn-secondary {
    background: var(--gray-600);
}

.btn-secondary:hover {
    background: var(--gray-700);
}

.btn-success {
    background: var(--success-gradient);
}

.btn-danger {
    background: var(--danger-gradient);
}

.btn-warning {
    background: var(--warning-gradient);
}

/* Button Sizes */
.btn-small {
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-sm);
    min-height: 36px;
}

.btn-large {
    padding: var(--space-lg) var(--space-xl);
    font-size: var(--font-size-lg);
    min-height: 52px;
}

/* Special Buttons */
.download-btn {
    background: var(--success-gradient);
    margin-left: var(--space-md);
}

.voice-btn {
    background: var(--success-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 var(--space-md);
    position: relative;
    transition: all var(--transition-base);
    min-width: 88px;
    border-radius: var(--radius-md);
}

.voice-btn.recording {
    background: var(--danger-gradient);
    animation: pulse-recording 1.5s infinite;
}

.voice-btn.processing {
    background: var(--warning-gradient);
    pointer-events: none;
}

.mic-icon {
    display: inline-block;
    width: 20px;
    height: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 11a7 7 0 01-7 7m0 0a7 7 0 01-7-7m7 7v4m0 0H8m4 0h4m-4-8a3 3 0 01-3-3V5a3 3 0 116 0v6a3 3 0 01-3 3z' /%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    margin-right: var(--space-sm);
}

.voice-btn .desktop-text {
    display: inline;
}

.sign-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 var(--space-md);
    position: relative;
    transition: all var(--transition-base);
    min-width: 88px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    font-size: var(--font-size-base);
    font-weight: 600;
    min-height: 44px;
}

.sign-btn:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.sign-btn:active {
    transform: translateY(0);
}

.sign-btn.recording {
    background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
    animation: pulse-sign 1.5s infinite;
}

.sign-btn.processing {
    background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
    cursor: not-allowed;
    pointer-events: none;
}

.sign-btn:disabled {
    background: var(--gray-400);
    color: var(--gray-600);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    pointer-events: none;
}

/* Sign icon */
.sign-icon {
    display: inline-block;
    width: 20px;
    height: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M7 4V2a1 1 0 011-1h8a1 1 0 011 1v2m0 0V1a1 1 0 011-1h2a1 1 0 011 1v18a1 1 0 01-1 1H4a1 1 0 01-1-1V1a1 1 0 011-1h2a1 1 0 011 1v3m0 0h8m-8 0V2' /%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    margin-right: var(--space-sm);
    font-style: normal;
    font-size: 16px;
}

.sign-icon::before {
    content: "👋";
    font-style: normal;
}

.sign-btn .desktop-text {
    display: inline;
}

/* ================================================================
   11. TEXT-TO-SPEECH & INTERACTIVE ELEMENTS
   ================================================================ */
.speak-button {
    background: var(--button-gradient);
    border: none;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    position: absolute;
    right: var(--space-md);
    bottom: var(--space-md);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
    opacity: 0.9;
    z-index: 5;
}

.speak-button:hover {
    transform: scale(1.1);
    opacity: 1;
    box-shadow: var(--shadow-lg);
}

.speak-button.speaking {
    background: var(--success-gradient);
    animation: pulse-button 1.5s infinite;
}

.speak-button.loading {
    background: var(--warning-gradient);
}

.speak-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23FFFFFF' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M15.536 8.464a5 5 0 010 7.072m2.828-9.9a9 9 0 010 12.728M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z' /%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
}

/* ================================================================
   12. TYPING INDICATORS & ANIMATIONS
   ================================================================ */
.typing-indicator {
    display: flex;
    align-items: center;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.typing-indicator span {
    height: 8px;
    width: 8px;
    border-radius: var(--radius-full);
    background: var(--gray-400);
    margin: 0 2px;
    margin-left: var(--space-sm);
    display: inline-block;
    animation: typing 1.5s infinite ease-in-out;
}

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

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

.search-typing {
    color: #3498db;
    font-weight: 600;
}

.search-typing span {
    background: #3498db;
}

/* ================================================================
   13. QUICK REPLIES & SUGGESTIONS
   ================================================================ */
.quick-reply-container {
    position: relative;
    margin: var(--space-md) 0;
}

.quick-reply-button {
    background: var(--button-gradient);
    color: var(--white);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: inline-block;
    font-size: var(--font-size-sm);
    font-weight: 600;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
}

.quick-reply-button:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.quick-reply-dropdown {
    position: absolute;
    z-index: 1000;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: var(--space-md);
    min-width: 250px;
    display: none;
    left: 0;
    bottom: 100%;
    border: 1px solid var(--gray-200);
    transition: opacity var(--transition-base);
    transition-delay: 0.1s;
}

.quick-reply-container:hover .quick-reply-dropdown {
    display: block;
}

.quick-reply-dropdown:hover {
    display: block;
}

.quick-reply-item {
    padding: var(--space-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
    background: linear-gradient(135deg, #e1f5fe 0%, #b3e5fc 100%);
    color: #0277bd;
    cursor: pointer;
    transition: all var(--transition-base);
    border: 1px solid #81d4fa;
    font-weight: 500;
}

.quick-reply-item:hover {
    background: linear-gradient(135deg, #b3e5fc 0%, #81d4fa 100%);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.quick-reply-item:last-child {
    margin-bottom: 0;
}

/* ================================================================
   14. EMPTY STATES & PLACEHOLDERS
   ================================================================ */
.empty-state-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: var(--text-light);
}

.empty-state-content {
    max-width: 300px;
    padding: var(--space-2xl);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: var(--space-lg);
    opacity: 0.6;
}

.empty-state-placeholder h3 {
    font-size: var(--font-size-lg);
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
    font-weight: 600;
}

.empty-state-placeholder p {
    font-size: var(--font-size-sm);
    color: var(--text-light);
    line-height: 1.5;
}

/* ================================================================
   15. MARKDOWN CONTENT STYLING
   ================================================================ */
.markdown-content {
    font-size: var(--font-size-base);
    line-height: 1.6;
    font-family: var(--font-family);
}

.markdown-content p {
    margin-top: 0;
    margin-bottom: var(--space-md);
    line-height: 1.7;
}

.markdown-content p:last-child {
    margin-bottom: var(--space-2xl);
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    margin-top: var(--space-lg);
    margin-bottom: var(--space-md);
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

.markdown-content h1 {
    font-size: var(--font-size-2xl);
    border-bottom: 2px solid var(--gray-200);
    padding-bottom: var(--space-sm);
}

.markdown-content h2 {
    font-size: var(--font-size-xl);
    border-bottom: 1px solid var(--gray-200);
    padding-bottom: var(--space-xs);
}

.markdown-content h3 {
    font-size: var(--font-size-lg);
}

.markdown-content ul,
.markdown-content ol {
    margin-top: 0;
    margin-bottom: var(--space-md);
    padding-left: var(--space-xl);
}

.markdown-content li {
    margin-bottom: var(--space-sm);
    line-height: 1.6;
}

.markdown-content pre {
    margin-top: 0;
    margin-bottom: var(--space-md);
    padding: var(--space-md);
    overflow: auto;
    font-size: calc(var(--font-size-base) * 0.9);
    line-height: 1.5;
    background: var(--gray-100);
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
}

.markdown-content code {
    padding: 2px var(--space-xs);
    margin: 0;
    font-size: calc(var(--font-size-base) * 0.9);
    background: var(--gray-100);
    border-radius: var(--radius-sm);
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    border: 1px solid var(--gray-200);
}

.markdown-content pre code {
    padding: 0;
    background: transparent;
    border: none;
}

.markdown-content blockquote {
    margin: 0 0 var(--space-md);
    padding: 0 var(--space-lg);
    color: var(--text-secondary);
    border-left: 4px solid var(--gray-300);
    background: var(--gray-50);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.markdown-content a {
    color: #3498db;
    text-decoration: none;
    font-weight: 600;
    transition: color var(--transition-base);
}

.markdown-content a:hover {
    color: #2980b9;
    text-decoration: underline;
}

.markdown-content strong {
    font-weight: 700;
    color: var(--text-primary);
}

/* ================================================================
   16. MOBILE TABS INTERFACE
   ================================================================ */
.tabs-container {
    display: none;
}

.tab-nav {
    display: flex;
    width: 100%;
    background: var(--white);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    overflow: hidden;
    margin-bottom: 0;
    box-shadow: var(--shadow-sm);
}

.tab-button {
    flex: 1;
    padding: var(--space-md) 0;
    text-align: center;
    background: var(--gray-100);
    border: none;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-muted);
    transition: all var(--transition-base);
    font-size: var(--font-size-sm);
    position: relative;
}

.tab-button.active {
    background: var(--white);
    color: var(--text-primary);
    box-shadow: 0 -3px 0 #3498db inset;
}

.chat-notification,
.thinking-notification {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    animation: pulse 1.5s infinite;
}

.chat-notification {
    background: #e74c3c;
}

.thinking-notification {
    background: #3498db;
}

/* ================================================================
   17. CONFIRMATION DIALOGS & MODALS
   ================================================================ */
.confirmation-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.confirmation-content {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow-xl);
    animation: slideInUp 0.3s ease;
}

.confirmation-title {
    font-size: var(--font-size-lg);
    color: var(--text-primary);
    margin-top: 0;
    margin-bottom: var(--space-lg);
    font-weight: 600;
}

.confirmation-message {
    font-size: var(--font-size-base);
    color: var(--text-secondary);
    margin-bottom: var(--space-xl);
    line-height: 1.6;
}

.confirmation-buttons {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-md);
}

.confirmation-cancel {
    background: var(--gray-500);
}

.confirmation-confirm {
    background: var(--danger-gradient);
}

/* ================================================================
   18. ANIMATIONS & KEYFRAMES
   ================================================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes pulse-recording {
    0% { background: var(--danger-gradient); }
    50% { filter: brightness(1.2); }
    100% { background: var(--danger-gradient); }
}

@keyframes pulse-button {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes typing {
    0% { transform: scale(1); opacity: 0.3; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 0.3; }
}

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

@keyframes pulse-sign {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(229, 62, 62, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 6px 20px rgba(229, 62, 62, 0.6);
    }
}

/* ================================================================
   19. LOGIN INTERFACE (EXISTING DESIGN)
   ================================================================ */

/* Contact form container for split layout */
.contact-form-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: var(--primary-gradient);
    padding: var(--space-lg);
}

.login-container {
    display: flex;
    max-width: 1200px;
    width: 100%;
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    min-height: 600px;
}

/* Login Form Section */
.login-section {
    flex: 3;
    padding: var(--space-3xl) var(--space-2xl);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-section .contact-form {
    max-width: 400px;
    margin: 0 auto;
    width: 100%;
    background: transparent;
    padding: 0;
    box-shadow: none;
    border-radius: 0;
}

.login-section .contact-form h2 {
    color: var(--text-primary);
    font-size: var(--font-size-3xl);
    font-weight: 600;
    margin-bottom: var(--space-sm);
    text-align: center;
}

.login-section .contact-form #formDescription {
    color: var(--text-muted);
    font-size: var(--font-size-base);
    text-align: center;
    margin-bottom: var(--space-2xl);
}

/* Form styling within login section */
.login-section .form-group {
    margin-bottom: var(--space-lg);
}

.login-section .form-group label {
    display: block;
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
    font-weight: 600;
}

.login-section .form-group select,
.login-section .form-group input {
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    transition: all var(--transition-base);
    background: var(--gray-50);
}

.login-section .form-group select:focus,
.login-section .form-group input:focus {
    outline: none;
    border-color: #3498db;
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.login-section .btn {
    width: 100%;
    background: var(--button-gradient);
    color: var(--white);
    border: none;
    padding: var(--space-lg);
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    margin-top: var(--space-md);
}

.login-section .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.3);
}

.login-section .btn-secondary {
    background: var(--gray-600);
    margin-top: var(--space-lg);
}

.login-section .btn-secondary:hover {
    background: var(--gray-700);
    box-shadow: 0 8px 25px rgba(108, 117, 125, 0.3);
}

/* Password forms */
.login-section .password-form {
    margin-bottom: var(--space-lg);
    padding: var(--space-lg);
    background: var(--gray-50);
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
}

.login-section .password-form h3 {
    margin: 0 0 var(--space-md) 0;
    color: var(--text-primary);
    font-size: var(--font-size-xl);
    font-weight: 600;
}

.login-section .form-subtitle {
    margin: 0 0 var(--space-lg) 0;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    line-height: 1.5;
}

.login-section .error-message {
    color: #e74c3c;
    margin-top: var(--space-lg);
    min-height: 20px;
    padding: var(--space-sm) var(--space-md);
    background: #ffebee;
    border-radius: var(--radius-sm);
    border: 1px solid #ffcdd2;
    font-size: var(--font-size-sm);
    line-height: 1.5;
}

.login-section .error-message:empty {
    display: none;
}

/* Promotional Section */
.promo-section {
    flex: 2;
    background: var(--secondary-gradient);
    padding: var(--space-xl) var(--space-lg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.promo-content {
    position: relative;
    z-index: 2;
}

.promo-header {
    margin-bottom: var(--space-xl);
}

.promo-header h2 {
    color: var(--text-primary);
    font-size: var(--font-size-2xl);
    font-weight: 700;
    margin-bottom: var(--space-md);
    line-height: 1.3;
}

.promo-header p {
    color: var(--text-secondary);
    font-size: var(--font-size-base);
    line-height: 1.6;
}

.demo-preview {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    box-shadow: var(--shadow-lg);
    margin-bottom: var(--space-lg);
    position: relative;
    overflow: hidden;
    transition: all var(--transition-base);
}

.demo-preview:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.demo-screen {
    width: 100%;
    height: 150px;
    background: var(--gray-50);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.demo-gif {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    border-radius: var(--radius-md);
}

.feature-list {
    list-style: none;
    padding: 0;
}

.feature-item {
    display: flex;
    align-items: center;
    margin-bottom: var(--space-md);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    transition: all var(--transition-base);
    padding: var(--space-xs);
    border-radius: var(--radius-md);
}

.feature-item:hover {
    background: rgba(255, 255, 255, 0.5);
    transform: translateX(4px);
}

.feature-icon {
    width: 28px;
    height: 28px;
    background: var(--button-gradient);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: var(--space-md);
    color: var(--white);
    font-size: 14px;
    font-weight: bold;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.trust-badge {
    position: absolute;
    top: var(--space-lg);
    right: var(--space-lg);
    background: rgba(46, 204, 113, 0.1);
    color: #27ae60;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--space-lg);
    font-size: var(--font-size-xs);
    font-weight: 600;
    border: 1px solid rgba(46, 204, 113, 0.2);
    z-index: 3;
}

/* ================================================================
   20. PROFILE PAGE STYLES
   ================================================================ */
.profile-container {
    display: flex;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    position: relative;
    background: var(--secondary-gradient);
}

.profile-container .main-content {
    flex: 1;
    height: 100vh;
    overflow: hidden;
    transition: margin-left var(--transition-base);
    margin-left: 300px;
    background: var(--secondary-gradient);
    display: flex;
    flex-direction: column;
    padding: var(--space-lg);
}

.profile-content {
    flex: 1;
    overflow-y: auto;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: var(--space-lg);
}

.profile-form {
    width: 100%;
}

.form-section {
    margin-bottom: var(--space-xl);
    padding: var(--space-lg);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    background: var(--gray-50);
}

.form-section h4 {
    margin: 0 0 var(--space-lg) 0;
    color: var(--text-primary);
    font-size: var(--font-size-lg);
    font-weight: 600;
}

.editable-section {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-color: var(--gray-300);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
}

.section-content {
    margin-bottom: var(--space-md);
}

.section-actions {
    margin-top: var(--space-lg);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: var(--space-md);
}

.form-row {
    display: flex;
    align-items: flex-start;
    margin-bottom: var(--space-md);
    min-height: 28px;
}

.form-row label {
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 140px;
    margin-right: var(--space-lg);
    flex-shrink: 0;
    padding-top: 2px;
}

.form-row span.readonly-value {
    flex: 1;
    color: var(--text-primary);
    line-height: 1.6;
}

.form-row input.edit-input,
.form-row textarea.edit-input {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-family: inherit;
    resize: vertical;
    transition: all var(--transition-base);
}

.form-row textarea.edit-input {
    min-height: 80px;
    max-height: 200px;
}

.form-row input.edit-input:focus,
.form-row textarea.edit-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.edit-btn {
    background: #17a2b8;
    border-color: #17a2b8;
}

.edit-btn:hover {
    background: #138496;
    border-color: #117a8b;
}

.behavior-category {
    margin-bottom: var(--space-lg);
    padding: var(--space-lg);
    background: var(--white);
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
}

.behavior-items {
    margin-top: var(--space-md);
}

.behavior-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: var(--space-md);
    margin-bottom: var(--space-sm);
    background: var(--gray-50);
    border-radius: var(--radius-md);
    border-left: 4px solid #3498db;
    transition: all var(--transition-base);
}

.behavior-item:hover {
    background: var(--gray-100);
    transform: translateX(2px);
}

.behavior-content {
    flex: 1;
    margin-right: var(--space-lg);
}

.behavior-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

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

.consultation-info {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
    border-left: 4px solid #2196f3;
}

.empty-section {
    color: var(--text-light);
    font-style: italic;
    text-align: center;
    padding: var(--space-2xl);
    background: var(--white);
    border-radius: var(--radius-md);
    border: 2px dashed var(--gray-300);
}

/* Loading and error states */
.loading {
    text-align: center;
    padding: var(--space-xl);
    color: var(--text-secondary);
    font-style: italic;
}

.error {
    text-align: center;
    padding: var(--space-xl);
    color: #e74c3c;
    background: #ffeaea;
    border-radius: var(--radius-md);
    border: 1px solid #f5c6cb;
}

.success-message,
.error-message {
    position: fixed;
    top: var(--space-lg);
    right: var(--space-lg);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    z-index: 1000;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s ease;
}

.success-message {
    background: var(--success-gradient);
    color: var(--white);
}

.error-message {
    background: var(--danger-gradient);
    color: var(--white);
}

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

/* ================================================================
   21. RESPONSIVE DESIGN - TABLET & DESKTOP
   ================================================================ */
@media (min-width: 769px) {
    .header-badges {
        display: flex;
    }
    
    .mobile-badges {
        display: none;
    }
}

@media (max-width: 1200px) {
    .sidebar {
        width: 280px;
    }
    
    .main-content {
        margin-left: 280px;
    }
    
    .sidebar-collapsed .main-content {
        margin-left: 0;
    }
    
    .main-container {
        padding: var(--space-md);
    }
}

@media (max-width: 1000px) {
    .dual-window-container {
        flex-direction: column;
    }
    
    .chat-window, .thinking-window {
        width: 100%;
        flex: 1;
        min-height: 300px;
        margin-bottom: var(--space-lg);
    }
    
    .message-content {
        max-width: 85%;
    }
}

@media (max-width: 768px) {
    .header-badges {
        display: none;
    }
    
    .mobile-badges {
        display: flex;
    }
    
    /* Revert header to original mobile layout */
    .header {
        text-align: center;
        padding: var(--space-lg) var(--space-lg);
        display: block;
        position: relative;
        min-height: auto;
        flex-shrink: 0; /* Prevent header from shrinking */
    }
    
    .header-title {
        text-align: center;
    }
    
    .header-title h1 {
        font-size: var(--font-size-2xl);
        margin-bottom: var(--space-md);
    }
    
    .header-title p {
        font-size: var(--font-size-sm);
    }
    
    /* Mobile logout button back to absolute positioning */
    .logout-button {
        position: absolute;
        top: var(--space-lg);
        right: var(--space-lg);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .sidebar-toggle-btn {
        display: none;
    }
    
    .mobile-sidebar-button {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .sidebar-backdrop.active {
        display: block;
        opacity: 1;
    }
    
    .header {
        padding-left: var(--space-3xl);
        padding-right: var(--space-3xl);
        text-align: center;
        margin-bottom: var(--space-xs);
        padding: var(--space-md) 0;
    }
    
    .mobile-badges {
        flex-shrink: 0;
    }
    
    .chat-window, .thinking-window {
        min-height: 300px;
        margin-bottom: var(--space-md);
    }
    
    .tabs-container {
        display: block;
        flex-shrink: 0;
    }
    
    .dual-window-container {
        display: block;
        flex: 1;
        min-height: 0;
    }
    
    .chat-window, .thinking-window {
        display: none;
        margin-bottom: var(--space-md);
        box-shadow: var(--shadow-md);
        border: 1px solid var(--gray-200);
        height: 100%; /* Fill container height */
    }
    
    .window-active {
        display: flex !important;
    }
    
    .instruction-notice,
    .survey-notice {
        padding: var(--space-xs) var(--space-sm);
        margin-bottom: var(--space-xs);
        font-size: var(--font-size-xs);
    }
    
    .quick-reply-container:hover .quick-reply-dropdown {
        display: none;
    }
    
    .quick-reply-dropdown {
        width: 100%;
        left: 0;
        max-height: 200px;
        overflow-y: auto;
        position: absolute;
        z-index: 50;
        -webkit-overflow-scrolling: touch;
        bottom: 100%;
        margin-bottom: var(--space-sm);
        box-shadow: var(--shadow-xl);
        border: 2px solid var(--gray-300);
        background: var(--white);
    }
    
    .quick-reply-button {
        padding: var(--space-sm) var(--space-md);
        font-size: var(--font-size-sm);
        margin-bottom: var(--space-sm);
    }
    
    .quick-reply-container {
        margin: var(--space-lg) 0;
        position: relative;
        z-index: 50;
    }
    
    .quick-reply-item {
        padding: var(--space-md) var(--space-lg);
        font-size: var(--font-size-base);
        margin-bottom: var(--space-sm);
        min-height: 48px; /* Touch-friendly size for tablet */
        display: flex;
        align-items: center;
    }
    
    /* Login responsive */
    .login-container {
        flex-direction: column;
        margin: var(--space-md);
        min-height: auto;
    }

    .promo-section {
        order: -1;
        padding: var(--space-lg) var(--space-md);
    }

    .login-section {
        padding: var(--space-lg) var(--space-md);
    }

    .promo-header h2 {
        font-size: var(--font-size-2xl);
    }

    .login-section .contact-form h2 {
        font-size: var(--font-size-2xl);
    }

    .demo-screen {
        height: 120px;
    }
    
    .feature-item {
        font-size: var(--font-size-xs);
        margin-bottom: var(--space-sm);
    }
}

/* ================================================================
   22. RESPONSIVE DESIGN - MOBILE
   ================================================================ */
@media (max-width: 576px) {
    :root {
        --space-xs: 3px;
        --space-sm: 6px;
        --space-md: 12px;
        --space-lg: 18px;
        --space-xl: 24px;
        --space-2xl: 36px;
        --space-3xl: 48px;
    }
    
    .sidebar {
        width: 85%;
        max-width: 300px;
    }
    
    .main-container {
        padding: var(--space-md);
    }
    
    .header {
        margin-bottom: var(--space-lg);
        padding: var(--space-md) 0;
        padding-left: var(--space-3xl);
        padding-right: var(--space-3xl);
        margin-bottom: var(--space-xs);
        min-height: auto;
        flex-shrink: 0;
    }
    
    .header-title h1 {
        font-size: var(--font-size-xl);
        margin-bottom: var(--space-xs);
    }
    
    .header-title p {
        font-size: var(--font-size-sm);
    }
    
    .header-badges {
        display: none !important;
    }
    
    .mobile-badges {
        display: flex !important;
        flex-shrink: 0;
    }
    
    .chat-window, .thinking-window {
        min-height: 300px;
        margin-bottom: var(--space-md);
        height: 100%;
    }
    
    .chat-messages, .thinking-content {
        padding: var(--space-md);
    }
    
    .message {
        margin-bottom: var(--space-md);
    }
    
    .avatar {
        width: 36px;
        height: 36px;
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
    }
    
    .avatar::after {
        bottom: -18px;
        font-size: var(--font-size-xs);
    }
    
    .message-content {
        max-width: 80%;
        padding: var(--space-sm) var(--space-md);
        font-size: var(--font-size-sm);
    }
    
    .chat-input-container {
        padding: var(--space-md);
        gap: var(--space-sm);
    }
    
    .chat-input-container input {
        padding: var(--space-sm) var(--space-md);
        font-size: var(--font-size-base);
    }
    
    .voice-btn .desktop-text {
        display: none;
    }
    
    .voice-btn {
        min-width: 44px;
        width: 44px;
        padding: 0;
    }
    
    .mic-icon {
        margin-right: 0;
        width: 22px;
        height: 22px;
    }
    
    .btn {
        font-size: var(--font-size-sm);
        padding: var(--space-sm) var(--space-md);
        min-height: 44px;
    }
    
    .download-btn {
        display: none; /* Hide download button on mobile */
    }
    
    .speak-button {
        width: 36px;
        height: 36px;
        right: var(--space-md);
        bottom: var(--space-sm);
    }
    
    .speak-icon {
        width: 20px;
        height: 20px;
    }
    
    .message.assistant .message-content {
        padding-bottom: 44px;
    }
    
    .quick-reply-container:hover .quick-reply-dropdown {
        display: none;
    }
    
    .quick-reply-dropdown {
        width: calc(100% - var(--space-md));
        left: var(--space-sm);
        max-height: 180px;
        overflow-y: auto;
        position: absolute;
        z-index: 50;
        -webkit-overflow-scrolling: touch;
        bottom: 100%;
        margin-bottom: var(--space-md);
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
        border: 2px solid var(--gray-300);
        background: var(--white);
        border-radius: var(--radius-lg);
        max-width: calc(100vw - var(--space-lg));
    }
    
    .quick-reply-button {
        padding: var(--space-sm) var(--space-md);
        font-size: var(--font-size-sm);
        margin-bottom: var(--space-sm);
        border-radius: var(--radius-md);
        font-weight: 600;
    }
    
    .quick-reply-button:active {
        transform: scale(0.98);
        box-shadow: var(--shadow-sm);
    }
    
    .quick-reply-container {
        margin: var(--space-lg) 0;
        position: relative;
        z-index: 50;
    }
    
    .quick-reply-item {
        padding: var(--space-lg) var(--space-md);
        font-size: var(--font-size-base);
        margin-bottom: var(--space-md);
        min-height: 44px; /* Touch-friendly size */
        display: flex;
        align-items: center;
        border-radius: var(--radius-md);
        transition: all var(--transition-fast);
    }
    
    .quick-reply-item:active {
        transform: scale(0.98);
        background: linear-gradient(135deg, #81d4fa 0%, #4fc3f7 100%);
    }
    
    .quick-reply-item:last-child {
        margin-bottom: 0;
    }
    
    .logout-button {
        top: var(--space-md);
        right: var(--space-md);
        padding: var(--space-sm) var(--space-md);
        font-size: var(--font-size-xs);
    }
    
    .logout-icon {
        width: 12px;
        height: 12px;
        margin-left: var(--space-xs);
    }
    
    .instruction-notice,
    .survey-notice {
        padding: var(--space-xs) var(--space-sm);
        margin-bottom: var(--space-xs);
        font-size: var(--font-size-xs);
    }
    
    .dual-window-container {
        flex: 1;
        min-height: 0;
    }
    
    .tabs-container {
        flex-shrink: 0;
    }
    
    /* Mobile login styles */
    .contact-form-container {
        padding: var(--space-md);
    }
    
    .promo-section,
    .login-section {
        padding: var(--space-lg) var(--space-md);
    }
    
    .login-section .contact-form h2 {
        font-size: var(--font-size-2xl);
    }
    
    .promo-header h2 {
        font-size: var(--font-size-xl);
    }
    
    .demo-screen {
        height: 100px;
    }
    
    .feature-item {
        font-size: var(--font-size-xs);
        margin-bottom: var(--space-md);
    }
    
    .feature-icon {
        width: 24px;
        height: 24px;
        font-size: 12px;
        margin-right: var(--space-sm);
    }
    
    .trust-badge {
        position: static;
        display: inline-block;
        margin-bottom: var(--space-lg);
    }
    
    .login-section .form-group select,
    .login-section .form-group input {
        padding: var(--space-md);
        font-size: var(--font-size-base);
    }
    
    .login-section .btn,
    .login-section .btn-secondary {
        padding: var(--space-md);
        font-size: var(--font-size-base);
    }
    
    /* Profile page mobile */
    .profile-content {
        padding: var(--space-lg);
        margin: var(--space-md);
    }
    
    .form-section {
        padding: var(--space-md);
        margin-bottom: var(--space-lg);
    }
    
    .form-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .form-row label {
        min-width: auto;
        margin-right: 0;
        margin-bottom: var(--space-xs);
        font-weight: 600;
    }
    
    .section-header {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-md);
    }
    
    .section-actions {
        flex-direction: column;
        gap: var(--space-sm);
    }
    
    .behavior-item {
        flex-direction: column;
        gap: var(--space-sm);
    }
    
    .behavior-content {
        margin-right: 0;
    }
    
    /* Force 16px font size on form inputs to prevent zoom on iOS */
    input, select, textarea {
        font-size: 16px !important;
    }

    .sign-btn .desktop-text {
        display: none;
    }
    
    .sign-btn {
        min-width: 44px;
        width: 44px;
        padding: 0;
    }
    
    .sign-icon {
        margin-right: 0;
        width: 22px;
        height: 22px;
    }
}

/* ================================================================
   23. ACCESSIBILITY & UTILITIES
   ================================================================ */

/* Focus states for better accessibility */
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --gray-200: #000;
        --gray-300: #333;
    }
}

/* Print styles */
@media print {
    .sidebar,
    .sidebar-toggle-btn,
    .mobile-sidebar-button,
    .chat-input-container,
    .speak-button,
    .quick-reply-container {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
    }
    
    .chat-window,
    .thinking-window {
        box-shadow: none !important;
        border: 1px solid #000 !important;
    }
}

/* Utility classes */
.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;
}

.hidden {
    display: none !important;
}

.disabled,
:disabled {
    cursor: not-allowed !important;
    user-select: none;
    opacity: 0.6;
}

/* ================================================================
   END OF STYLESHEET
   ================================================================ */

/* Streaming message styles */
.message.streaming {
    position: relative;
}

.streaming-content {
    display: inline;
}

.streaming-cursor {
    display: inline-block;
    animation: streaming-blink 1s infinite;
    color: #666;
    margin-left: 2px;
    font-weight: bold;
}

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

/* Hide cursor when not streaming */
.message:not(.streaming) .streaming-cursor {
    display: none !important;
}

/* Enhanced typing indicator for streaming states */
.message.typing.search-typing .typing-indicator {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    border-left: 4px solid #2196f3;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 8px 0;
    color: #1976d2;
    font-weight: 500;
}

.message.typing.search-typing .typing-indicator span {
    background-color: #2196f3;
}

/* Smooth text appearance for streaming */
.streaming-content {
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
}

/* Streaming response start animation */
.message.streaming .message-content {
    animation: streaming-fade-in 0.3s ease-out;
}

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

/* Enhanced response indicators */
.response-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(33, 150, 243, 0.1);
    border-radius: 16px;
    font-size: 12px;
    color: #1976d2;
    margin-bottom: 8px;
    animation: pulse-subtle 2s infinite;
}

@keyframes pulse-subtle {
    0%, 100% {
        opacity: 0.8;
    }
    50% {
        opacity: 1;
    }
}

.response-indicator::before {
    content: "⚡";
    font-size: 14px;
}

/* Mobile optimizations for streaming */
@media (max-width: 576px) {
    .streaming-cursor {
        font-size: 16px;
    }
    
    .message.streaming .message-content {
        font-size: 16px;
        line-height: 1.5;
    }
}

/* Token animation for visual feedback */
.token-highlight {
    background: linear-gradient(90deg, transparent, rgba(33, 150, 243, 0.2), transparent);
    animation: token-sweep 0.5s ease-out;
}

@keyframes token-sweep {
    from {
        background-position: -100% 0;
    }
    to {
        background-position: 100% 0;
    }
}

/* Improved message spacing during streaming */
.message.streaming + .message {
    margin-top: 16px;
}

/* Enhanced visual feedback for connection status */
.streaming-status {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 8px 16px;
    background: rgba(76, 175, 80, 0.9);
    color: white;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 6px;
    animation: slide-in-right 0.3s ease-out;
}

.streaming-status.error {
    background: rgba(244, 67, 54, 0.9);
}

.streaming-status::before {
    content: "🔄";
    animation: spin 1s linear infinite;
}

.streaming-status.error::before {
    content: "⚠️";
    animation: none;
}

@keyframes slide-in-right {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

/* Smooth scrolling during streaming */
.chat-messages {
    scroll-behavior: smooth;
}

/* Dark mode support for streaming elements */
@media (prefers-color-scheme: dark) {
    .streaming-cursor {
        color: #ccc;
    }
    
    .response-indicator {
        background: rgba(33, 150, 243, 0.2);
        color: #64b5f6;
    }
    
    .streaming-status {
        background: rgba(76, 175, 80, 0.8);
    }
    
    .streaming-status.error {
        background: rgba(244, 67, 54, 0.8);
    }
}

.recording-message.sign-recording {
    background-color: #f3f4f6 !important;
    border-left: 4px solid #667eea !important;
}

.recording-message.sign-recording .message-content {
    background-color: #ede9fe !important;
    color: #5b21b6 !important;
}