/* ============================================
   MY REPORT - STYLES PRINCIPAUX
   Design moderne avec dark mode et glassmorphism
   ============================================ */

/* Variables CSS */
:root {
    /* Couleurs principales */
    --primary-hue: 250;
    --primary: hsl(var(--primary-hue), 100%, 65%);
    --primary-dark: hsl(var(--primary-hue), 100%, 55%);
    --primary-light: hsl(var(--primary-hue), 100%, 75%);
    --primary-glow: hsla(var(--primary-hue), 100%, 65%, 0.3);

    --accent-hue: 340;
    --accent: hsl(var(--accent-hue), 100%, 65%);

    /* Couleurs de fond */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a25;
    --bg-elevated: #22222f;

    /* Couleurs de texte */
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #606070;

    /* Couleurs sémantiques */
    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;

    /* Bordures et surfaces */
    --border-color: rgba(255, 255, 255, 0.08);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.1);

    /* Ombres */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 30px var(--primary-glow);

    /* Rayons de bordure */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;

    /* Espacement */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
}

/* Reset et base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Typographie */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    line-height: 1.3;
}

h1 {
    font-size: 2rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.25rem;
}

h4 {
    font-size: 1.125rem;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-light);
}

/* ============================================
   COMPOSANTS RÉUTILISABLES
   ============================================ */

/* Boutons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: var(--shadow-sm), 0 0 20px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md), 0 0 30px var(--primary-glow);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

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

.btn-full {
    width: 100%;
}

.btn-sm {
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.85rem;
}

.btn-icon {
    padding: var(--space-sm);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
}

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

/* Inputs */
.form-input {
    width: 100%;
    padding: var(--space-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all var(--transition-fast);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-group {
    margin-bottom: var(--space-lg);
}

.form-group label {
    display: block;
    margin-bottom: var(--space-sm);
    font-weight: 500;
    color: var(--text-secondary);
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 1.25rem;
    font-weight: 700;
}

.logo-icon {
    font-size: 1.5em;
}

/* ============================================
   PAGE D'ONBOARDING
   ============================================ */

.onboarding-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: var(--space-lg);
}

.onboarding-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2xl);
    max-width: 1000px;
    width: 100%;
}

.onboarding-card {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl);
    backdrop-filter: blur(20px);
}

.onboarding-header {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.onboarding-header h1 {
    margin: var(--space-lg) 0 var(--space-sm);
    background: linear-gradient(135deg, var(--text-primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.onboarding-header .subtitle {
    color: var(--text-secondary);
}

.privacy-note {
    margin-top: var(--space-lg);
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
}

.onboarding-visual {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.visual-blob {
    position: absolute;
    width: 300px;
    height: 300px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: blob-pulse 4s ease-in-out infinite;
}

@keyframes blob-pulse {

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

    50% {
        transform: scale(1.1);
    }
}

.visual-content {
    position: relative;
    z-index: 1;
}

.feature-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.feature {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    backdrop-filter: blur(10px);
}

.feature-icon {
    font-size: 1.5rem;
}

/* ============================================
   PAGE DE CHAT
   ============================================ */

.chat-page {
    height: 100vh;
    overflow: hidden;
}

.chat-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: var(--space-lg);
}

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

.user-info {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--glass-bg);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-xl);
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
}

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

.user-name {
    font-weight: 600;
}

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

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

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

.nav-item.active {
    background: var(--primary-glow);
    color: var(--primary-light);
}

.sidebar-footer {
    margin-top: auto;
}

/* Zone principale du chat */
.chat-main {
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    height: 100vh;
    overflow: hidden;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg) var(--space-xl);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

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

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

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.connection-status.disconnected .status-dot {
    background: var(--error);
    animation: none;
}

/* Container des messages */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-xl);
    scroll-behavior: smooth;
}

/* Empty state */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: var(--space-lg);
}

.empty-state h2 {
    margin-bottom: var(--space-sm);
}

/* Messages */
.message {
    display: flex;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    animation: message-in 0.3s ease;
}

