:root {
    --white: #ffffff;
    --black: #000000;
    --swiss-green: #008000;
    --swiss-red: #ff0000;
    --gray-light: #f4f4f4;
    --gray-medium: #e0e0e0;
    --gray-text: #888888;
}

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

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background-color: var(--white);
    color: var(--black);
    line-height: 1.5;
    overflow-x: hidden;
    background-image: radial-gradient(var(--gray-medium) 1px, transparent 1px);
    background-size: 20px 20px; /* Un petit quadrillage discret */
}

.hidden {
    display: none !important;
}

.flex {
    display: flex;
}

.uppercase {
    text-transform: uppercase;
}

.rapprochement-letter {
    letter-spacing: -0.05em;
}

.espace-letter {
    letter-spacing: 0.2em;
}

.font-black {
    font-weight: 900;
}

nav {
    border-bottom: 2px solid var(--black);
    padding: 1.5rem 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: var(--white);
    z-index: 100;
}

.logo {
    font-weight: 900;
    font-size: 1.8rem;
    letter-spacing: -2px;
    cursor: pointer;
}

.nav-info {
    font-size: 14px;
    font-weight: 700;
    color: var(--gray-text);
}

.remove-blue-link {
    text-decoration: none;
    color: inherit;
}

/* --- BOUTONS --- */
.btn {
    padding: 1rem 2rem;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.press-effect{
    border: none;
    box-shadow: 
        -4px 0 0 0 var(--black),
        4px 0 0 0 var(--black),
        0 -4px 0 0 var(--black),
        0 4px 0 0 var(--black);
    border-radius: 0;
    color: var(--black);
}

.press-effect:hover {
    transform: translateY(2px);
    box-shadow: none; /* Effet d'enfoncement */
}

.btn-black {
    background-color: var(--gray-light);
    color: var(--black);
}

.btn-black:hover {
    background: var(--gray-light);
    color: var(--black);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--black);
}

.btn-outline:hover {
    background: var(--black);
    color: var(--white);
}

.green:hover {
    background: var(--swiss-green);
    border-color: var(--swiss-green);
    color: var(--white);
}

.delete:hover {
    background: var(--swiss-red);
    border-color: var(--swiss-red);
    color: var(--white);
}

.delete-dialogue {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1100; /* Un peu plus haut que l'autre au cas où */
    background-color: white;
    padding: 2.5rem;
    border: 4px solid var(--swiss-red); /* Style pixel/brutaliste */
    box-shadow: 0 0 0 4px var(--black);
    min-width: 400px;
    text-align: center;
}

/* --- LOGIN PAGE --- */
#login-page {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.giant-title {
    font-size: 100px;
    line-height: 0.8;
    margin-bottom: 2rem;
}

.input-group {
    margin-bottom: 2.5rem;
}

.input-group label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--gray-text);
}

.input-group input,
.input-group select,
.input-group textarea {
    width: 100%;
    border: none;
    border-bottom: 2px solid var(--black);
    padding: 0.8rem 0;
    font-size: 1.2rem;
    font-weight: 700;
    outline: none;
    background: transparent;
}

.input-group input:focus {
    border-bottom-color: var(--swiss-green);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 4rem 2.5rem;
}

.page-header {
    border-bottom: 8px solid var(--black);
    padding-bottom: 2rem;
    margin-bottom: 4rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.page-title {
    font-size: 4rem;
    font-weight: 900;
}

.grid-scenarios {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1px;
}

.scenario-card {
    background: var(--white);
    padding: 2.5rem;
    height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.3s ease;
    border:1px solid var(--black);
}

.scenario-card:hover {
    background: var(--black);
    color: var(--white);
}

.card-number {
    font-size: 5rem;
    font-weight: 900;
    opacity: 0.3;
}

/* --- DIALOGUE LIST --- */
.dialogue-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 2rem;
}

.dialogue-table th {
    text-align: left;
    padding: 1rem;
    font-size: 10px;
    font-weight: 700;
    color: var(--gray-text);
    border-bottom: 2px solid var(--black);
    background: var(--gray-light);
}

.dialogue-table td {
    padding: 2rem 1rem;
    border-bottom: 1px solid var(--gray-medium);
}

.dialogue-row:hover {
    background-color: var(--gray-light);
}

/* --- EDITOR --- */
.editor-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
}

.unity-preview {
    background: var(--gray-light);
    padding: 3rem;
    border: 2px dashed var(--gray-medium);
    position: sticky;
    top: 150px;
    height: fit-content;
}

.unity-screen {
    aspect-ratio: 16/9;
    background: #1a1a1a;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    border: 4px solid #333;
}

.unity-dialogue-box {
    position: absolute;
    bottom: 15px;
    left: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 15px;
    color: white;
}

.unity-name {
    color: var(--swiss-green);
    font-weight: 900;
    font-size: 10px;
    text-transform: uppercase;
    margin-bottom: 5px;
    display: block;
}

.unity-text {
    font-size: 14px;
    font-style: italic;
    color: #000000;
}

