/* ========================================
   MODERN UI SYSTEM - Dark/Light Mode
   ======================================== */

:root {
    /* Light Mode Colors - Ultra Modern Vibrant */
    --bg-primary: #fafafa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f4f4f5;
    --bg-elevated: #ffffff;

    --text-primary: #18181b;
    --text-secondary: #52525b;
    --text-tertiary: #a1a1aa;

    --border-primary: #e4e4e7;
    --border-secondary: #d4d4d8;

    /* Vibrant Purple/Violet Primary */
    --accent-primary: #8b5cf6;
    --accent-secondary: #7c3aed;
    --accent-gradient: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 50%, #7c3aed 100%);
    --accent-glow: 0 0 30px rgba(139, 92, 246, 0.5);

    /* Cyan/Turquoise Accent */
    --secondary-gradient: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);

    /* Pink/Magenta Accent */
    --tertiary-gradient: linear-gradient(135deg, #ec4899 0%, #d946ef 100%);

    /* Status Colors - More Vibrant */
    --success: #10b981;
    --success-gradient: linear-gradient(135deg, #34d399 0%, #10b981 100%);
    --warning: #f59e0b;
    --warning-gradient: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    --error: #ef4444;
    --error-gradient: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
    --info: #3b82f6;
    --info-gradient: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);

    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 12px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 12px 24px -4px rgb(0 0 0 / 0.15);
    --shadow-xl: 0 20px 40px -8px rgb(0 0 0 / 0.2);
    --shadow-colored: 0 8px 24px -4px rgb(139 92 246 / 0.3);

    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    /* Dark Mode - Deep Dark with Vibrant Accents */
    --bg-primary: #0a0a0a;
    --bg-secondary: #171717;
    --bg-tertiary: #262626;
    --bg-elevated: #1c1c1c;

    --text-primary: #fafafa;
    --text-secondary: #d4d4d8;
    --text-tertiary: #71717a;

    --border-primary: #27272a;
    --border-secondary: #3f3f46;

    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.5);
    --shadow-md: 0 4px 12px -2px rgb(0 0 0 / 0.5);
    --shadow-lg: 0 12px 24px -4px rgb(0 0 0 / 0.6);
    --shadow-xl: 0 20px 40px -8px rgb(0 0 0 / 0.7);
    --shadow-colored: 0 8px 32px -4px rgb(139 92 246 / 0.6);
    --accent-glow: 0 0 40px rgba(139, 92, 246, 0.7);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    background-image:
        radial-gradient(at 0% 0%, rgba(139, 92, 246, 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(6, 182, 212, 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(236, 72, 153, 0.05) 0px, transparent 50%),
        radial-gradient(at 0% 100%, rgba(16, 185, 129, 0.05) 0px, transparent 50%);
    color: var(--text-primary);
    line-height: 1.6;
    transition: var(--transition);
}

[data-theme="dark"] body {
    background-image:
        radial-gradient(at 0% 0%, rgba(139, 92, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(6, 182, 212, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(236, 72, 153, 0.15) 0px, transparent 50%),
        radial-gradient(at 0% 100%, rgba(16, 185, 129, 0.15) 0px, transparent 50%);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========================================
   HEADER - Modern Glassmorphism
   ======================================== */

header {
    background: var(--bg-elevated);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-primary);
    padding: 1.25rem 2rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.25rem;
    filter: drop-shadow(0 0 20px rgba(139, 92, 246, 0.3));
}

nav {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-md);
    transition: var(--transition);
    font-weight: 500;
    font-size: 0.95rem;
    position: relative;
}

.nav-link:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.nav-link.active {
    background: var(--accent-gradient);
    color: white;
    box-shadow: var(--shadow-md);
}

/* Theme Toggle */
.theme-toggle {
    padding: 0.625rem;
    background: var(--bg-tertiary);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    width: 2.75rem;
    height: 2.75rem;
}

.theme-toggle:hover {
    background: var(--bg-tertiary);
    transform: rotate(180deg);
    box-shadow: var(--shadow-md);
}

/* ========================================
   MAIN CONTENT
   ======================================== */

main {
    flex: 1;
    padding: 2rem;
    max-width: 100%;
}

/* ========================================
   CARDS - Modern Elevated Design
   ======================================== */

.stat-card, .metric-card {
    background: var(--bg-secondary);
    padding: 1.75rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-primary);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before, .metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--accent-gradient);
    opacity: 0;
    transition: var(--transition);
}

