:root {
    --primary: #4F46E5;
    --primary-dark: #4338CA;
    --primary-light: #818CF8;
    --secondary: #06B6D4;
    --success: #10B981;
    --warning: #F59E0B;
    --error: #EF4444;

    /* Palette bleu nuit profond */
    --bg-dark: #070A12;
    --bg-medium: #0D1220;
    --bg-light: #151E30;
    --surface: #0D1220;
    --surface-light: #151E30;

    /* Chrome (header, tabs, toolbars) */
    --chrome: #0A0D16;
    --chrome-border: rgba(99, 102, 241, 0.18);

    --text-primary: #E2E8F0;
    --text-secondary: #94A3B8;
    --border: rgba(255, 255, 255, 0.08);
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.6);
    --glow: 0 0 40px rgba(79, 70, 229, 0.2);
    --radius: 10px;
    --radius-lg: 14px;

    /* Diagram tokens */
    --diagram-node-width: 320px;
    --diagram-node-border: rgba(99, 102, 241, 0.22);
    --diagram-entry-color: #3b82f6;
    --diagram-exit-color: #10b981;
    --diagram-splitter-color: #f59e0b;
    --diagram-answer-border: rgba(245, 158, 11, 0.40);
    --diagram-preview-bg: rgba(0, 0, 0, 0.12);
    --diagram-preview-border: rgba(255, 255, 255, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Global scrollbar style — analytics-aligned */
*::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background: rgba(79, 70, 229, 0.28);
    border-radius: 3px;
}

*::-webkit-scrollbar-thumb:hover {
    background: rgba(79, 70, 229, 0.5);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-dark);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    position: relative;
    overflow: hidden;
}

.login-background {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #070A12 0%, #0D1220 40%, #111833 100%);
    overflow: hidden;
}

.gradient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    will-change: transform;
}

