/* ========================= */
/* STRUCTURE                 */
/* ========================= */

html, body {
    height: 100%;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ========================= */

main {
    flex: 1;
    display: flex;
    flex-direction: column;

    justify-content: flex-start;
    align-items: center;

    padding: 20px;
    padding-top: 20px;
}

/* ========================= */

.create-container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;

    padding: 20px;

    display: flex;
    flex-direction: column;
    gap: 20px;
}

.create-container h2 {
    text-align: center;
    margin-top: 0;
}

/* ========================= */

#editor {
    background: rgba(0,0,0,0.05);
    padding: 20px;
    border-radius: 12px;
}

/* ========================= BLOCS */

.block {
    position: relative;
    margin-bottom: 15px;
    padding: 10px;

    border: 1px solid #ccc;
    border-radius: 8px;

    background: rgba(255,255,255,0.6);
}

.block input,
.block textarea {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
}

.block.h2 input {
    font-size: 22px;
    font-weight: bold;
}

.block.h3 input {
    font-size: 18px;
    font-weight: 600;
}

.block button {
    position: absolute;
    top: 5px;
    right: 5px;

    background: red;
    color: white;
    border: none;
    border-radius: 4px;
}

/* ========================= ACTIONS */

.editor-actions {
    display: flex;
    gap: 10px;
}

.editor-actions + .editor-actions {
    margin-top: 25px;
}

.editor-actions button {
    padding: 8px 12px;
    background: #00bfff;
    color: white;
    border: none;
    border-radius: 6px;
}

/* ========================= LISTE */

.file-list {
    max-height: 200px;
    overflow-y: auto;

    margin-top: 10px;
    padding: 10px;

    border: 1px solid #ddd;
    border-radius: 8px;

    background: white;
}

.file-list div {
    padding: 6px;
    cursor: pointer;
}

.file-list div:hover {
    background: rgba(0,0,0,0.08);
}

.hidden {
    display: none;
}

/* ========================= PREVIEW (FIX DRAG STABLE) */

.preview-box {
    position: fixed;

    /* 🔥 position initiale propre */
    top: 350px;
    left: calc(50% - 210px); /* centre basé sur width 420px */

    width: 420px;
    height: 280px;

    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);

    display: flex;
    flex-direction: column;

    z-index: 9999;
}

/* HEADER */

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    padding: 8px;
    background: #00bfff;
    color: white;

    cursor: grab;
}

.preview-header:active {
    cursor: grabbing;
}

/* BUTTONS */

.preview-actions button {
    border: none;
    background: white;
    border-radius: 4px;
    padding: 2px 6px;
    cursor: pointer;
}

/* CONTENT */

.preview-content {
    padding: 10px;
    overflow-y: auto;
}

/* ========================= ZOOM */

.preview-box.big {
    width: 800px;
    height: 800px;

    /* recalcul centre propre */
    left: calc(50% - 400px);
    top: 80px;
}