/* -------------------------------------------------------- */
/* main.css – CREATE + PREVIEW                              */
/* Compatible create.js : h2 / h3 / text uniquement         */
/* -------------------------------------------------------- */


/* ========================= */
/* MAIN                      */
/* ========================= */

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-family: Arial, sans-serif;
    padding: 20px;
    overflow-x: hidden;
}

/* ========================= */
/* IMAGE PHP */
/* ========================= */

.main-image {
display: block;
max-width: 100%;
height: auto;
margin: 20px auto;
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;

/* stabilité GPU */
transform: translateZ(0);
backface-visibility: hidden;
}

/* Hover */
.main-image: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          */
/* ========================= */

.create-container {

    width: 100%;
    max-width: 800px;

    margin: 20px auto;
    padding: 20px;

    display: flex;
    flex-direction: column;
    gap: 20px;

    background: rgba(255,255,255,0.92);

    border-radius: 14px;

    box-shadow:
        0 8px 25px rgba(0,0,0,0.35);
}

/* ========================= */
/* TITLE                     */
/* ========================= */

.create-container h2 {

    margin: 0;

    text-align: center;

    color: #0055A4;

    font-size: 28px;
}


/* ========================= */
/* EDITOR                    */
/* ========================= */

#editor {

    display: flex;
    flex-direction: column;
    gap: 15px;

    padding: 20px;

    border-radius: 12px;

    background: rgba(0,0,0,0.04);
}


/* ========================= */
/* BLOCK                     */
/* ========================= */

.block {

    position: relative;

    padding: 14px;

    border-radius: 10px;
    border: 1px solid #cccccc;

    background: rgba(255,255,255,0.75);
}


/* ========================= */
/* INPUT / TEXTAREA          */
/* ========================= */

.block input,
.block textarea {

    width: 100%;

    border: none;
    outline: none;

    background: transparent;

    font-family: inherit;

    color: #222;
}


/* ========================= */
/* TEXTAREA                  */
/* ========================= */

.block textarea {

    min-height: 120px;

    resize: vertical;

    line-height: 1.6;

    font-size: 16px;
}


/* ========================= */
/* H2 INPUT                  */
/* ========================= */

.block[data-type="h2"] input {

    font-size: 26px;
    font-weight: bold;

    color: #0055A4;
}


/* ========================= */
/* H3 INPUT                  */
/* ========================= */

.block[data-type="h3"] input {

    font-size: 20px;
    font-weight: 600;

    color: #0077cc;
}


/* ========================= */
/* DELETE BUTTON             */
/* ========================= */

.block button {

    position: absolute;

    top: 8px;
    right: 8px;

    border: none;

    background: #ff3b3b;
    color: white;

    border-radius: 5px;

    padding: 4px 8px;

    cursor: pointer;

    transition: 0.2s ease;
}

.block button:hover {

    background: #d80000;
}


/* ========================= */
/* ACTIONS                   */
/* ========================= */

.editor-actions {

    display: flex;
    flex-wrap: wrap;

    gap: 10px;
}


/* ========================= */
/* ACTION BUTTONS            */
/* ========================= */

.editor-actions button {

    border: none;

    padding: 10px 14px;

    border-radius: 8px;

    background: #00bfff;
    color: white;

    font-size: 15px;

    cursor: pointer;

    transition: 0.2s ease;
}

.editor-actions button:hover {

    background: #0095dd;
}


/* ========================= */
/* FILE LIST                 */
/* ========================= */

.file-list {

    max-height: 250px;

    overflow-y: auto;

    margin-top: 10px;
    padding: 10px;

    border-radius: 10px;
    border: 1px solid #ddd;

    background: white;
}


/* ========================= */
/* FILE BUTTONS              */
/* ========================= */

.file-list button,
.file-list div {

    width: 100%;

    padding: 10px;

    border: none;

    background: transparent;

    text-align: left;

    border-radius: 6px;

    cursor: pointer;

    transition: 0.2s ease;
}

.file-list button:hover,
.file-list div:hover {

    background: rgba(0,0,0,0.06);
}


/* ========================= */
/* HIDDEN                    */
/* ========================= */

.hidden {

    display: none;
}


/* ========================= */
/* PREVIEW BOX               */
/* ========================= */