/* --- NOTIFICATIONS --- */
#notification {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: var(--black);
    color: var(--white);
    padding: 1.5rem 2.5rem;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.2em;
    transform: translateY(-200%);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
}

#notification.show {
    transform: translateY(0);
}

textarea {
    resize: none;
    border: 2px solid var(--black) !important;
    padding: 1rem !important;
}

/* Style de la boîte modale */
.add-dialogue {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* Centrage parfait */
    z-index: 1000; /* Passe au-dessus de tout */
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    min-width: 300px;
}
/* CARD */
.add-dialogue form {
    background: #ffffff;
    width: 100%;
    max-width: 480px;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    animation: modalPop 0.25s ease;
}

/* TITLE */
.add-dialogue h3 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 800;
}

/* INPUTS */
.add-dialogue input {
    padding: 0.9rem 1rem;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    font-size: 0.95rem;
    transition: 0.2s ease;
}

.add-dialogue input:focus {
    outline: none;
    border-color: #111;
    box-shadow: 0 0 0 3px rgba(0,0,0,0.08);
}

/* BUTTON ROW */
.add-dialogue form div {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.toast.hide {
    opacity: 0;
    transition: all 0.4s ease-in;
    pointer-events: none;
}

/* ANIMATION */
@keyframes modalPop {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Optionnel : transition pour le flou */
#scenario-view {
    transition: filter 0.3s ease;
}

/* Drag and Drop et SlideBar */

.container-fluid { padding: 1rem 2rem; }

.editor-layout {
    display: grid;
    grid-template-columns: 1fr 350px; /* Tableau large, sidebar étroite */
    gap: 1rem;
    height: calc(100vh - 180px);
}

#canvas-area {
    position: relative;
    overflow: hidden; /* Important pour ne pas voir ce qui sort du cadre */
    background-color: var(--gray-light);
    border: 4px solid var(--black);
    cursor: grab; /* Curseur de main pour le déplacement */
}

#whiteboard {
    transform-origin: 0 0; 
    width: 15000px; 
    height: 15000px; 
    position: absolute;
    top: -7500px; 
    left: -7500px;   
    background-color: white;
    overflow: visible;
}

#lines-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: visible !important;
}

.canvas-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    z-index: 1000;
}

.btn-zoom {
    width: 40px;
    height: 40px;
    border: 2px solid var(--black);
    background: white;
    font-weight: 900;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-zoom:hover { background: var(--gray-medium); }

#lines-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Pour pouvoir cliquer sur les cercles sous le SVG */
    z-index: 1; 
    border: 5px solid red !important;
    background-color: rgba(255, 0, 0, 0.05);
}

.dialogue-sidebar {
    border-left: 2px solid var(--black);
    padding-left: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
}

/* Les petites cartes dans la liste */
.draggable-dialogue {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* Ajoute les ... automatiquement si le texte déborde */
    max-width: 100%;
    padding: 1rem;
    border: 2px solid var(--black);
    margin-bottom: 0.5rem;
    cursor: grab;
    background: white;
    font-size: 12px;
}

.draggable-dialogue.npc { border-left: 10px solid var(--swiss-green); }
.draggable-dialogue.player { border-left: 10px solid #007bff; } /* Bleu joueur */

/* Positionnement de la vue édition par-dessus tout */
#modal-edit-dialogue {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: white; /* Ou transparent avec un flou */
    z-index: 2000;
    padding: 2rem;
    overflow-y: auto;
}

.hidden { display: none; }

/* Les cercles sur le tableau */
.node-circle {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid var(--black);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 1.2rem;
    color: white;
    cursor: move;
    z-index: 100;
    box-shadow: 4px 4px 0px rgba(0,0,0,0.2);
    user-select: none;
}

/* Couleurs selon le type (assure-toi que ces variables sont définies) */
.node-npc { 
    background-color: var(--swiss-green); 
}
.node-player { 
    background-color: #007bff; /* Bleu joueur */
}

.mini-unity-preview { margin-top: auto; padding-top: 1rem; }

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center; /* Aligne verticalement au centre */
}

/* --- CORRECTION ALIGNEMENT DES BOUTONS DE L'ÉDITEUR --- */
.editor-controls {
    display: flex;
    flex-direction: row; /* Horizontal */
    gap: 15px; /* Espacement entre les boutons */
    align-items: center; /* Aligne verticalement au centre de la ligne */
}

/* --- STYLE BOUTON SUPPRESSION --- */
.delete {
    background-color: transparent;
    border-color: var(--swiss-red) !important;
    color: var(--swiss-red) !important;
}

.delete:hover {
    background-color: var(--swiss-red);
    color: var(--white) !important;
}

/* Classe active quand le mode suppression est enclenché */
.active-delete {
    background-color: var(--swiss-red);
    color: var(--white) !important;
    animation: pulse-red 1.5s infinite; /* Optionnel : petit effet de pulsation */
}

@keyframes pulse-red {
    0% { box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(255, 0, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 0, 0, 0); }
}