.orb-1 {
    width: 500px;
    height: 500px;
    background: linear-gradient(135deg, #4F46E5, #6366F1);
    top: -200px;
    left: -200px;
    animation: float1 25s ease-in-out infinite;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, #06B6D4, #0891B2);
    bottom: -150px;
    right: -150px;
    animation: float2 30s ease-in-out infinite;
}

.orb-3 {
    width: 350px;
    height: 350px;
    background: linear-gradient(135deg, #7C3AED, #4F46E5);
    top: 50%;
    left: 50%;
    animation: float3 20s ease-in-out infinite;
}

@keyframes float1 {
    0%, 100% { transform: translate(0, 0) scale(1) rotate(0deg); }
    25% { transform: translate(50px, -80px) scale(1.15) rotate(90deg); }
    50% { transform: translate(-30px, 60px) scale(0.9) rotate(180deg); }
    75% { transform: translate(70px, 30px) scale(1.05) rotate(270deg); }
}

@keyframes float2 {
    0%, 100% { transform: translate(0, 0) scale(1) rotate(0deg); }
    30% { transform: translate(-60px, 50px) scale(1.1) rotate(-90deg); }
    60% { transform: translate(40px, -40px) scale(0.95) rotate(-180deg); }
    90% { transform: translate(-50px, -60px) scale(1.08) rotate(-270deg); }
}

@keyframes float3 {
    0%, 100% { transform: translate(-50%, -50%) scale(1) rotate(0deg); }
    20% { transform: translate(calc(-50% + 80px), calc(-50% - 70px)) scale(1.2) rotate(72deg); }
    40% { transform: translate(calc(-50% - 90px), calc(-50% + 40px)) scale(0.85) rotate(144deg); }
    60% { transform: translate(calc(-50% + 60px), calc(-50% + 80px)) scale(1.1) rotate(216deg); }
    80% { transform: translate(calc(-50% - 70px), calc(-50% - 50px)) scale(0.95) rotate(288deg); }
}

.login-container {
    width: 100%;
    max-width: 460px;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.login-box {
    background: rgba(13, 18, 32, 0.8);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6), 0 0 80px rgba(79, 70, 229, 0.08);
    padding: 28px 30px;
    border: 1px solid rgba(99, 102, 241, 0.15);
}

.login-header {
    text-align: center;
    margin-bottom: 24px;
}

.logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 0;
    gap: 8px;
}

.logo-image {
    width: 200px;
    height: auto;
    object-fit: contain;
}

.logo-subtitle {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0.8;
}

.login-header h1 {
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-light), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

.login-header p {
    font-size: 15px;
    color: var(--text-secondary);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-group label svg {
    color: var(--primary-light);
}

.form-group input {
    padding: 14px 16px;
    border: 2px solid rgba(99, 102, 241, 0.15);
    border-radius: var(--radius);
    font-size: 15px;
    font-family: inherit;
    transition: all 0.2s;
    background: rgba(7, 10, 18, 0.5);
    color: var(--text-primary);
}

.form-group input::placeholder {
    color: rgba(148, 163, 184, 0.5);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
    background: rgba(7, 10, 18, 0.7);
}

.input-hint {
    font-size: 12px;
    color: #94a3b8;
}

.checkbox-group {
    flex-direction: row;
    align-items: center;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    color: var(--text-secondary);
    font-size: 14px;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(99, 102, 241, 0.25);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    position: relative;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-color: var(--primary);
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after {
    content: "✓";
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.btn-primary {
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(79, 70, 229, 0.55);
}

.btn-primary:active {
    transform: translateY(0);
}

.form-footer {
    text-align: center;
    margin-top: 8px;
}

.link-secondary {
    color: var(--primary-light);
    text-decoration: none;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s;
}

.link-secondary:hover {
    color: var(--secondary);
}

.message {
    padding: 14px 18px;
    border-radius: var(--radius);
    font-size: 14px;
    text-align: center;
    font-weight: 500;
    display: none;
    animation: slideDown 0.3s ease;
}

.message.show {
    display: block;
}

.message.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.message.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.message.info {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary-light);
    border: 1px solid rgba(79, 70, 229, 0.3);
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
    from { opacity: 0; transform: translate(-50%, 20px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.modal-content {
    background:
        radial-gradient(ellipse at 50% 0%, rgba(99, 102, 241, 0.18) 0%, transparent 55%),
        linear-gradient(180deg, #0F1525 0%, #0B1018 100%);
    border: 1px solid rgba(99, 102, 241, 0.12);
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6), 0 0 80px rgba(79, 70, 229, 0.1);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: auto;
    position: relative;
    z-index: 1;
    animation: modalPop 0.3s ease;
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: 8px;
    color: var(--text-secondary);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    color: var(--text-secondary);
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn-secondary {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.15);
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--bg-dark);
}

.app-header {
    background: linear-gradient(180deg, #0E1222 0%, #0A0D16 100%);
    border-bottom: 1px solid rgba(99, 102, 241, 0.2);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 0 rgba(129, 140, 248, 0.06), 0 4px 24px rgba(0, 0, 0, 0.5);
    z-index: 100;
    min-height: 70px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-header-image {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
}

.user-badge-wrapper {
    position: relative;
}

.user-badge, .quiz-badge-modern {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.18);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.user-badge:hover {
    background: rgba(99, 102, 241, 0.14);
    border-color: rgba(99, 102, 241, 0.3);
}

.user-badge-chevron {
    margin-left: 2px;
    transition: transform 0.2s;
}

.user-dropdown.open ~ .user-badge .user-badge-chevron,
.user-badge-wrapper:has(.user-dropdown.open) .user-badge-chevron {
    transform: rotate(180deg);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 220px;
    white-space: nowrap;
    background: var(--bg-medium);
    border: 1px solid var(--chrome-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
    z-index: 1000;
    padding: 6px;
}

.user-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    background: none;
    border: none;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.user-dropdown-item:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--text-primary);
}

.user-dropdown-item svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.quiz-badge-modern strong {
    color: var(--primary-light);
    font-weight: 600;
}

.quiz-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.18);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.quiz-dropdown {
    background: transparent;
    border: none;
    color: var(--primary-light);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    outline: none;
    padding: 0;
    max-width: 150px;
}

.quiz-dropdown:hover {
    color: var(--primary);
}

.quiz-dropdown option {
    background: var(--surface);
    color: var(--text);
    padding: 8px;
}

.btn-create-quiz {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(79, 70, 229, 0.12);
    border: 1px solid rgba(79, 70, 229, 0.3);
    border-radius: var(--radius);
    color: var(--primary-light);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-create-quiz:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}

.btn-create-quiz svg {
    flex-shrink: 0;
}

/* Modal création de quiz */
.create-quiz-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.create-quiz-modal.active {
    display: flex;
}

.create-quiz-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.create-quiz-modal-content {
    background: linear-gradient(165deg, #141C2F 0%, #111827 50%, #161E33 100%);
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.7), 0 0 60px rgba(79, 70, 229, 0.08), 0 0 0 1px rgba(255, 255, 255, 0.04);
    width: 90%;
    max-width: 480px;
    position: relative;
    animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(-12px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.create-quiz-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.create-quiz-modal-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.create-quiz-modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
}

.create-quiz-modal-close:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

.create-quiz-modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.create-quiz-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.create-quiz-form-group input,
.create-quiz-form-group textarea {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
    resize: none;
}

.create-quiz-form-group input:focus,
.create-quiz-form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.create-quiz-form-group input::placeholder,
.create-quiz-form-group textarea::placeholder {
    color: rgba(148, 163, 184, 0.5);
}

.create-quiz-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn-cancel-create {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-cancel-create:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.btn-confirm-create {
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-confirm-create:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.4);
}

.btn-confirm-create:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-icon-header {
    padding: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: var(--radius);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon-header:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}

.tabs-container {
    background: #080B18;
    border-bottom: 1px solid rgba(99, 102, 241, 0.15);
    overflow-x: auto;
    box-shadow: 0 1px 0 rgba(129, 140, 248, 0.04);
}

.tabs {
    display: flex;
    padding: 0 24px;
    gap: 4px;
    flex-wrap: nowrap;
    min-width: min-content;
    align-items: center;
}

.tab {
    padding: 14px 20px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    flex-shrink: 0;
}

.tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.tab.active {
    color: var(--primary-light);
    border-bottom-color: var(--primary);
    text-shadow: 0 0 20px rgba(129, 140, 248, 0.4);
}

/* ============================================
   QUIZ SUB-BAR
   ============================================ */

.quiz-subbar {
    background: linear-gradient(180deg, #111A2E 0%, #0E1626 100%);
    border-bottom: 1px solid rgba(99, 102, 241, 0.18);
    padding: 8px 32px;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 1px 0 rgba(129, 140, 248, 0.06), 0 4px 20px rgba(0, 0, 0, 0.4);
    position: relative;
}

.quiz-subbar.visible {
    display: flex;
}

/* Stepper layout */
.quiz-stepper {
    display: flex;
    align-items: center;
    gap: 0;
}

/* Connector line between phases */
.stepper-connector {
    width: 28px;
    height: 2px;
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.25), rgba(99, 102, 241, 0.15));
    border-radius: 1px;
    flex-shrink: 0;
}

/* Main chevrons between phases */
.stepper-chevron {
    color: rgba(129, 140, 248, 0.5);
    flex-shrink: 0;
    filter: drop-shadow(0 0 2px rgba(99, 102, 241, 0.2));
}

/* Sub-chevrons inside phase group */
.stepper-chevron-sm {
    color: rgba(148, 163, 184, 0.35);
    flex-shrink: 0;
    margin: 0 2px;
}

/* Individual step button */
.stepper-step {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 500;
    color: rgba(148, 163, 184, 0.75);
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
    position: relative;
}

.stepper-step svg {
    opacity: 0.7;
    transition: opacity 0.25s ease;
}

.stepper-step:hover svg {
    opacity: 1;
}

.stepper-step:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.stepper-step.active {
    color: #fff;
    background: rgba(79, 70, 229, 0.14);
    box-shadow: 0 0 24px rgba(79, 70, 229, 0.08);
}

.stepper-step.active svg {
    opacity: 1;
    filter: drop-shadow(0 0 3px rgba(129, 140, 248, 0.4));
}

.stepper-step.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 10px;
    right: 10px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 3px 3px 0 0;
    box-shadow: 0 0 12px rgba(79, 70, 229, 0.6), 0 0 4px rgba(79, 70, 229, 0.8);
}

/* Step badge (phase number) */
.step-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.1);
    border: 1.5px solid rgba(99, 102, 241, 0.35);
    font-size: 11px;
    font-weight: 700;
    color: rgba(129, 140, 248, 0.7);
    flex-shrink: 0;
    transition: all 0.25s ease;
}

.stepper-step:hover .step-badge {
    background: rgba(99, 102, 241, 0.22);
    border-color: rgba(99, 102, 241, 0.5);
    color: var(--primary-light);
}

.stepper-step.active .step-badge {
    background: var(--primary);
    border-color: var(--primary-light);
    color: #fff;
    box-shadow: 0 0 14px rgba(79, 70, 229, 0.6), 0 0 4px rgba(99, 102, 241, 0.9);
}

.step-label {
    transition: color 0.25s ease;
    letter-spacing: 0.01em;
}

/* Phase 2 group container */
.stepper-phase-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.phase-group-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(148, 163, 184, 0.45);
    margin-bottom: 2px;
    pointer-events: none;
    transition: color 0.25s ease;
}

.stepper-phase-group.group-active .phase-group-label {
    color: rgba(129, 140, 248, 0.75);
    text-shadow: 0 0 12px rgba(99, 102, 241, 0.3);
}

.phase-group-steps {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 2px 7px;
    border-radius: 11px;
    background: rgba(99, 102, 241, 0.05);
    border: 1px solid rgba(99, 102, 241, 0.12);
    transition: all 0.25s ease;
}

.stepper-phase-group.group-active .phase-group-steps {
    background: rgba(99, 102, 241, 0.09);
    border-color: rgba(99, 102, 241, 0.22);
    box-shadow: 0 0 20px rgba(79, 70, 229, 0.06);
}

.app-main {
    flex: 1;
    overflow: hidden;
}

.tab-content {
    display: none;
    height: 100%;
    flex-direction: column;
}

.tab-content.active {
    display: flex;
}

.canvas-toolbar {
    background: #080B18;
    border-bottom: 1px solid rgba(99, 102, 241, 0.13);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    overflow-x: auto;
    flex-wrap: nowrap;
}

.toolbar-left, .toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    flex-shrink: 0;
    flex: 1;
    min-width: 0;
}

