/* Dashboard AI Search Intent */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #f8fafc;
    color: #1e293b;
    min-height: 100vh;
}

.dashboard-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 24px 20px;
}

/* Header */
.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.back-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #64748b;
    text-decoration: none;
    font-size: 14px;
    padding: 6px 12px;
    border-radius: 8px;
    transition: all 0.2s;
}

.back-link:hover {
    background: #e2e8f0;
    color: #334155;
}

.dashboard-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: #0f172a;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #475569;
}

.user-badge img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

/* Quota bar */
.quota-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 16px;
    margin-bottom: 20px;
    font-size: 13px;
    color: #64748b;
}

.quota-progress {
    flex: 1;
    max-width: 200px;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
}

.quota-fill {
    height: 100%;
    background: #3b82f6;
    border-radius: 3px;
    transition: width 0.3s;
}

/* State messages */
.state-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: #64748b;
}

.state-message h2 {
    font-size: 20px;
    color: #334155;
    margin-bottom: 8px;
}

.state-message p {
    font-size: 15px;
    max-width: 400px;
    line-height: 1.5;
}

.state-message a {
    color: #3b82f6;
    text-decoration: none;
}

.state-message a:hover {
    text-decoration: underline;
}

/* Analyses grid */
.analyses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

/* Analysis card */
.analysis-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.analysis-card:hover {
    border-color: #94a3b8;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.3;
    cursor: text;
    padding: 2px 4px;
    border-radius: 4px;
    border: 1px solid transparent;
    transition: border-color 0.2s;
    flex: 1;
    word-break: break-word;
}

.card-title:hover {
    border-color: #cbd5e1;
}

.card-title:focus {
    outline: none;
    border-color: #3b82f6;
    background: #f8fafc;
}

.card-badge {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}

