/* ============================================
   CustomApp Admin Portal - Main Stylesheet
   Version: 1.0.0
   ============================================ */

/* ============================================
   CSS CUSTOM PROPERTIES (Design Tokens)
   ============================================ */
:root {
    /* Primary Colors */
    --primary-teal: #5CBDB4;
    --primary-dark: #4A9B94;
    --primary-light: #7DD4CB;
    
    /* Secondary Colors */
    --secondary-blue: #0D6EFD;
    --secondary-purple: #6F42C1;
    --secondary-orange: #FF9800;
    
    /* Status Colors */
    --success: #28A745;
    --warning: #FFC107;
    --danger: #DC3545;
    --info: #17A2B8;
    
    /* Neutral Colors */
    --text-primary: #2D3748;
    --text-secondary: #4A5568;
    --text-muted: #718096;
    --border-color: #E2E8F0;
    --bg-light: #F7FAFC;
    --bg-white: #FFFFFF;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-secondary: linear-gradient(135deg, #5CBDB4 0%, #4A9B94 100%);
    --gradient-success: linear-gradient(135deg, #28A745 0%, #20963a 100%);
    --gradient-warning: linear-gradient(135deg, #FFC107 0%, #e0a800 100%);
    --gradient-danger: linear-gradient(135deg, #DC3545 0%, #c82333 100%);
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.15);
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* 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;
    
    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    
    /* Layout */
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 70px;
    --header-height: 64px;
    --transition-speed: 0.3s;
}

/* Dark Mode Variables */
[data-bs-theme="dark"] {
    --text-primary: #F7FAFC;
    --text-secondary: #E2E8F0;
    --text-muted: #A0AEC0;
    --border-color: #4A5568;
    --bg-light: #1A202C;
    --bg-white: #2D3748;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
}

/* ============================================
   BASE STYLES
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-light);
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color var(--transition-speed);
}

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

::-webkit-scrollbar-track {
    background: var(--bg-light);
}

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

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================
   ADMIN LAYOUT
   ============================================ */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* ============================================
   SIDEBAR NAVIGATION
   ============================================ */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background: var(--bg-white);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: all var(--transition-speed) ease;
    box-shadow: var(--shadow);
}

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

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

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

.logo-icon {
    width: 42px;
    height: 42px;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3); }
    50% { box-shadow: 0 4px 20px rgba(102, 126, 234, 0.5); }
}

.logo-text h4 {
    font-size: 1.125rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

.logo-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.sidebar-close {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: var(--space-2);
    cursor: pointer;
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-item .badge,
.sidebar.collapsed .submenu-arrow {
    display: none;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4) 0;
}

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

.nav-section-title {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: var(--space-2) var(--space-5);
    margin-bottom: var(--space-1);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-5);
    color: var(--text-secondary);
    font-weight: 500;
    transition: all var(--transition-speed);
    position: relative;
    margin: 0 var(--space-3);
    border-radius: var(--radius);
}

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

.nav-item.active {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.15), transparent);
    color: #667eea;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    background: var(--gradient-primary);
    border-radius: var(--radius);
}

.nav-item i {
    font-size: 1.125rem;
    width: 24px;
    text-align: center;
}

.nav-item .badge {
    margin-left: auto;
    font-size: 0.6875rem;
    padding: 0.25em 0.6em;
}

.nav-item.has-submenu {
    cursor: pointer;
}

.submenu-arrow {
    margin-left: auto;
    font-size: 0.75rem;
    transition: transform var(--transition-speed);
}

.nav-item[aria-expanded="true"] .submenu-arrow {
    transform: rotate(180deg);
}

.submenu {
    background: rgba(0, 0, 0, 0.02);
}

.nav-item.sub-item {
    padding-left: var(--space-8);
    font-size: 0.875rem;
}

.nav-item.sub-item i {
    font-size: 1.5rem;
    color: var(--text-muted);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--border-color);
}

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

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-dot.online {
    background: var(--success);
}

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

/* ============================================
   MAIN CONTENT AREA
   ============================================ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition-speed);
}

.sidebar.collapsed ~ .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

/* ============================================
   TOP HEADER
   ============================================ */