.toolbar-right {
    justify-content: flex-end;
}

.toolbar-center {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}


.toolbar-divider {
    width: 1px;
    height: 24px;
    background: var(--border);
    margin: 0 8px;
}

.btn-toolbar, .btn-toolbar-secondary {
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-toolbar:hover {
    background: var(--primary);
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}

.btn-toolbar-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.btn-toolbar-secondary.active {
    background: var(--primary, #4F46E5);
    border-color: var(--primary, #4F46E5);
    color: #ffffff;
}

.btn-primary-toolbar {
    padding: 8px 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-primary-toolbar:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.4);
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.btn-zoom {
    padding: 6px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-zoom:hover {
    background: var(--surface-light);
    color: var(--text-primary);
}

.zoom-level {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 45px;
    text-align: center;
}

.canvas-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    background-color: #070A12;
    background-image:
        radial-gradient(ellipse 85% 55% at 15% -5%, rgba(79, 70, 229, 0.16) 0%, transparent 55%),
        radial-gradient(ellipse 65% 50% at 88% 108%, rgba(124, 58, 237, 0.11) 0%, transparent 55%),
        radial-gradient(ellipse 45% 35% at 55% 55%, rgba(6, 182, 212, 0.04) 0%, transparent 65%),
        radial-gradient(circle, rgba(148, 163, 184, 0.055) 1px, transparent 1px);
    background-size: 100% 100%, 100% 100%, 100% 100%, 24px 24px;
    cursor: grab;
    touch-action: pan-x pan-y;
    -webkit-overflow-scrolling: touch;
}

/* Mobile : permettre le scroll */
@media (max-width: 768px) {
    .canvas-container {
        overflow: auto;
        cursor: default;
    }

    .canvas-content {
        min-width: 2000px;
        min-height: 2000px;
    }
}

.connections-svg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.canvas-content {
    position: absolute;
    inset: 0;
}

.canvas-loader {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    z-index: 10;
    background: rgba(7, 10, 18, 0.85);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    pointer-events: none;
}

.canvas-loader-orb {
    position: relative;
    width: 64px;
    height: 64px;
}

.canvas-orb-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid transparent;
}

.canvas-orb-ring-1 {
    border-top-color: #22D3EE;
    animation: ovSpin 1.2s linear infinite;
}
.canvas-orb-ring-2 {
    inset: 6px;
    border-right-color: #06D6A0;
    animation: ovSpin 1.6s linear infinite reverse;
}
.canvas-orb-ring-3 {
    inset: 12px;
    border-bottom-color: #8B5CF6;
    animation: ovSpin 2s linear infinite;
}

.canvas-loader-text {
    font-size: 0.875rem;
    color: #94A3B8;
    animation: ovPulse 1.5s ease-in-out infinite;
}

.canvas-minimap {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 200px;
    height: 150px;
    background: rgba(18, 20, 27, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.minimap-viewport {
    position: absolute;
    border: 2px solid var(--primary-light);
    background: rgba(79, 70, 229, 0.1);
    pointer-events: none;
}

.notification {
    position: fixed;
    top: 24px;
    right: 24px;
    padding: 16px 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    font-weight: 500;
    z-index: 2000;
    transform: translateX(calc(100% + 48px));
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 400px;
}

.notification.show {
    transform: translateX(0);
    opacity: 1;
}

.notification.success {
    border-left: 4px solid var(--success);
    color: var(--success);
}

.notification.error {
    border-left: 4px solid var(--error);
    color: var(--error);
}

.toolbar {
    background: #080B18;
    border-bottom: 1px solid rgba(99, 102, 241, 0.13);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    overflow-x: auto;
    flex-wrap: nowrap;
}


@media (max-width: 768px) {
    .app-header {
        padding: 0 12px;
        min-height: 60px;
    }

    .logo-header-image {
        height: 30px;
    }

    .header-right {
        gap: 8px;
    }

    .user-badge, .quiz-badge-modern, .quiz-selector {
        padding: 6px 10px;
        font-size: 12px;
        gap: 6px;
    }

    .btn-create-quiz,
    .btn-test-funnel {
        padding: 6px 10px;
        font-size: 12px;
    }

    .btn-create-quiz span,
    .btn-test-funnel span {
        display: none;
    }

    .user-badge svg, .quiz-badge-modern svg, .quiz-selector svg {
        width: 16px;
        height: 16px;
    }

    .quiz-dropdown {
        font-size: 12px;
        max-width: 100px;
    }

    .user-badge span {
        display: inline;
        max-width: 60px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .btn-icon-header {
        padding: 8px;
    }

    .btn-icon-header svg {
        width: 16px;
        height: 16px;
    }

    .canvas-minimap {
        display: none;
    }

    .tabs-container {
        padding: 0;
    }

    .tabs {
        padding: 0 12px;
        gap: 4px;
    }

    .tab {
        padding: 12px 14px;
    }

    .tabs-container::-webkit-scrollbar {
        display: none;
    }

    .tabs-container {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    .canvas-toolbar, .toolbar {
        padding: 12px;
        gap: 8px;
    }

    .canvas-toolbar::-webkit-scrollbar,
    .toolbar::-webkit-scrollbar {
        height: 4px;
    }

    .canvas-toolbar::-webkit-scrollbar-track,
    .toolbar::-webkit-scrollbar-track {
        background: var(--bg-dark);
    }

    .canvas-toolbar::-webkit-scrollbar-thumb,
    .toolbar::-webkit-scrollbar-thumb {
        background: var(--primary);
        border-radius: 2px;
    }
}

/* ──────────────────────────────────────
   Diagram Nodes – Aero Glass System
   ────────────────────────────────────── */

.diagram-node {
    position: absolute;
    transform: translate(-50%, -50%);
    z-index: 10;
    will-change: transform;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.25s ease;
}

/* ── Question Card ── */

.diagram-node--question {
    width: var(--diagram-node-width);
    max-width: var(--diagram-node-width);
    background: linear-gradient(
        175deg,
        rgba(50, 58, 85, 0.96) 0%,
        rgba(35, 42, 68, 0.94) 40%,
        rgba(26, 32, 55, 0.93) 100%
    );
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(99, 102, 241, 0.22);
    border-top-color: rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 0;
    overflow: hidden;
    cursor: move;
    box-shadow:
        /* Halo glow — outer radiance */
        0 0 50px 0px rgba(79, 70, 229, 0.14),
        0 0 100px 0px rgba(99, 102, 241, 0.06),
        /* Depth shadow */
        0 12px 40px rgba(0, 0, 0, 0.55),
        /* Luminescent top edge */
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        /* Subtle inner edge all around */
        inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.diagram-node--question:hover {
    z-index: 100 !important;
    transform: translate(-50%, -50%) translateY(-3px);
    background: linear-gradient(
        175deg,
        rgba(58, 66, 95, 0.97) 0%,
        rgba(40, 48, 75, 0.95) 40%,
        rgba(30, 37, 60, 0.94) 100%
    );
    border-color: rgba(99, 102, 241, 0.35);
    border-top-color: rgba(255, 255, 255, 0.20);
    box-shadow:
        /* Halo intensified */
        0 0 60px 5px rgba(79, 70, 229, 0.22),
        0 0 120px 0px rgba(99, 102, 241, 0.09),
        /* Deeper shadow */
        0 20px 50px rgba(0, 0, 0, 0.6),
        /* Brighter top edge */
        inset 0 1px 0 rgba(255, 255, 255, 0.16),
        inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.diagram-node--question.is-splitter {
    border-color: rgba(245, 158, 11, 0.30);
    border-top-color: rgba(255, 210, 100, 0.25);
    box-shadow:
        0 0 50px 0px rgba(245, 158, 11, 0.10),
        0 0 100px 0px rgba(245, 158, 11, 0.05),
        0 12px 40px rgba(0, 0, 0, 0.55),
        inset 0 1px 0 rgba(255, 255, 255, 0.11),
        inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.diagram-node--question.is-splitter::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.07) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* Top color strip */
.diagram-node__topbar {
    height: 3px;
    width: 100%;
    position: relative;
    z-index: 1;
}

/* Header */
.diagram-node__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 16px 10px;
    position: relative;
    z-index: 1;
}

.diagram-node__header-left {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.diagram-node__type {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.diagram-node__type-icon {
    font-size: 22px;
    line-height: 1;
}

.diagram-node__type-label {
    font-family: 'Outfit', 'Inter', sans-serif;
    font-size: 10px;
    font-weight: 600;
    color: #8b93b0;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.diagram-node__number {
    font-family: 'Outfit', 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: #f1f5f9;
    margin-bottom: 3px;
}

.diagram-node__title {
    font-size: 12px;
    color: #a0aac0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.4;
}

/* Edit button */
.diagram-node__edit-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 500;
    font-family: inherit;
    flex-shrink: 0;
}

.diagram-node__edit-btn:hover {
    background: rgba(79, 70, 229, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
    color: var(--primary-light);
    box-shadow: 0 0 12px rgba(79, 70, 229, 0.15);
}

/* Preview panel */
.diagram-node__preview {
    margin: 0 12px;
    padding: 10px 12px;
    background: var(--diagram-preview-bg);
    border: 1px solid var(--diagram-preview-border);
    border-radius: 10px;
    position: relative;
    z-index: 1;
    overflow: hidden;
}

.diagram-node__preview::before {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
    pointer-events: none;
}

/* Actions bar */
.diagram-node__actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 8px 14px 12px;
    position: relative;
    z-index: 1;
}

.diagram-node__actions-left {
    display: flex;
    align-items: center;
    gap: 4px;
}

.diagram-node__action-btn {
    cursor: pointer;
    background: transparent;
    border: none;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    padding: 0;
    font-family: inherit;
}

.diagram-node__action-btn--move {
    color: #3b82f6;
}

.diagram-node__action-btn--move:hover {
    background: rgba(59, 130, 246, 0.12);
}

.diagram-node__action-btn--unlink {
    color: #f59e0b;
}

.diagram-node__action-btn--unlink:hover {
    background: rgba(245, 158, 11, 0.12);
}

.diagram-node__action-btn--delete {
    color: #ef4444;
}

.diagram-node__action-btn--delete:hover {
    background: rgba(239, 68, 68, 0.12);
}

/* ── Entry / Exit pills ── */

.diagram-node--entry,
.diagram-node--exit {
    border-radius: 40px;
    padding: 12px 24px;
    min-width: 180px;
    cursor: default;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    text-align: center;
}

.diagram-node--entry {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.20), rgba(37, 99, 235, 0.12));
    border: 1px solid rgba(59, 130, 246, 0.40);
    border-top-color: rgba(120, 170, 255, 0.35);
    color: white;
    box-shadow:
        0 0 40px 0px rgba(59, 130, 246, 0.18),
        0 0 80px 0px rgba(59, 130, 246, 0.08),
        0 8px 24px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.10);
}

.diagram-node--entry:hover {
    z-index: 100 !important;
    box-shadow:
        0 0 50px 5px rgba(59, 130, 246, 0.25),
        0 0 100px 0px rgba(59, 130, 246, 0.10),
        0 12px 36px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.diagram-node--exit {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.20), rgba(5, 150, 105, 0.12));
    border: 1px solid rgba(16, 185, 129, 0.40);
    border-top-color: rgba(80, 220, 170, 0.35);
    color: white;
    cursor: move;
    box-shadow:
        0 0 40px 0px rgba(16, 185, 129, 0.18),
        0 0 80px 0px rgba(16, 185, 129, 0.08),
        0 8px 24px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.10);
}

.diagram-node--exit:hover {
    z-index: 100 !important;
    box-shadow:
        0 0 50px 5px rgba(16, 185, 129, 0.25),
        0 0 100px 0px rgba(16, 185, 129, 0.10),
        0 12px 36px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.diagram-node__pill-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: 'Outfit', 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
}

/* ── Answer / Branch nodes ── */

.diagram-node--answer {
    min-width: 120px;
    max-width: 170px;
    background: linear-gradient(175deg, rgba(42, 36, 20, 0.92), rgba(24, 22, 14, 0.90));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--diagram-answer-border);
    border-top-color: rgba(255, 210, 100, 0.25);
    border-radius: 14px;
    padding: 12px 16px;
    cursor: default;
    text-align: center;
    box-shadow:
        0 0 35px 0px rgba(245, 158, 11, 0.12),
        0 0 70px 0px rgba(245, 158, 11, 0.05),
        0 6px 20px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.diagram-node--answer:hover {
    z-index: 100 !important;
    box-shadow:
        0 0 45px 5px rgba(245, 158, 11, 0.18),
        0 0 90px 0px rgba(245, 158, 11, 0.07),
        0 10px 30px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.10);
}

.diagram-node__answer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.diagram-node__answer-icon {
    font-size: 26px;
    line-height: 1;
}

.diagram-node__answer-img {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    overflow: hidden;
}

.diagram-node__answer-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.diagram-node__answer-text {
    font-size: 12px;
    color: #c8ccd8;
    font-weight: 500;
    line-height: 1.3;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Drag state ── */

body.is-dragging .diagram-node--question:hover,
body.is-dragging .diagram-node--entry:hover,
body.is-dragging .diagram-node--exit:hover,
body.is-dragging .diagram-node--answer:hover {
    transform: translate(-50%, -50%);
}

body.is-dragging .diagram-node {
    cursor: grabbing;
}

#editModal .modal-content {
    animation: modalPop 0.3s ease;
}


.record-locked-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 40px;
    gap: 24px;
}

.record-locked-container svg {
    color: var(--text-secondary);
    opacity: 0.5;
}

.record-locked-container h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.record-locked-container p {
    font-size: 16px;
    color: var(--text-secondary);
    max-width: 500px;
    line-height: 1.6;
    margin: 0;
}

/* Animation spinner pour l'upload */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   TEST FUNNEL BUTTON (header)
   ============================================ */

/* Ambre volontairement hors de la palette indigo de l'éditeur : même code
   couleur que le bandeau « mode démo » affiché sur le quiz et la page vidéo,
   pour que le lien entre le bouton et le parcours de test soit immédiat. */
.btn-test-funnel {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: var(--radius);
    color: #fbbf24;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.btn-test-funnel:hover {
    background: #f59e0b;
    border-color: #f59e0b;
    color: #1a1205;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
}

.btn-test-funnel:active {
    transform: translateY(1px);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.35);
}

