:root {
    --primary: #4F46E5;
    --primary-dark: #4338CA;
    --primary-light: #818CF8;
    --secondary: #06B6D4;
    --success: #10B981;
    --warning: #F59E0B;
    --error: #EF4444;
    --bg-dark: #0F172A;
    --bg-medium: #1E293B;
    --bg-light: #334155;
    --surface: #1E293B;
    --surface-light: #334155;
    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --border: rgba(148, 163, 184, 0.1);
    --shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    --radius: 12px;
    --radius-lg: 16px;
}

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

/* Global horizontal scrollbar style - discrète et élégante */
*::-webkit-scrollbar:horizontal {
    height: 6px;
}

*::-webkit-scrollbar-track:horizontal {
    background: transparent;
}

*::-webkit-scrollbar-thumb:horizontal {
    background: rgba(79, 70, 229, 0.25);
    border-radius: 3px;
    transition: background 0.2s;
}

*::-webkit-scrollbar-thumb:horizontal:hover {
    background: rgba(79, 70, 229, 0.45);
}

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, #667eea 0%, #764ba2 50%, #f093fb 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, #667eea, #764ba2);
    top: -200px;
    left: -200px;
    animation: float1 25s ease-in-out infinite;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, #f093fb, #f5576c);
    bottom: -150px;
    right: -150px;
    animation: float2 30s ease-in-out infinite;
}

.orb-3 {
    width: 350px;
    height: 350px;
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    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(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 28px 30px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.login-header {
    text-align: center;
    margin-bottom: 40px;
}

.logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    gap: 8px;
}

.logo-image {
    width: 200px;
    height: auto;
    object-fit: contain;
}

.logo-subtitle {
    font-size: 14px;
    font-weight: 700;
    color: #1f2937;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0.8;
}

.login-header h1 {
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

.login-header p {
    font-size: 15px;
    color: #64748b;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 14px;
    font-weight: 600;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-group label svg {
    color: #667eea;
}

.form-group input {
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: var(--radius);
    font-size: 15px;
    font-family: inherit;
    transition: all 0.2s;
    background: white;
    color: #1e293b;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.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: #64748b;
    font-size: 14px;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid #cbd5e1;
    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, #667eea, #764ba2);
    border-color: #667eea;
}

.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, #667eea, #764ba2);
    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(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

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

.form-footer {
    text-align: center;
    margin-top: 8px;
}

.link-secondary {
    color: #667eea;
    text-decoration: none;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s;
}

.link-secondary:hover {
    color: #764ba2;
}

.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: #d1fae5;
    color: #065f46;
    border: 1px solid #10b981;
}

.message.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #ef4444;
}

.message.info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #3b82f6;
}

@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(15, 23, 42, 0.8);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    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 #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
}

.modal-close {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: 8px;
    color: #64748b;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.modal-body {
    padding: 24px;
    color: #64748b;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn-secondary {
    padding: 10px 20px;
    background: #f1f5f9;
    color: #334155;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

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

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--bg-dark);
}

.app-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    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: 60px;
    width: auto;
    object-fit: contain;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
}

.user-badge, .quiz-badge-modern {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.quiz-badge-modern strong {
    color: var(--primary-light);
    font-weight: 600;
}

.quiz-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-light);
    border: 1px solid var(--border);
    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-icon-header {
    padding: 10px;
    background: var(--bg-light);
    border: 1px solid var(--border);
    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;
}

.tabs-container {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
}

.tabs {
    display: flex;
    padding: 0 24px;
    gap: 8px;
    flex-wrap: nowrap;
    min-width: min-content;
}

.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(148, 163, 184, 0.05);
}

.tab.active {
    color: var(--primary-light);
    border-bottom-color: var(--primary);
}

.app-main {
    flex: 1;
    overflow: hidden;
}

.tab-content {
    display: none;
    height: 100%;
    flex-direction: column;
}

.tab-content.active {
    display: flex;
}

.canvas-toolbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    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;
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: var(--border);
    margin: 0 8px;
}

.btn-toolbar, .btn-toolbar-secondary {
    padding: 8px 14px;
    background: var(--bg-light);
    border: 1px solid var(--border);
    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.3);
}

.btn-toolbar-secondary:hover {
    background: var(--surface-light);
    border-color: var(--text-secondary);
}

.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: var(--bg-dark);
    background-image:
        radial-gradient(circle, rgba(148, 163, 184, 0.05) 1px, transparent 1px);
    background-size: 20px 20px;
    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-minimap {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 200px;
    height: 150px;
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    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: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    overflow-x: auto;
    flex-wrap: nowrap;
}

.analysis-container {
    flex: 1;
    overflow: auto;
    padding: 32px 0;
    background: var(--bg-dark);
}

.analysis-container::-webkit-scrollbar {
    width: 12px;
}

.analysis-container::-webkit-scrollbar-track {
    background: var(--bg-medium);
    border-left: 1px solid var(--border);
}

.analysis-container::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 6px;
    border: 2px solid var(--bg-medium);
}

.analysis-container::-webkit-scrollbar-thumb:hover {
    background: var(--primary-light);
}

.analysis-flow {
    display: flex;
    flex-direction: column;
    gap: 0;
    max-width: 100%;
}