.top-header {
    height: var(--header-height);
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-6);
    position: sticky;
    top: 0;
    z-index: 1030;
    box-shadow: var(--shadow-sm);
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

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

.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: var(--bg-light);
    border-radius: var(--radius);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-speed);
}

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

.header-search {
    position: relative;
    width: 320px;
}

.header-search i {
    position: absolute;
    left: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.header-search .form-control {
    padding-left: 2.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    background: var(--bg-light);
    transition: all var(--transition-speed);
}

.header-search .form-control:focus {
    background: var(--bg-white);
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    border-radius: var(--radius);
    color: var(--text-secondary);
    position: relative;
    transition: all var(--transition-speed);
}

.btn-icon:hover {
    background: var(--bg-light);
    color: var(--text-primary);
}

.btn-ai-toggle {
    background: var(--gradient-primary);
    color: white;
}

.btn-ai-toggle:hover {
    transform: scale(1.05);
    color: white;
}

.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    background: var(--danger);
    color: white;
    font-size: 0.6875rem;
    font-weight: 600;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* User Dropdown */
.user-dropdown .btn {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2);
    border: none;
    background: transparent;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
}

.user-avatar.user-avatar-lg {
    width: 48px;
    height: 48px;
    font-size: 1rem;
}

.user-info {
    text-align: left;
}

.user-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
    display: block;
}

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

.user-dropdown .dropdown-menu {
    width: 260px;
    padding: 0;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-md);
}

.user-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--bg-light);
}

.user-details h6 {
    margin: 0;
    font-weight: 600;
}

.user-details p {
    margin: 0;
    font-size: 0.8125rem;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    font-size: 0.875rem;
    transition: all var(--transition-speed);
}

.dropdown-item i {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    color: var(--text-muted);
}

.dropdown-item:hover {
    background: var(--bg-light);
}

.dropdown-item:hover i {
    color: var(--text-primary);
}

/* Notification Dropdown */
.notification-dropdown {
    width: 360px;
    padding: 0;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-md);
}

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

.notification-dropdown .dropdown-header h6 {
    margin: 0;
    font-weight: 600;
}

.notification-list {
    max-height: 320px;
    overflow-y: auto;
}

.notification-item {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    transition: background var(--transition-speed);
}

.notification-item:hover {
    background: var(--bg-light);
}

.notification-item.unread {
    background: rgba(102, 126, 234, 0.05);
}