.btn-test-funnel svg {
    flex-shrink: 0;
}

/* ============================================
   PUBLISH BUTTON & MODAL
   ============================================ */

.btn-publish-toolbar {
    padding: 8px 16px;
    background: linear-gradient(135deg, var(--success), #059669);
    border: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-publish-toolbar:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

.btn-publish-toolbar:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Publish Modal */
.publish-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.publish-modal.active {
    display: flex;
}

.publish-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.publish-modal-content {
    background: linear-gradient(165deg, #141C2F 0%, #111827 50%, #161E33 100%);
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.7), 0 0 60px rgba(79, 70, 229, 0.08), 0 0 0 1px rgba(255, 255, 255, 0.04);
    width: 90%;
    max-width: 520px;
    position: relative;
    z-index: 1;
    animation: modalPop 0.3s ease;
    border: 1px solid rgba(99, 102, 241, 0.15);
}

.publish-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.publish-modal-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.publish-modal-close {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: 8px;
    color: var(--text-secondary);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.publish-modal-close:hover {
    background: var(--bg-light);
    color: var(--text-primary);
}

.publish-modal-body {
    padding: 24px;
}

/* Warning State */
.publish-warning {
    text-align: center;
}

.publish-warning-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.publish-warning-icon svg {
    color: var(--warning);
}

.publish-warning h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 12px 0;
}

.publish-warning > p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 16px 0;
}

.publish-checklist {
    text-align: left;
    margin: 0 0 16px 0;
    padding: 14px 20px 14px 36px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    list-style: disc;
}

.publish-checklist li {
    font-size: 13px;
    color: var(--text-primary);
    padding: 6px 0;
    padding-left: 8px;
}

.publish-checklist li::marker {
    color: var(--warning);
    font-size: 18px;
}

.publish-warning-note {
    font-size: 13px;
    color: var(--warning);
    font-weight: 500;
    margin: 0;
    padding: 14px 16px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-left: 3px solid var(--warning);
    border-radius: var(--radius);
}

/* Success State */
.publish-success {
    text-align: center;
}

.publish-success-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.publish-success-icon svg {
    color: var(--success);
}

.publish-success h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--success);
    margin: 0 0 12px 0;
}

