/* -------------------------------------------------------- */
/* main.css – CREATEV2 PAGE (CLEAN + STABLE + RESPONSIVE)     */
/* -------------------------------------------------------- */

/* ========================= */
/* STRUCTURE GLOBALE         */
/* ========================= */

html, body {
    height: 100%;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ========================= */
/* MAIN                      */
/* ========================= */

main {
    flex: 1;

    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;

    padding: 20px;
    position: relative;

    /* cohérence avec index */
    background: linear-gradient(
to bottom,
rgba(0,191,255,0.6),
rgba(0,172,229,0.64),
rgba(0,153,204,0.68),
rgba(0,134,178,0.72),
rgba(0,115,153,0.76),
rgba(0,96,127,0.80),
rgba(0,76,102,0.84),
rgba(0,57,76,0.88),
rgba(0,38,51,0.92),
rgba(0,19,25,0.96),
rgba(0,0,0,1)
);

    overflow-x: hidden;
}

/* ========================= */
/* CONTAINER                 */
/* ========================= */

.create-container {
    width: 100%;
    max-width: 800px;

    margin: 20px auto;
    padding: 20px;

    display: flex;
    flex-direction: column;
    gap: 20px;

    /* style carte comme index */
    background: rgba(255,255,255,0.85);
    border-radius: 12px;

    box-shadow: 
        0 6px 25px rgba(0,0,0,0.6),
        0 0 8px rgba(255,255,255,0.3);

    transition: transform 0.3s ease, box-shadow 0.3s ease;

    transform: translateZ(0);
    backface-visibility: hidden;
}

.create-container:hover {
    transform: translateY(-5px) translateZ(0);

    box-shadow: 
        0 10px 35px rgba(0,0,0,0.75),
        0 0 10px rgba(255,255,255,0.4);
}

.create-container h2 {
    text-align: center;
    margin-top: 0;

    color: #0055A4;
}

/* ========================= */
/* EDITOR                    */
/* ========================= */

#editor {
    background: rgba(0,0,0,0.05);
    padding: 20px;
    border-radius: 12px;
}

/* ========================= */
/* BLOCS                     */
/* ========================= */

.block {
    position: relative;

    margin-bottom: 15px;
    padding: 12px;

    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;
    font-family: inherit;
}

.block textarea {
    resize: vertical;
    min-height: 80px;
}

/* TYPO */

.block[data-type="h2"] input {
    font-size: 22px;
    font-weight: bold;
}

.block[data-type="h3"] input {
    font-size: 18px;
    font-weight: 600;
}

/* DELETE BUTTON */

.block button {
    position: absolute;
    top: 5px;
    right: 5px;

    background: red;
    color: white;
    border: none;
    border-radius: 4px;

    cursor: pointer;
}

/* ========================= */
/* ACTIONS                   */
/* ========================= */

.editor-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.editor-actions + .editor-actions {
    margin-top: 25px;
}

.editor-actions button {
    padding: 8px 12px;

    background: #00bfff;
    color: white;

    border: none;
    border-radius: 6px;

    cursor: pointer;

    transition: background 0.2s ease;
}

.editor-actions button:hover {
    background: #009acd;
}

/* ========================= */
/* LISTE JSON                */
/* ========================= */

.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                   */
/* ========================= */

.preview-box {
    position: fixed;

    top: 175px;
    left: calc(85% - 225px);

    width: 470px;
    height: 540px;

    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;
}

/* ACTIONS */

.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: 893px;

    left: calc(50% - 400px);
    top: 0px;
}

/* ======================================================== */
/* ====================== RESPONSIVE ======================= */
/* ======================================================== */

/* -------- TABLET -------- */
@media (max-width: 1024px) {

    main {
        padding: 18px;
    }

    .create-container {
        max-width: 95%;
        padding: 15px;
    }

    #editor {
        padding: 15px;
    }

    .preview-box {
        width: 360px;
        height: 240px;
        left: calc(50% - 180px);
        top: 250px;
    }

    .preview-box.big {
        width: 90vw;
        height: 70vh;
        left: 5vw;
        top: 60px;
    }
}

/* -------- MOBILE -------- */
@media (max-width: 768px) {

    main {
        padding: 15px;
    }

    .create-container {
        padding: 12px;
        gap: 15px;
    }

    .editor-actions {
        flex-direction: column;
        gap: 8px;
    }

    .editor-actions button {
        width: 100%;
    }

    .preview-box {
        width: 90vw;
        height: 60vh;

        left: 5vw;
        top: 100px;
    }

    .preview-box.big {
        width: 95vw;
        height: 80vh;

        left: 2.5vw;
        top: 40px;
    }
}

/* -------- SMALL MOBILE -------- */
@media (max-width: 480px) {

    .block input {
        font-size: 16px;
    }

    .block textarea {
        font-size: 15px;
    }

    .preview-header span {
        font-size: 0.9em;
    }

    .preview-actions button {
        padding: 2px 5px;
    }
}