@keyframes message-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.message-avatar {
    width: 36px;
    height: 36px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.message-content {
    flex: 1;
    max-width: 80%;
}

.message-text {
    background: var(--bg-secondary);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.message-user .message-text {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
}

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

/* Zone d'input */
.chat-input-area {
    padding: var(--space-lg) var(--space-xl);
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.upload-zone {
    margin-bottom: var(--space-md);
}

.file-input-hidden {
    display: none;
}

.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-lg);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--text-muted);
}

.upload-label:hover {
    border-color: var(--primary);
    background: var(--glass-bg);
}

.upload-icon {
    font-size: 1.5rem;
}

.upload-types {
    font-size: 0.8rem;
}

.message-input-container {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.message-input {
    flex: 1;
    padding: var(--space-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    resize: none;
    min-height: 44px;
    max-height: 120px;
}

.message-input:focus {
    outline: none;
    border-color: var(--primary);
}

.btn-send {
    height: 44px;
}

/* ============================================
   PRÉVISUALISATION DE FICHIER
   ============================================ */

.file-preview {
    margin-bottom: var(--space-lg);
}

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

.preview-stats {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.preview-table-container {
    overflow-x: auto;
    margin-bottom: var(--space-lg);
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.preview-table th,
.preview-table td {
    padding: var(--space-sm) var(--space-md);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.preview-table th {
    background: var(--bg-tertiary);
    font-weight: 500;
}

.column-header {
    display: flex;
    flex-direction: column;
}

.column-type {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: normal;
}

.column-selection-form {
    padding-top: var(--space-md);
}

.selection-hint {
    margin-bottom: var(--space-md);
    color: var(--text-secondary);
}

.column-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

.column-checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.column-checkbox-label:hover {
    background: var(--glass-bg);
}

.column-checkbox-label input:checked+span {
    color: var(--primary);
}

.selection-actions {
    display: flex;
    gap: var(--space-sm);
}

/* ============================================
   WIDGETS
   ============================================ */

.widget {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin: var(--space-md) 0;
}

.widget-title {
    margin-bottom: var(--space-md);
    font-size: 1rem;
}

.widget-chart .widget-content {
    height: 200px;
}

.widget-stat {
    text-align: center;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-unit {
    font-size: 1rem;
    margin-left: var(--space-xs);
}

.stat-trend {
    display: block;
    font-size: 0.9rem;
    margin-top: var(--space-sm);
}

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

.trend-down {
    color: var(--error);
}

.widget-insight {
    display: flex;
    gap: var(--space-md);
}

.widget-icon {
    font-size: 1.5rem;
}

.widget-body {
    flex: 1;
}

.chart-container {
    position: relative;
    height: 250px;
    width: 100%;
}

.widget-info {
    border-left: 3px solid var(--info);
}

.widget-success {
    border-left: 3px solid var(--success);
}

.widget-warning {
    border-left: 3px solid var(--warning);
}

.widget-error {
    border-left: 3px solid var(--error);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: var(--space-sm);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    font-weight: 500;
    color: var(--text-secondary);
}

/* ============================================
   ÉTATS SPÉCIAUX
   ============================================ */

.message-error .message-content {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error);
    border-radius: var(--radius-md);
    padding: var(--space-md);
}

.selection-confirmed {
    animation: success-glow 0.5s ease;
}

@keyframes success-glow {

    0%,
    100% {
        box-shadow: none;
    }

    50% {
        box-shadow: 0 0 20px rgba(34, 197, 94, 0.3);
    }
}

.confirmed-message strong {
    color: var(--primary);
}

.columns-list {
    color: var(--text-secondary);
}

.hint {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: var(--space-sm) 0;
}

/* Agent thinking animation */
.agent-thinking {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--text-muted);
    padding: var(--space-md);
}

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

.thinking-dots span {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    animation: thinking 1.4s infinite ease-in-out both;
}

.thinking-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.thinking-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes thinking {

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

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .onboarding-container {
        grid-template-columns: 1fr;
    }

    .onboarding-visual {
        display: none;
    }

    .chat-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }
}

/* ============================================
   FICHIER ATTACHÉ
   ============================================ */

.attached-file {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(168, 85, 247, 0.15));
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    animation: slide-in 0.2s ease;
}

@keyframes slide-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

.attached-file-info {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.attached-file-info .file-icon {
    font-size: 1.2rem;
}

.attached-file-info .file-name {
    font-weight: 500;
    color: var(--primary-light);
}

.btn-remove-file {
    width: 24px;
    height: 24px;
    background: rgba(239, 68, 68, 0.2);
    border: none;
    border-radius: 50%;
    color: var(--error);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: all var(--transition-fast);
}

.btn-remove-file:hover {
    background: rgba(239, 68, 68, 0.4);
}

.btn-icon.has-file {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-color: var(--primary);
    color: white;
}

.input-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: var(--space-sm);
    text-align: center;
}

/* Drag & Drop */
.chat-main.drag-over {
    position: relative;
}

.chat-main.drag-over::after {
    content: "📎 Déposez votre fichier ici";
    position: absolute;
    inset: 0;
    background: rgba(99, 102, 241, 0.1);
    border: 3px dashed var(--primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--primary);
    z-index: 100;
    backdrop-filter: blur(4px);
}

/* ============================================
   WIDGETS AMÉLIORÉS
   ============================================ */

.widget {
    background: linear-gradient(145deg, var(--bg-secondary), var(--bg-tertiary));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin: var(--space-lg) 0;
    box-shadow: var(--shadow-md);
    animation: widget-in 0.4s ease;
}

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

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

.widget-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: var(--space-md);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* Widget Chart */
.widget-chart {
    padding: var(--space-lg);
}

.widget-chart .chart-container {
    height: 280px;
    position: relative;
}

/* Widget Stat */
.widget-stat {
    text-align: center;
    padding: var(--space-xl) var(--space-lg);
}

.widget-stat .stat-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-value {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.stat-unit {
    font-size: 1.2rem;
    opacity: 0.8;
}

.stat-trend {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-full);
    font-size: 0.9rem;
    font-weight: 500;
    margin-top: var(--space-sm);
}

.trend-up {
    color: var(--success);
    background: rgba(34, 197, 94, 0.15);
}

.trend-down {
    color: var(--error);
    background: rgba(239, 68, 68, 0.15);
}

.stat-description {
    margin-top: var(--space-md);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Widget Table */
.widget-table .table-content {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    padding: var(--space-md);
    text-align: left;
}

.data-table th:first-child {
    border-radius: var(--radius-sm) 0 0 0;
}

.data-table th:last-child {
    border-radius: 0 var(--radius-sm) 0 0;
}

.data-table td {
    padding: var(--space-md);
    border-bottom: 1px solid var(--border-color);
}

.data-table tr:hover td {
    background: var(--glass-bg);
}

.table-more {
    margin-top: var(--space-md);
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
}

/* Widget Insight */
.widget-insight {
    border-left: 4px solid var(--primary);
}

.insight-layout {
    display: flex;
    gap: var(--space-md);
    align-items: flex-start;
}

.insight-layout .widget-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.insight-content {
    color: var(--text-secondary);
    line-height: 1.7;
}

.insight-content strong {
    color: var(--text-primary);
}

/* Code dans les messages */
.message-text code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-family: 'Fira Code', 'Monaco', monospace;
    font-size: 0.9em;
}

/* ============================================
   LAYOUT SPLITÉE - DASHBOARD + CHAT
   ============================================ */

.editor-page {
    height: 100vh;
    overflow: hidden;
}

.editor-layout {
    display: grid;
    grid-template-columns: 70% 30%;
    height: 100vh;
    background: var(--bg-primary);
}

/* ==================== DASHBOARD AREA ==================== */

.dashboard-area {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    border-right: 1px solid var(--border-color);
}

.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.dashboard-title {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.dashboard-title h1 {
    font-size: 1.25rem;
    font-weight: 600;
}

.widget-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-full);
}

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

.dashboard-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: var(--text-secondary);
}