.publish-success > p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 16px 0;
}

.publish-url-container {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.publish-url-input {
    flex: 1;
    padding: 12px 14px;
    background: var(--bg-dark);
    border: 2px solid var(--success);
    border-radius: var(--radius);
    font-size: 13px;
    font-family: monospace;
    color: var(--success);
    font-weight: 600;
}

.publish-url-input:focus {
    outline: none;
}

.btn-copy-url {
    padding: 12px 14px;
    background: var(--success);
    border: none;
    border-radius: var(--radius);
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-copy-url:hover {
    background: #059669;
}

.btn-copy-url.copied {
    background: var(--primary);
}

/* Modal Footer */
.publish-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn-cancel-publish {
    padding: 10px 20px;
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-cancel-publish:hover {
    background: var(--surface-light);
    color: var(--text-primary);
}

.btn-confirm-publish {
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--success), #059669);
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-confirm-publish:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

.btn-confirm-publish:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-confirm-publish .spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.btn-close-publish {
    padding: 10px 24px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-close-publish:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.4);
}

/* ============================================
   UNSAVED CHANGES MODAL
   ============================================ */

.unsaved-changes-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.unsaved-changes-modal.active {
    display: flex;
}

.unsaved-changes-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.unsaved-changes-modal-content {
    background: linear-gradient(165deg, #141C2F 0%, #111827 50%, #161E33 100%);
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.7), 0 0 60px rgba(79, 70, 229, 0.08), 0 0 0 1px rgba(255, 255, 255, 0.04);
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 1;
    animation: modalSlideIn 0.25s ease-out;
    border: 1px solid rgba(99, 102, 241, 0.15);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.unsaved-changes-modal-header {
    padding: 24px 24px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
}

.unsaved-changes-modal-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(245, 158, 11, 0.1));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--warning);
}