.badge-search { background: #dbeafe; color: #1d4ed8; }
.badge-evaluation { background: #fef3c7; color: #92400e; }
.badge-brief { background: #d1fae5; color: #065f46; }

.card-meta {
    font-size: 13px;
    color: #94a3b8;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.card-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.card-query {
    font-size: 14px;
    color: #64748b;
    font-style: italic;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-actions {
    display: flex;
    gap: 8px;
    padding-top: 4px;
    border-top: 1px solid #f1f5f9;
}

.card-actions button {
    flex: 1;
    padding: 8px 0;
    border: 1px solid #e2e8f0;
    background: #fff;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.card-actions button:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.card-actions .btn-open {
    color: #2563eb;
    border-color: #bfdbfe;
}

.card-actions .btn-open:hover {
    background: #eff6ff;
}

.card-actions .btn-delete:hover {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}

.shared-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #059669;
    background: #ecfdf5;
    padding: 2px 8px;
    border-radius: 6px;
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 19px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    box-sizing: border-box;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #3b82f6;
    color: #fff;
    margin-top: 16px;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-secondary {
    background: #f1f5f9;
    color: #475569;
    border-color: #e2e8f0;
}

.btn-secondary:hover {
    background: #e2e8f0;
}

.btn-danger {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}

.btn-danger:hover {
    background: #fee2e2;
}

.modal-actions .btn-primary {
    margin-top: 0;
}

/* Modal */
.modal {
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #fff;
    border-radius: 14px;
    padding: 28px;
    max-width: 480px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.modal-content h3 {
    font-size: 18px;
    margin-bottom: 4px;
}

.modal-subtitle {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Share options */
.share-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.share-option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 14px 16px;
    border: 1px solid #e2e8f0;
    background: #fff;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.share-option:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}

.share-option.active {
    border-color: #3b82f6;
    background: #eff6ff;
}

.share-option i {
    color: #3b82f6;
    font-size: 16px;
    margin-bottom: 2px;
}

.share-option span {
    font-weight: 600;
    font-size: 14px;
    color: #0f172a;
}

.share-option small {
    font-size: 12px;
    color: #94a3b8;
}

/* Share link */
.share-link-container {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.share-link-container input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    color: #334155;
    background: #f8fafc;
}

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

    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .card-actions {
        flex-wrap: wrap;
    }
}


/* ================================================================
   Section "Intégration MCP" (Phase MCP Search Intent)
   Visible uniquement pour utilisateurs Pro + admin (contrôlé en JS).
   ================================================================ */

.api-key-section {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 2px rgba(15,23,42,0.04);
}
.api-key-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}
.api-key-header h2 {
    font-size: 18px;
    margin: 0;
    color: #0f172a;
}
.api-key-header h2 i { margin-right: 8px; color: #6366f1; }
.api-key-status {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
}
.api-key-status.active   { background: #dcfce7; color: #166534; }
.api-key-status.inactive { background: #f1f5f9; color: #475569; }
.api-key-intro {
    font-size: 14px;
    color: #475569;
    margin: 0 0 12px;
}
.api-key-meta {
    background: #f8fafc;
    padding: 12px;
    border-radius: 8px;
    font-size: 13px;
    color: #334155;
    display: grid;
    gap: 4px;
    margin-bottom: 12px;
}
.api-key-meta code {
    background: #eef2ff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}
.api-key-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.api-key-actions .btn-primary,
.api-key-actions .btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 0 18px;
    margin-top: 0;
    line-height: 1;
    white-space: nowrap;
}
.api-key-new {
    margin-top: 14px;
    padding: 12px 14px;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 8px;
    font-size: 13px;
    color: #78350f;
}
.api-key-new .api-key-warning { display: block; margin: 6px 0; font-weight: 500; }
.api-key-new-field-row {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}
.api-key-new-field-row input {
    flex: 1;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
}

/* ================================================================
   Workspace bar (Phase A — navigation par projet, pro + admin)
   Visible uniquement pour utilisateurs Pro + admin (contrôlé en JS).
   ================================================================ */

.workspace-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    background: linear-gradient(135deg, #f5f3ff 0%, #eef2ff 100%);
    border: 1px solid #ddd6fe;
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 20px;
    box-shadow: 0 1px 2px rgba(99, 102, 241, 0.05);
}
.workspace-bar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1 1 auto;
    min-width: 280px;
}
.workspace-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}
.workspace-bar-label {
    font-size: 13px;
    font-weight: 600;
    color: #4338ca;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.workspace-bar-label i { color: #6366f1; }
.workspace-filter-select {
    flex: 0 1 320px;
    padding: 8px 12px;
    border: 1px solid #c7d2fe;
    border-radius: 8px;
    background: #fff;
    font-size: 14px;
    color: #1e1b4b;
    cursor: pointer;
    min-width: 200px;
}
.workspace-filter-select:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.workspace-count-badge {
    font-size: 12px;
    color: #64748b;
    background: rgba(255,255,255,0.7);
    padding: 4px 10px;
    border-radius: 999px;
    white-space: nowrap;
}
.btn-ghost.workspace-manage-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 13px;
    color: #4338ca;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}
.btn-ghost.workspace-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    font-size: 13px;
    color: #4338ca;
    background: rgba(255,255,255,0.65);
    border: 1px solid #c7d2fe;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn-ghost.workspace-action-btn:hover {
    background: #fff;
    border-color: #818cf8;
}
.btn-ghost.workspace-action-btn.danger {
    color: #b91c1c;
    border-color: #fecaca;
}
.btn-ghost.workspace-action-btn.danger:hover {
    background: #fef2f2;
    border-color: #fca5a5;
}
.btn-ghost.workspace-manage-link:hover {
    background: rgba(99, 102, 241, 0.08);
    border-color: #c7d2fe;
}

.workspace-text-input,
.workspace-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    font: inherit;
    color: #0f172a;
}
.workspace-textarea {
    resize: vertical;
    min-height: 84px;
}
.workspace-text-input:focus,
.workspace-textarea:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.workspace-delete-warning {
    font-size: 14px;
    color: #7f1d1d;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 10px 12px;
    margin: 0 0 14px;
}

/* Badge projet sur une carte d'analyse */
.card-workspace-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    color: #4338ca;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    padding: 3px 9px;
    border-radius: 999px;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.card-workspace-badge i { color: #6366f1; font-size: 10px; }

/* Bouton "déplacer" dans les actions d'une carte */
.btn-move {
    background: transparent;
    border: 1px solid #e5e7eb;
    color: #64748b;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-move:hover {
    background: #f5f3ff;
    color: #6366f1;
    border-color: #c7d2fe;
}

/* Move modal — dropdown de sélection */
.move-modal-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    margin: 16px 0 6px;
}
.move-modal-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    font-size: 14px;
    color: #0f172a;
    margin-bottom: 16px;
}
.move-modal-select:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