.dashboard-empty .empty-icon {
    font-size: 4rem;
    margin-bottom: var(--space-lg);
    opacity: 0.5;
}

.dashboard-empty h2 {
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
}

.dashboard-empty .hint {
    margin-top: var(--space-md);
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}

.dashboard-footer {
    padding: var(--space-sm) var(--space-lg);
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.source-info {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Grille des widgets */
.widgets-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg);
}

.widgets-grid .widget {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    animation: widget-appear 0.3s ease;
}

@keyframes widget-appear {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

.widget-header {
    padding: var(--space-md);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.widget-id {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-family: 'Fira Code', monospace;
    opacity: 0.5;
    padding: 2px 6px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.widget-header .widget-title {
    font-size: 0.95rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.widget-body {
    padding: var(--space-md);
}

/* Widget Chart */
.widget-chart .chart-container {
    height: 220px;
    position: relative;
}

/* Widget Stat */
.widget-stat .stat-body {
    text-align: center;
    padding: var(--space-xl) var(--space-md);
}

.widget-stat .stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.widget-stat .stat-unit {
    font-size: 1rem;
    margin-left: var(--space-xs);
}

.widget-stat .stat-trend {
    display: inline-block;
    margin-top: var(--space-sm);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 500;
}

.widget-stat .stat-trend.trend-up {
    color: var(--success);
    background: rgba(34, 197, 94, 0.15);
}

.widget-stat .stat-trend.trend-down {
    color: var(--error);
    background: rgba(239, 68, 68, 0.15);
}

.widget-stat .stat-description {
    margin-top: var(--space-sm);
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Widget Table */
.widget-table .table-body {
    overflow-x: auto;
}

.widget-table .data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.widget-table .data-table th {
    text-align: left;
    padding: var(--space-sm);
    background: var(--bg-tertiary);
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.widget-table .data-table td {
    padding: var(--space-sm);
    border-bottom: 1px solid var(--border-color);
}

.widget-table .table-more {
    margin-top: var(--space-sm);
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
}

/* Widget Insight */
.widget-insight .insight-body {
    padding: var(--space-lg);
    border-left: 3px solid var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

/* ==================== CHAT AREA ==================== */

.chat-area {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--bg-secondary);
    overflow: hidden;
}

.chat-area .chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.chat-title {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-weight: 600;
}

.agent-icon {
    font-size: 1.25rem;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md);
}

.chat-area .message {
    margin-bottom: var(--space-md);
    animation: message-slide 0.2s ease;
}

@keyframes message-slide {
    from {
        opacity: 0;
        transform: translateX(10px);
    }

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

.chat-area .message-content {
    padding: var(--space-md);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    line-height: 1.5;
}

.chat-area .message-assistant .message-content {
    background: var(--bg-tertiary);
}

.chat-area .message-user .message-content {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.chat-area .message-error .message-content {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--error);
}

.chat-area .thinking {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--text-muted);
}

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

.thinking-dots span {
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
    animation: thinking-bounce 1.2s infinite ease-in-out;
}

.thinking-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.thinking-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes thinking-bounce {

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

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Chat Input */
.chat-input-area {
    padding: var(--space-md);
    border-top: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    flex-shrink: 0;
}

.chat-area .attached-file {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-xs) var(--space-sm);
    margin-bottom: var(--space-sm);
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

.attached-file-info {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.btn-remove-file {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 50%;
}

.btn-remove-file:hover {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
}

.chat-input-row {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.chat-input {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    resize: none;
    min-height: 40px;
    max-height: 100px;
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary);
}

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

.btn-send {
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.btn-icon.has-file {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Connection status */
.connection-status {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
}

.connection-status.disconnected .status-dot {
    background: var(--error);
}

/* Drag over state */
.chat-area.drag-over {
    background: rgba(99, 102, 241, 0.1);
    border: 2px dashed var(--primary);
}

/* Responsive */
@media (max-width: 1024px) {
    .editor-layout {
        grid-template-columns: 60% 40%;
    }
}

@media (max-width: 768px) {
    .editor-layout {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 1fr;
    }

    .dashboard-area {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
}

/* --- Widget Controls --- */
.widget-header .widget-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    opacity: 0.6;
    transition: opacity 0.2s, transform 0.2s;
    padding: 0;
    color: rgba(255, 255, 255, 0.8);
}

.icon-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* --- Modal Properties --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease-out;
}

.modal-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease-out;
}

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

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.btn-close-modal {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.btn-close-modal:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

.property-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.property-row:last-child {
    border-bottom: none;
}

.property-row .label {
    color: var(--text-muted);
    font-weight: 500;
}

.property-row .value {
    color: var(--text-primary);
    font-weight: 600;
    text-align: right;
}

.property-row .value.highlight {
    color: var(--primary-color);
}

.property-row .value.code {
    font-family: monospace;
    background: rgba(0, 0, 0, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

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

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