.unsaved-changes-modal-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.unsaved-changes-modal-body {
    padding: 0 24px 24px;
    text-align: center;
}

.unsaved-changes-modal-body p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
}

.unsaved-changes-modal-body .unsaved-changes-question {
    color: var(--text-primary);
    font-weight: 500;
    margin-top: 12px;
}

.unsaved-changes-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn-unsaved-discard {
    padding: 10px 20px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-unsaved-discard:hover {
    background: var(--bg-light);
    color: var(--text-primary);
    border-color: var(--bg-light);
}

.btn-unsaved-save {
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
    min-width: 130px;
    justify-content: center;
}

.btn-unsaved-save:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.4);
}

.btn-unsaved-save:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-unsaved-save.saving .save-icon {
    display: none;
}

.btn-unsaved-save.saving .save-loader {
    display: block !important;
}

.btn-unsaved-save .save-loader {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* =====================================================
   Quiz Change Watcher Modal
   ===================================================== */

.quiz-change-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.quiz-change-modal.active {
    display: flex;
}

.quiz-change-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.quiz-change-modal-content {
    position: relative;
    max-width: 420px;
    width: 90%;
    background: #0D1220;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
    text-align: center;
    animation: quizChangeModalPop 0.2s ease-out;
}

@keyframes quizChangeModalPop {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.quiz-change-modal-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(245, 158, 11, 0.12);
    margin-bottom: 16px;
}

.quiz-change-modal-title {
    color: #F1F5F9;
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 12px 0;
}

.quiz-change-modal-message {
    color: #94A3B8;
    font-size: 14px;
    line-height: 1.5;
    margin: 0 0 24px 0;
}

.quiz-change-reload-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 24px;
    background: #4F46E5;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
}

.quiz-change-reload-btn:hover {
    background: #4338CA;
}