.stat-card:hover, .metric-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-colored);
    border-color: var(--accent-primary);
}

.stat-card:hover::before, .metric-card:hover::before {
    opacity: 1;
}

.metric-card.success::before { background: var(--success-gradient); }
.metric-card.warning::before { background: var(--warning-gradient); }
.metric-card.info::before { background: var(--info-gradient); }
.metric-card.danger::before { background: var(--error-gradient); }
.metric-card.purple::before { background: var(--tertiary-gradient); }

.stat-card h3, .metric-label {
    color: var(--text-tertiary);
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.stat-value, .metric-value {
    font-size: 2.5rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0.5rem 0;
    line-height: 1;
}

.metric-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.metric-icon {
    font-size: 2rem;
    opacity: 0.7;
    filter: grayscale(20%);
}

.metric-subtext {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* ========================================
   GRIDS - Responsive
   ======================================== */

.stats-grid, .dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* ========================================
   BUTTONS - Modern & Accessible
   ======================================== */

.btn-small, button {
    padding: 0.75rem 1.5rem;
    background: var(--accent-gradient);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-sm);
}

.btn-small:hover, button:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-colored);
    filter: brightness(1.15);
}

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

.btn-delete, .btn-danger {
    background: var(--error-gradient);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-delete:hover, .btn-danger:hover {
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.5);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* ========================================
   BADGES - Colorful & Modern
   ======================================== */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.875rem;
    border-radius: 9999px;
    font-size: 0.8125rem;
    font-weight: 600;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
}

.badge-hot {
    background: var(--error-gradient);
    color: white;
    border: none;
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.6), 0 4px 12px rgba(239, 68, 68, 0.3);
    animation: pulse-glow 2s ease-in-out infinite;
}

.badge-warm {
    background: var(--warning-gradient);
    color: white;
    border: none;
    box-shadow: 0 0 30px rgba(245, 158, 11, 0.6), 0 4px 12px rgba(245, 158, 11, 0.3);
}

.badge-cold {
    background: var(--info-gradient);
    color: white;
    border: none;
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.6), 0 4px 12px rgba(59, 130, 246, 0.3);
}

.badge-meta {
    background: var(--accent-gradient);
    color: white;
    border: none;
    box-shadow: 0 0 30px rgba(139, 92, 246, 0.6), 0 4px 12px rgba(139, 92, 246, 0.3);
    animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 30px rgba(139, 92, 246, 0.6), 0 4px 12px rgba(139, 92, 246, 0.3);
    }
    50% {
        box-shadow: 0 0 50px rgba(139, 92, 246, 0.9), 0 4px 16px rgba(139, 92, 246, 0.5);
    }
}

/* ========================================
   SECTIONS - Clean Spacing
   ======================================== */

.section, .chart-section {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-primary);
    margin-bottom: 2rem;
}

.section h2, .chart-section h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* ========================================
   LISTS - Contacts & Leads
   ======================================== */

.contacts-list, .leads-list, .documents-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.contact-item, .lead-item, .document-item {
    background: var(--bg-elevated);
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-primary);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.contact-item:hover, .lead-item:hover, .document-item:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-primary);
}

.contact-avatar {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    background: var(--accent-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    box-shadow: var(--shadow-colored);
}

/* ========================================
   PIPELINE BARS - Modern Visualization
   ======================================== */

.pipeline-bars {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.pipeline-bar {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.pipeline-label {
    min-width: 140px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.pipeline-track {
    flex: 1;
    height: 3rem;
    background: var(--bg-tertiary);
    border-radius: 9999px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-primary);
}

.pipeline-fill {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 1.25rem;
    color: white;
    font-weight: 700;
    font-size: 0.95rem;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    background: var(--accent-gradient);
}

.pipeline-fill::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: shimmer 2s infinite;
}

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

/* ========================================
   QUICK ACTIONS - Card Grid
   ======================================== */

.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.quick-action-btn {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-primary);
    text-decoration: none;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: var(--transition);
}

.quick-action-btn:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: var(--accent-primary);
    background: var(--bg-elevated);
}