.notification-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-text {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.notification-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.notification-dropdown .dropdown-footer {
    padding: var(--space-3);
    text-align: center;
    border-top: 1px solid var(--border-color);
}

/* ============================================
   CONTENT AREA
   ============================================ */
.content-area {
    flex: 1;
    padding: var(--space-6);
}

/* Page Header */
.page-header {
    margin-bottom: var(--space-6);
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

.page-header p {
    margin: var(--space-1) 0 0;
    color: var(--text-muted);
}

.page-actions {
    display: flex;
    gap: var(--space-3);
}

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

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: var(--space-4) var(--space-5);
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

.card-body {
    padding: var(--space-5);
}

.card-footer {
    padding: var(--space-4) var(--space-5);
    background: var(--bg-light);
    border-top: 1px solid var(--border-color);
}

/* Metric Cards */
.metric-card {
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}

.metric-card.primary::before { background: var(--gradient-primary); }
.metric-card.success::before { background: var(--gradient-success); }
.metric-card.warning::before { background: var(--gradient-warning); }
.metric-card.danger::before { background: var(--gradient-danger); }
.metric-card.info::before { background: #17A2B8; }
.metric-card.secondary::before { background: var(--gradient-secondary); }

.metric-card .card-body {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.metric-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.metric-card.primary .metric-icon { background: var(--gradient-primary); }
.metric-card.success .metric-icon { background: var(--gradient-success); }
.metric-card.warning .metric-icon { background: var(--gradient-warning); }
.metric-card.danger .metric-icon { background: var(--gradient-danger); }
.metric-card.info .metric-icon { background: #17A2B8; }
.metric-card.secondary .metric-icon { background: var(--gradient-secondary); }

.metric-content {
    flex: 1;
}

.metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.metric-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: var(--space-1);
}

.metric-trend {
    font-size: 0.8125rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.metric-trend.success { color: var(--success); }
.metric-trend.danger { color: var(--danger); }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    font-weight: 500;
    border-radius: var(--radius);
    padding: var(--space-2) var(--space-4);
    transition: all var(--transition-speed);
}

.btn-primary {
    background: var(--gradient-primary);
    border: none;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.35);
    background: var(--gradient-primary);
}

.btn-outline-primary {
    border: 2px solid #667eea;
    color: #667eea;
}

.btn-outline-primary:hover {
    background: var(--gradient-primary);
    border-color: transparent;
    color: white;
}

/* ============================================
   FORMS
   ============================================ */
.form-label {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.form-label .required {
    color: var(--danger);
}

.form-control {
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    transition: all var(--transition-speed);
}

.form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.form-text {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: var(--space-1);
}

/* ============================================
   TABLES
   ============================================ */
.table {
    font-size: 0.875rem;
}

.table th {
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    background: var(--bg-light);
    border-bottom: 2px solid var(--border-color);
}

.table td {
    vertical-align: middle;
    color: var(--text-primary);
}

.table-hover tbody tr:hover {
    background: rgba(102, 126, 234, 0.03);
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25em 0.75em;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-full);
}

.status-badge.active {
    background: rgba(40, 167, 69, 0.1);
    color: var(--success);
}

.status-badge.pending {
    background: rgba(255, 193, 7, 0.1);
    color: #b38600;
}

.status-badge.completed {
    background: rgba(13, 110, 253, 0.1);
    color: var(--secondary-blue);
}

.status-badge.failed {
    background: rgba(220, 53, 69, 0.1);
    color: var(--danger);
}

/* ============================================
   AI CHAT WIDGET
   ============================================ */
.ai-chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1050;
}

.ai-chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--gradient-primary);
    border: none;
    color: white;
    font-size: 1.5rem;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    cursor: pointer;
    position: relative;
    transition: all var(--transition-speed);
}

.ai-chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 28px rgba(102, 126, 234, 0.5);
}

.ai-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--danger);
    color: white;
    font-size: 0.6875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s infinite;
}

.ai-chat-panel {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 400px;
    height: 600px;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}

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

.ai-chat-header {
    background: var(--gradient-primary);
    color: white;
    padding: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.ai-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.ai-title {
    flex: 1;
}

.ai-name {
    font-weight: 600;
    font-size: 1rem;
}

.ai-status {
    font-size: 0.75rem;
    opacity: 0.8;
}

.ai-chat-close {
    background: none;
    border: none;
    color: white;
    opacity: 0.8;
    font-size: 1.25rem;
    padding: var(--space-2);
    cursor: pointer;
    transition: opacity var(--transition-speed);
}

.ai-chat-close:hover {
    opacity: 1;
}

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4);
    background: var(--bg-light);
}

.ai-message {
    display: flex;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

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

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.message-content {
    max-width: 80%;
    background: var(--bg-white);
    padding: var(--space-3);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
}

.ai-message.user .message-content {
    background: var(--gradient-primary);
    color: white;
}

.message-text {
    font-size: 0.875rem;
    line-height: 1.5;
}

.message-text ul {
    margin: var(--space-2) 0 0;
    padding-left: var(--space-4);
}

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

.message-time {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-top: var(--space-1);
}

.ai-message.user .message-time {
    color: rgba(255, 255, 255, 0.7);
}

.ai-chat-input {
    border-top: 1px solid var(--border-color);
    background: var(--bg-white);
}

.ai-suggestions {
    padding: var(--space-3);
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border-color);
}

.suggestion-chip {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-full);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all var(--transition-speed);
}