.preview-box {

    position: fixed;

    top: 175px;
    left: calc(85% - 225px);

    width: 470px;
    height: 680px;

    display: flex;
    flex-direction: column;

    overflow: hidden;

    background: white;

    border-radius: 14px;

    box-shadow:
        0 10px 30px rgba(0,0,0,0.35);

    z-index: 9999;
}


/* ========================= */
/* PREVIEW HEADER            */
/* ========================= */

.preview-header {

    display: flex;
    justify-content: space-between;
    align-items: center;

    padding: 10px 12px;

    background: #00bfff;
    color: white;

    font-weight: bold;

    cursor: grab;

    user-select: none;
}

.preview-header:active {

    cursor: grabbing;
}


/* ========================= */
/* PREVIEW ACTIONS           */
/* ========================= */

.preview-actions button {

    border: none;

    background: white;

    border-radius: 5px;

    padding: 4px 7px;

    cursor: pointer;
}


/* ========================= */
/* PREVIEW CONTENT           */
/* ========================= */

.preview-content {

    flex: 1;

    overflow-y: auto;

    padding: 18px;

    background: rgba(255,255,255,0.98);
}


/* ========================= */
/* PREVIEW H2                */
/* ========================= */

.preview-content h2 {

    margin-top: 20px;
    margin-bottom: 12px;

    color: #0055A4;

    font-size: 30px;

    line-height: 1.3;
}


/* ========================= */
/* PREVIEW H3                */
/* ========================= */

.preview-content h3 {

    margin-top: 18px;
    margin-bottom: 10px;

    color: #0084ff;

    font-size: 22px;

    line-height: 1.3;
}


/* ========================= */
/* PREVIEW TEXT              */
/* ========================= */

.preview-content p {

    margin-bottom: 16px;

    color: #222;

    line-height: 1.7;

    font-size: 16px;

    word-break: break-word;
}


/* ========================= */
/* HTML LINKS                */
/* ========================= */

.preview-content a {

    color: #0066cc;

    text-decoration: none;

    font-weight: 600;

    word-break: break-word;
}

.preview-content a:hover {

    text-decoration: underline;
}


/* ========================= */
/* HTML IMAGES               */
/* ========================= */

.preview-content img {

    max-width: 800px;

    border-radius: 10px;

    margin: 14px 0;
}


/* ========================= */
/* HTML VIDEO                */
/* ========================= */

.preview-content video {

    width: 800px;

    border-radius: 10px;

    margin: 14px 0;
}


/* ========================= */
/* HTML AUDIO                */
/* ========================= */

.preview-content audio {

    width: 300px;

    margin: 14px 0;
}


/* ========================= */
/* HTML IFRAME               */
/* ========================= */

.preview-content iframe {

    width: 800px;

    min-height: 300px;

    border: none;

    border-radius: 10px;

    margin: 14px 0;
}


/* ========================= */
/* HTML CODE                 */
/* ========================= */

.preview-content code {

    padding: 2px 6px;

    border-radius: 5px;

    background: rgba(0,0,0,0.08);

    font-family: Consolas, monospace;
}


/* ========================= */
/* HTML PRE                  */
/* ========================= */

.preview-content pre {

    overflow-x: auto;

    padding: 12px;

    border-radius: 10px;

    background: rgba(0,0,0,0.08);
}


/* ========================= */
/* PREVIEW BIG               */
/* ========================= */

.preview-box.big {

    width: 1400px;
    height: 890px;

    left: calc(50% - 700px);

    top: 0;
}


/* ======================================================== */
/* RESPONSIVE                                                */
/* ======================================================== */


/* -------- TABLET -------- */

@media (max-width: 1024px) {

    .preview-box {

        width: 360px;
        height: 240px;

        left: calc(50% - 180px);

        top: 240px;
    }

    .preview-box.big {

        width: 90vw;
        height: 70vh;

        left: 5vw;

        top: 60px;
    }
}


/* -------- MOBILE -------- */

@media (max-width: 768px) {

    main {

        padding: 15px;
    }

    .create-container {

        padding: 15px;
    }

    .editor-actions {

        flex-direction: column;
    }

    .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;
    }

    .preview-content h2 {

        font-size: 24px;
    }

    .preview-content h3 {

        font-size: 20px;
    }
}


/* -------- SMALL MOBILE -------- */

@media (max-width: 480px) {

    .preview-content {

        padding: 12px;
    }

    .preview-content h2 {

        font-size: 22px;
    }

    .preview-content h3 {

        font-size: 18px;
    }

    .block textarea {

        font-size: 15px;
    }
}