.quick-action-icon {
    font-size: 2.5rem;
    filter: grayscale(20%);
}

.quick-action-label {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.quick-action-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ========================================
   ALERTS - Modern Notifications
   ======================================== */

.alert-box {
    background: var(--bg-secondary);
    border-left: 4px solid var(--warning);
    padding: 1.25rem 1.75rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-primary);
    border-left: 4px solid var(--warning);
}

.alert-box.hidden {
    display: none;
}

.alert-icon {
    font-size: 2rem;
}

.alert-title {
    font-weight: 600;
    margin-bottom: 0.375rem;
    color: var(--text-primary);
}

.alert-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* ========================================
   CHAT LAYOUT
   ======================================== */

.chat-layout {
    display: flex;
    gap: 0;
    height: calc(100vh - 200px);
    margin: 0 -2rem;
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.contacts-sidebar {
    width: 380px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-primary);
    display: flex;
    flex-direction: column;
}

.search-box {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-primary);
}

.search-box input {
    width: 100%;
    padding: 0.875rem 1.125rem;
    border: 2px solid var(--border-primary);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: var(--transition);
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2), 0 0 20px rgba(139, 92, 246, 0.1);
}

.messages-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

.chat-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-primary);
    color: var(--text-primary);
    padding: 1.25rem 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.messages-list {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.message-bubble {
    background: var(--bg-secondary);
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-primary);
    max-width: 70%;
}

.message.outgoing .message-bubble {
    background: var(--accent-gradient);
    color: white;
    border: none;
    box-shadow: var(--shadow-md);
}

/* ========================================
   LOGS - Terminal Style
   ======================================== */

.logs-container {
    background: #1a1b26;
    color: #a9b1d6;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    font-size: 0.875rem;
    max-height: calc(100vh - 300px);
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
}

[data-theme="dark"] .logs-container {
    background: #0d1117;
}

.log-entry {
    padding: 0.625rem 0;
    border-bottom: 1px solid rgba(169, 177, 214, 0.1);
    display: flex;
    gap: 1.25rem;
    font-size: 0.875rem;
}

.log-level-error { color: #f7768e; }
.log-level-info { color: #7dcfff; }
.log-level-debug { color: #bb9af7; }

/* ========================================
   FORMS - Modern Input Design
   ======================================== */

input[type="text"],
input[type="number"],
input[type="email"],
input[type="datetime-local"],
textarea,
select {
    width: 100%;
    padding: 0.875rem 1.125rem;
    border: 2px solid var(--border-primary);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: var(--transition);
    font-family: inherit;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2), 0 0 20px rgba(139, 92, 246, 0.1);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

/* ========================================
   FOOTER
   ======================================== */

footer {
    text-align: center;
    padding: 1.5rem;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-primary);
}

.version-info {
    font-size: 0.8125rem;
    color: var(--text-tertiary);
    margin-top: 0.5rem;
}

/* ========================================
   UTILITIES
   ======================================== */

.loading, .empty {
    text-align: center;
    color: var(--text-tertiary);
    padding: 3rem;
    font-size: 1.125rem;
}

.tech-link {
    display: inline-block;
    margin-top: 1.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition);
    border: 1px solid var(--border-primary);
}

.tech-link:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ========================================
   SCROLLBAR - Modern Minimal
   ======================================== */

::-webkit-scrollbar {
    width: 10px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border-secondary);
    border-radius: 9999px;
}

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

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
    main {
        padding: 1rem;
    }

    header {
        flex-direction: column;
        gap: 1rem;
    }

    .stats-grid, .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .chat-layout {
        flex-direction: column;
        height: auto;
    }

    .contacts-sidebar {
        width: 100%;
    }
}

/* ========================================
   BOT MODAL - Polished Dialog Design
   ======================================== */

.bot-modal {
    border: none;
    padding: 0;
    max-width: 920px;
    width: calc(100vw - 4rem);
    max-height: calc(100vh - 4rem);
    background: transparent;
    overflow: visible;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
}