.suggestion-chip:hover {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

.input-wrapper {
    display: flex;
    padding: var(--space-3);
    gap: var(--space-2);
}

.input-wrapper textarea {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: var(--space-3);
    resize: none;
    font-size: 0.875rem;
    max-height: 100px;
}

.input-wrapper textarea:focus {
    outline: none;
    border-color: #667eea;
}

.input-wrapper button {
    align-self: flex-end;
    height: 40px;
    width: 40px;
    padding: 0;
    border-radius: var(--radius);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: var(--space-2);
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #667eea;
    animation: typing 1.4s infinite;
}

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

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

/* ============================================
   LOADING OVERLAY
   ============================================ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-speed);
}

[data-bs-theme="dark"] .loading-overlay {
    background: rgba(26, 32, 44, 0.9);
}

.loading-overlay.show {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    text-align: center;
}

.loading-message {
    margin-top: var(--space-3);
    color: var(--text-muted);
    font-weight: 500;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .header-search {
        display: none;
    }
    
    .ai-chat-panel {
        width: calc(100vw - 48px);
        height: calc(100vh - 120px);
    }
}

@media (max-width: 575.98px) {
    .content-area {
        padding: var(--space-4);
    }
    
    .metric-card .card-body {
        flex-direction: column;
        text-align: center;
    }
    
    .ai-chat-panel {
        width: calc(100vw - 24px);
        right: -12px;
    }
}

/* ============================================
   WORKFLOW DESIGNER STYLES
   ============================================ */
.workflow-designer {
    display: flex;
    height: calc(100vh - var(--header-height) - var(--space-12));
    background: var(--bg-light);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.node-palette {
    width: 280px;
    background: var(--bg-white);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.node-palette-header {
    padding: var(--space-4);
    border-bottom: 1px solid var(--border-color);
}

.node-palette-search {
    padding: var(--space-3);
    border-bottom: 1px solid var(--border-color);
}

.node-palette-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-3);
}

.node-category {
    margin-bottom: var(--space-4);
}

.node-category-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: var(--space-2);
    padding: 0 var(--space-2);
}

.node-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    background: var(--bg-light);
    border-radius: var(--radius);
    cursor: grab;
    transition: all var(--transition-speed);
    margin-bottom: var(--space-2);
}

.node-item:hover {
    background: var(--border-color);
    transform: translateX(4px);
}

.node-item:active {
    cursor: grabbing;
}

.node-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
}

.node-icon.trigger { background: #28A745; }
.node-icon.action { background: #0D6EFD; }
.node-icon.logic { background: #FFC107; }
.node-icon.ai { background: var(--gradient-primary); }
.node-icon.data { background: #6F42C1; }
.node-icon.integration { background: #17A2B8; }
.node-icon.end { background: #DC3545; }

.node-info {
    flex: 1;
}

.node-name {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.node-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Canvas */
.workflow-canvas-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.workflow-canvas {
    width: 100%;
    height: 100%;
    position: relative;
    background-image: 
        radial-gradient(circle, var(--border-color) 1px, transparent 1px);
    background-size: 20px 20px;
}

.workflow-canvas-toolbar {
    position: absolute;
    top: var(--space-4);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    display: flex;
    padding: var(--space-2);
    gap: var(--space-2);
}

.canvas-zoom-controls {
    position: absolute;
    bottom: var(--space-4);
    left: var(--space-4);
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    padding: var(--space-2);
}

/* Properties Panel */
.properties-panel {
    width: 320px;
    background: var(--bg-white);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.properties-header {
    padding: var(--space-4);
    border-bottom: 1px solid var(--border-color);
}

.properties-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4);
}

.property-group {
    margin-bottom: var(--space-5);
}

.property-group-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: var(--space-3);
}

/* ============================================
   CHART STYLES
   ============================================ */
.chart-container {
    position: relative;
    height: 300px;
}

.chart-legend {
    display: flex;
    justify-content: center;
    gap: var(--space-6);
    margin-top: var(--space-4);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.text-primary-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bg-gradient-primary {
    background: var(--gradient-primary);
}

.border-start-primary {
    border-left: 4px solid #667eea !important;
}

.border-start-success {
    border-left: 4px solid var(--success) !important;
}

.border-start-warning {
    border-left: 4px solid var(--warning) !important;
}

.border-start-danger {
    border-left: 4px solid var(--danger) !important;
}

.border-start-info {
    border-left: 4px solid var(--info) !important;
}
