/* Reset basique */
body {
    margin: 0;
    padding: 0;
    background-color: #222;
    /* Fond général sombre */
    color: #eee;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Pour éviter le scroll global */
    height: 100vh;
}

/* --- 2. Structure Générale --- */

/* Bannière 100px de haut */
#banner {
    height: 100px;
    width: 100%;
    background-color: #333;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-bottom: 2px solid #555;
}

#banner h1 {
    margin: 0;
    font-size: 1.8em;
    color: #4CAF50;
    /* Vert NSI */
}

#banner h2 {
    margin: 0;
    font-size: 1em;
    font-weight: normal;
    color: #aaa;
}

/* Conteneur principal */
#conteneur_simulation {
    flex-grow: 1;
    position: relative;
    width: 100%;
    max-width: 1200px;
    /* Plus étroit (largeur max) */
    margin: 0 auto;
    /* Centré */
    background-color: #1a1a1a;
    display: flex;
    flex-direction: column;
    /* Empilement vertical strict */
    height: 100%;
    overflow: hidden;
}

/* Footer 50px de haut */
#footer {
    height: 40px;
    /* Un peu plus discret */
    width: 100%;
    background-color: #111;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.8em;
    color: #777;
    border-top: 1px solid #444;
}

/* --- 3. Harmonisation des fenêtres --- */

/* Identifiant fenêtre unique (classe) */
.fenetre {
    box-sizing: border-box;
    border: 1px solid #555;
    background-color: #2a2a2a;
    position: relative;
    padding: 5px;
    margin: 0;
    overflow: hidden;
}

/* Positionnement Relatif */
/* Fenêtre Simulation : Hauteur Fixe pour garantir la visibilité des infos */
.fenetre_1 {
    width: 100%;
    flex: 0 0 340px;
    /* Taille fixe suffisante pour Canvas + Infos */
    min-height: 340px;
    display: flex;
    flex-direction: column;
}

/* Fenêtre Tableau : Prend tout l'espace restant */
.fenetre_2 {
    width: 100%;
    flex: 1;
    /* Prend tout le reste */
    min-height: 0;
    /* Crucial pour que le flex-child scroll fonctionne */
    display: flex;
    flex-direction: column;
    overflow-y: hidden;
    /* Le scroll est géré par les enfants si besoin, ici c'est tableau_container qui doit scroller ? Non, fenetre_2 doit scroller globalement */
    overflow-y: auto;
}

.titre_fenetre {
    display: block;
    font-size: 0.8em;
    color: #aaa;
    margin-bottom: 5px;
    border-bottom: 1px solid #444;
}

/* Style du tableau HTML (pseudo-tableau avec div/span) */
#tableau_container {
    width: 100%;
    display: flex;
    flex-direction: column;
}

.row {
    display: flex;
    width: 100%;
    border-bottom: 1px solid #444;
}

.header {
    background-color: #444;
    font-weight: bold;
}

.cell {
    flex: 1;
    padding: 5px;
    text-align: center;
    border-right: 1px solid #444;
    min-height: 20px;
}

.cell[contenteditable="true"]:focus {
    background-color: #3d3d3d;
    outline: 1px solid #4CAF50;
}

/* Active Row Highlight */
.row.active-row {
    background-color: #FFD700 !important;
    /* Gold */
    color: black !important;
    font-weight: bold;
    border: 2px solid #FFA000;
}

.row.active-row .cell {
    border-right-color: #000;
}

/* --- Controls --- */
#controls_container {
    padding: 10px;
    background-color: #222;
    border-bottom: 1px solid #444;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 5px;
}

input[type="text"],
select {
    background-color: #333;
    color: white;
    border: 1px solid #555;
    padding: 5px;
    border-radius: 3px;
}

select {
    cursor: pointer;
}

button {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 5px 10px;
    cursor: pointer;
    border-radius: 3px;
}

button:hover {
    background-color: #45a049;
}

button.btn-delete {
    background-color: #f44336;
    padding: 2px 6px;
    font-size: 0.8em;
}

button.btn-delete:hover {
    background-color: #d32f2f;
}

#btn_step {
    background-color: #2196F3;
}

#btn_run {
    background-color: #ff9800;
}

#btn_reset {
    background-color: #9e9e9e;
}

.action-cell {
    flex: 0 0 50px;
    /* Largeur fixe pour la colonne action */
    border-right: none;
}

/* Canvas occupe 100% de son conteneur */
canvas {
    display: block;
    /* Évite les marges fantômes */
    width: 100% !important;
    height: 100% !important;
}

#canvas-container {
    flex: 3;
    /* 75% approx */
    height: 100%;
    position: relative;
    border-right: 1px solid #444;
}

/* Layout divisé pour la fenêtre 1 */
#simu_layout {
    display: flex;
    width: 100%;
    flex: 1;
    /* Prend toute la hauteur dispo dans fenetre_1 */
    overflow: hidden;
}

#info_panel {
    flex: 1;
    /* 25% approx */
    background-color: #222;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-family: 'Consolas', 'Courier New', monospace;
}

#info_panel h3 {
    margin: 0 0 10px 0;
    color: #4CAF50;
    font-size: 1.1em;
    text-align: center;
    border-bottom: 2px solid #4CAF50;
    padding-bottom: 5px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.1em;
}

.info-row .label {
    color: #aaa;
}

.info-row .value {
    color: #fff;
    font-weight: bold;
    font-size: 1.2em;
}

.info-row .value.waiting {
    color: #777;
    font-style: italic;
    font-size: 0.9em;
}

.info-details {
    margin-top: 10px;
    background-color: #333;
    padding: 10px;
    border-radius: 5px;
    font-size: 0.9em;
    color: #ccc;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.info-details b {
    color: #FFD700;
}
/* --- Easter Egg Overlay --- */
.easter-egg-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    pointer-events: none; /* Click-through */
    animation: fadeOut 0.5s ease-in-out 3.5s forwards;
}

.easter-egg-content {
    font-family: 'Courier New', Courier, monospace;
    color: #0f0; /* Hacker Green */
    text-align: center;
    border: 4px solid #0f0;
    padding: 40px;
    background-color: #000;
    box-shadow: 0 0 20px #0f0, inset 0 0 20px #0f0;
    animation: zoomIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.easter-egg-content h1 {
    font-size: 3em;
    margin: 0 0 20px 0;
    text-shadow: 0 0 10px #0f0;
}

.easter-egg-content p {
    font-size: 1.5em;
    margin: 0;
    animation: blink 0.5s step-end infinite alternate;
}

@keyframes zoomIn {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes blink {
    50% { opacity: 0; }
}

@keyframes fadeOut {
    to { opacity: 0; visibility: hidden; }
}