.bot-modal::backdrop {
    background: rgba(10, 10, 10, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    animation: fadeInBackdrop 0.3s ease-out;
}

.bot-modal[open] {
    animation: slideUpModal 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.bot-modal-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl), 0 0 0 1px var(--border-primary);
    overflow: hidden;
    max-height: calc(100vh - 4rem);
    display: flex;
    flex-direction: column;
}

.bot-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-primary);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.05), rgba(6, 182, 212, 0.05));
}

.bot-modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

.bot-modal-close {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-md);
    font-size: 1.75rem;
    line-height: 1;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.bot-modal-close:hover {
    background: var(--error);
    color: white;
    border-color: var(--error);
    transform: rotate(90deg);
}

.bot-form {
    padding: 2rem;
    overflow-y: auto;
    overflow-x: hidden;
}

.bot-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 1.5rem;
}

.bot-form-section {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.bot-form-section-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-primary);
}

.bot-form-section-title .optional {
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--text-tertiary);
}

.bot-form-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.bot-form-full-width {
    grid-column: 1 / -1;
}

.bot-form-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.bot-form-label .required {
    color: var(--error);
    font-size: 1rem;
}

.bot-form-input,
.bot-form-textarea {
    width: 100%;
    padding: 0.875rem 1.125rem;
    border: 2px solid var(--border-primary);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: var(--transition);
    font-family: inherit;
}

.bot-form-input:focus,
.bot-form-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2), 0 0 20px rgba(139, 92, 246, 0.1);
}

.bot-form-textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.6;
}

.bot-form-help {
    font-size: 0.8125rem;
    color: var(--text-tertiary);
    line-height: 1.5;
}

.bot-form-input-group {
    display: flex;
    gap: 0.625rem;
}

.bot-form-input-group .bot-form-input {
    flex: 1;
}

.bot-test-btn {
    padding: 0.875rem 1.25rem;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 2px solid var(--border-secondary);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.bot-test-btn:hover {
    background: var(--bg-elevated);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.bot-form-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.125rem;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-primary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
}

.bot-form-checkbox-label:hover {
    border-color: var(--accent-primary);
    background: var(--bg-elevated);
}

.bot-form-checkbox {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
    accent-color: var(--accent-primary);
}

.bot-form-advanced {
    margin-top: 0.5rem;
    border: 2px solid var(--border-primary);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.bot-form-advanced-summary {
    padding: 1rem 1.25rem;
    background: var(--bg-tertiary);
    cursor: pointer;
    font-weight: 600;
    color: var(--text-secondary);
    transition: var(--transition);
    user-select: none;
}

.bot-form-advanced-summary:hover {
    background: var(--bg-elevated);
    color: var(--accent-primary);
}

.bot-form-advanced[open] .bot-form-advanced-summary {
    border-bottom: 1px solid var(--border-primary);
    background: var(--bg-elevated);
    color: var(--accent-primary);
}

.bot-form-advanced-content {
    padding: 1.5rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.bot-form-status {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    margin: 1rem 0;
    font-size: 0.95rem;
    font-weight: 500;
    border: 2px solid transparent;
    transition: var(--transition);
}

.bot-form-status.success {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: #166534;
    border-color: #86efac;
}

.bot-form-status.error {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    border-color: #fca5a5;
}

.bot-form-status.warning {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    border-color: #fcd34d;
}

.bot-form-status.info {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
    border-color: #93c5fd;
}

.bot-form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-primary);
    margin-top: 1.5rem;
}

.bot-btn-cancel {
    padding: 0.875rem 1.75rem;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 2px solid var(--border-secondary);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.bot-btn-cancel:hover {
    background: var(--bg-elevated);
    border-color: var(--text-tertiary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.bot-btn-submit {
    padding: 0.875rem 2rem;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.bot-btn-submit:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-colored);
    filter: brightness(1.15);
}

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

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

@keyframes slideUpModal {
    from {
        opacity: 0;
        transform: translate(-50%, calc(-50% + 40px)) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@media (max-width: 768px) {
    .bot-modal {
        width: calc(100vw - 2rem);
        max-width: 100%;
    }

    .bot-form-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .bot-modal-header {
        padding: 1.25rem 1.5rem;
    }

    .bot-form {
        padding: 1.5rem;
    }
}

/* ========================================
   ANIMATIONS
   ======================================== */

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

.stat-card, .metric-card, .section {
    animation: fadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