@media (max-width: 768px) {
    .app-header {
        padding: 0 12px;
        min-height: 60px;
    }

    .logo-header-image {
        height: 45px;
    }

    .header-right {
        gap: 8px;
    }

    .user-badge, .quiz-badge-modern, .quiz-selector {
        padding: 6px 10px;
        font-size: 12px;
        gap: 6px;
    }

    .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-node {
    will-change: transform;
}

.diagram-node:hover {
    z-index: 100 !important;
}

#editModal .modal-content {
    animation: modalPop 0.3s ease;
}

.phase-container {
    width: 100%;
    position: relative;
    padding: 32px 48px 32px 60px;
    margin-bottom: 2px;
    transition: background 0.2s, opacity 0.2s;
    border-bottom: 2px dashed rgba(148, 163, 184, 0.2);
}

.phase-container:hover {
    background: rgba(148, 163, 184, 0.03);
}

.phase-container.dragging-phase {
    opacity: 0.4;
}

.phase-container.drag-over {
    border-top: 4px solid var(--primary-light);
}

.phase-container.phase-intro {
    background: rgba(79, 70, 229, 0.08);
    border-left: 4px solid var(--primary);
}

.phase-container.phase-conclusion {
    background: rgba(16, 185, 129, 0.08);
    border-left: 4px solid var(--success);
    border-bottom: none;
}

.phase-container.phase-phase {
    background: rgba(129, 140, 248, 0.06);
    border-left: 4px solid var(--primary-light);
}

.phase-container.phase-transition {
    background: rgba(245, 158, 11, 0.08);
    border-left: 4px solid var(--warning);
}

.phase-drag-handle {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    opacity: 0.3;
    transition: opacity 0.2s, background 0.2s;
    user-select: none;
}

.phase-drag-handle:hover {
    opacity: 1;
    background: rgba(148, 163, 184, 0.1);
}

.phase-drag-handle:active {
    cursor: grabbing;
}

.phase-drag-handle::before {
    content: '⋮⋮';
    font-size: 24px;
    color: var(--text-primary);
    letter-spacing: -4px;
}

.phase-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
}

.phase-title-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.phase-type-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.phase-intro .phase-type-badge {
    background: rgba(79, 70, 229, 0.15);
    color: var(--primary-light);
}

.phase-conclusion .phase-type-badge {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.phase-phase .phase-type-badge {
    background: rgba(129, 140, 248, 0.15);
    color: var(--primary-light);
}

.phase-transition .phase-type-badge {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.phase-title {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid transparent;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    background: transparent;
    transition: all 0.2s;
}

.phase-title:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--surface);
}

.phase-actions {
    display: flex;
    gap: 8px;
}

.node-action-btn {
    padding: 8px 12px;
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.node-action-btn:hover {
    background: var(--error);
    border-color: var(--error);
    color: white;
    transform: scale(1.05);
}

.phase-body {
    width: 100%;
}

.cards-container {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding: 8px 4px;
    min-height: 200px;
    align-items: flex-start;
}

.cards-container::-webkit-scrollbar {
    height: 8px;
}

.cards-container::-webkit-scrollbar-track {
    background: var(--bg-light);
    border-radius: 4px;
}

.cards-container::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

.cards-container.empty-state {
    justify-content: center;
    align-items: center;
}

.empty-message {
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
    padding: 40px 20px;
}

.case-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    min-width: 300px;
    max-width: 300px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    cursor: grab;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-shrink: 0;
}

.case-card:hover {
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.3);
    transform: translateY(-2px);
    border-color: var(--primary);
}

.case-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

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

.case-card-title {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid transparent;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 700;
    background: rgba(79, 70, 229, 0.1);
    color: white;
    transition: all 0.2s;
}

.case-card-title:focus {
    outline: none;
    border-color: var(--primary-light);
    background: var(--bg-dark);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.case-card-delete {
    padding: 6px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.case-card-delete:hover {
    background: var(--error);
    color: white;
}

.case-card-script {
    width: 100%;
    min-height: 150px;
    padding: 10px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    resize: vertical;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    transition: all 0.2s;
}

.case-card-script:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.add-case-card {
    min-width: 280px;
    max-width: 280px;
    height: 200px;
    border: 3px dashed rgba(148, 163, 184, 0.4);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(148, 163, 184, 0.05);
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
    flex-shrink: 0;
}

.add-case-card:hover {
    border-color: var(--primary-light);
    background: rgba(79, 70, 229, 0.15);
    color: white;
    transform: scale(1.01);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.add-case-icon {
    font-size: 40px;
    line-height: 1;
    font-weight: bold;
}

.phase-footer {
    margin-top: 16px;
    display: flex;
    gap: 8px;
}

.transition-limit-message {
    padding: 12px 16px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid var(--warning);
    border-radius: var(--radius);
    color: var(--warning);
    font-size: 13px;
    text-align: center;
    margin-top: 8px;
}

.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);
    }
}

/* ============================================
   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(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
}

.publish-modal-content {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 520px;
    position: relative;
    z-index: 1;
    animation: modalPop 0.3s ease;
    border: 1px solid var(--border);
}

.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(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
}

.unsaved-changes-modal-content {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 1;
    animation: modalSlideIn 0.25s ease-out;
    border: 1px solid var(--border);
}

@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); }
}