#scenario-title {
    font-size: 1.2rem; /* Plus petit */
    letter-spacing: 2px;
    border-left: 3px solid var(--swiss-green); /* Une petite barre verticale déco */
    padding-left: 15px;
    margin-left: 10px;
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
#toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
}
 
.toast {
    pointer-events: all;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: var(--white);
    border: 3px solid var(--black);
    box-shadow: 6px 6px 0px var(--black);
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    min-width: 280px;
    max-width: 380px;
    display: none;
}
 
.toast.show {
    display: flex;
}
 
.toast-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
}
 
.toast-message {
    flex: 1;
    line-height: 1.4;
}
 
.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 900;
    opacity: 0.4;
    padding: 0;
    transition: opacity 0.2s;
    flex-shrink: 0;
}
 
.toast-close:hover { opacity: 1; }
 
/* Variantes */
.toast-success {
    border-left: 8px solid var(--swiss-green);
}
 
.toast-error {
    border-left: 8px solid var(--swiss-red);
}
 
.toast-info {
    border-left: 8px solid #ff0000;
}
 
.toast-warning {
    border-left: 8px solid #f59e0b;
}
 
/* ============================================================
   MODAL DE CONFIRMATION (remplace confirm())
   ============================================================ */
 
#confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 8000;
    display: none;
    align-items: center;
    justify-content: center;
}
 
#confirm-overlay.show {
    display: flex;
}
 
.confirm-box {
    background: var(--white);
    border: 4px solid var(--black);
    box-shadow: 10px 10px 0px var(--black);
    padding: 2.5rem;
    max-width: 420px;
    width: 90%;
}
 
.confirm-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}
 
.confirm-title {
    font-size: 1.1rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
}
 
.confirm-message {
    font-size: 13px;
    color: #555;
    margin-bottom: 2rem;
    line-height: 1.5;
}
 
.confirm-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}
 
.confirm-actions .btn {
    padding: 0.8rem 1.5rem;
    font-size: 10px;
}

/* --- AJOUTS POUR LA FICHE RÉCAP ET L'ALIGNEMENT --- */

/* Alignement des boutons dans la sidebar */
.header-actions {
    display: flex;
    gap: 15px;
    margin-top: 10px;
}

/* Style spécifique pour le bouton récap pour le différencier un peu */
.blue-border {
    border: 1px solid #3498db !important;
}

/* Overlay de la modale (fond sombre) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000; /* Très haut pour être au dessus de tout */
}

/* Contenu de la modale récap */
.recap-modal {
    width: 600px !important;
    max-width: 90%;
    background: white;
    padding: 2.5rem !important;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}

.recap-modal .subtitle {
    font-size: 13px;
    color: #666;
    margin-bottom: 1.5rem;
}

/* Champ de texte du récap */
#recap-text {
    width: 100%;
    height: 250px;
    padding: 15px;
    border: 2px solid #eeeeee;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    resize: none;
    margin-bottom: 2rem;
    transition: border-color 0.2s;
}

#recap-text:focus {
    outline: none;
    border-color: #000;
}

/* Actions de la modale */
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
}

/* Classe utilitaire pour cacher les éléments */
.hidden {
    display: none !important;
}


/* --- CARTE AJOUT SCÉNARIO --- */
.scenario-card.add-new {
    border: 3px dashed var(--gray-medium);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: var(--gray-text);
    background: transparent;
}

.scenario-card.add-new:hover {
    border-color: var(--black);
    color: var(--black);
    background: var(--gray-light);
    transform: scale(1.02);
}

.add-new .plus-icon {
    font-size: 5rem;
    font-weight: 900;
    line-height: 1;
}

.add-new span {
    font-size: 12px;
    font-weight: 800;
    margin-top: 10px;
}


/* MODIF INDEX CSS */

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
}

.card-actions {
    display: flex;
    gap: 10px;
    opacity: 0; /* Caché par défaut */
    transition: opacity 0.2s ease;
}

.scenario-card:hover .card-actions {
    opacity: 1; /* Apparaît au survol de la carte */
}

.action-btn {
    background: white;
    border: 2px solid var(--black);
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}

.action-btn:hover {
    transform: scale(1.1);
    background: var(--gray-light);
}

.delete-btn:hover {
    background: var(--swiss-red);
    color: white;
}

.edit-btn:hover {
    background: #3498db;
    color: white;
}

/* Ajustement pour le titre dans la carte */
.scenario-display-name {
    font-size: 1.5rem;
    margin-top: auto;
}

/* pop up de confirmation de suppression */

#modal-input-container {
    margin: 1.5rem 0;
}

#modal-input-field {
    width: 100%;
    border: 3px solid var(--black);
    padding: 1rem;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    outline: none;
    background: var(--gray-light);
}

#modal-input-field:focus {
    background: var(--white);
    box-shadow: 4px 4px 0px var(--black);
}

/* On s'assure que l'overlay est bien centré et caché par défaut */
.confirm-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.confirm-overlay.show {
    display: flex;
}