/* ========================================
   GENERATE MODEL PAGE - generate-model.php
   ======================================== */

/* -------------- 3D LOADER -------------- */
.loader-3d-container {
    width: 100%;
    height: 100%;
    backdrop-filter: blur(10px);
    position: absolute;
    left: 0px;
    top: 0;
    display: none;
    justify-content: center;
    align-items: center;
    border-radius: 10px;
}

.loader-3d {
    width: 44px;
    height: 44px;
    animation: spinner-3d-loader 2s infinite ease;
    transform-style: preserve-3d;
    position: absolute;
}

.loader-3d > div {
    background-color: rgba(20, 97, 226, 0.2);
    height: 100%;
    position: absolute;
    width: 100%;
    border: 2px solid rgb(28, 97, 226);
}

.loader-3d div:nth-of-type(1) {
    transform: translateZ(-22px) rotateY(180deg);
}

.loader-3d div:nth-of-type(2) {
    transform: rotateY(-270deg) translateX(50%);
    transform-origin: top right;
}

.loader-3d div:nth-of-type(3) {
    transform: rotateY(270deg) translateX(-50%);
    transform-origin: center left;
}

.loader-3d div:nth-of-type(4) {
    transform: rotateX(90deg) translateY(-50%);
    transform-origin: top center;
}

.loader-3d div:nth-of-type(5) {
    transform: rotateX(-90deg) translateY(50%);
    transform-origin: bottom center;
}

.loader-3d div:nth-of-type(6) {
    transform: translateZ(22px);
}

@keyframes spinner-3d-loader {
    0% {
        transform: rotate(45deg) rotateX(-25deg) rotateY(25deg);
    }
    50% {
        transform: rotate(45deg) rotateX(-385deg) rotateY(25deg);
    }
    100% {
        transform: rotate(45deg) rotateX(-385deg) rotateY(385deg);
    }
}

/* -------------- BODY & FORM -------------- */
.generate-page {
    background: url('/assets/img/back-3d.png');
    background-size: cover;
    background-color: #45484d;
}

.form-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    min-height: calc(100vh - 150px);
}

#uploadForm {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    text-align: center;
    width: 100%;
    max-width: 600px;
    position: relative;
}

#uploadForm em {
    margin-top: 10px;
    font-size: 14px;
    color: #222222;
}

#fileInput {
    width: 100%;
    padding: 10px;
    border: 2px dashed #656565;
    background: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    font-family: inherit;
    font-size: 14px;
    color: #333;
    box-sizing: border-box;
}

#fileInput::-webkit-file-upload-button {
    visibility: hidden;
}

#fileInput::before {
    content: "Selectionner un fichier";
    display: block;
    background: #656565;
    color: white;
    padding: 10px;
    text-align: center;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
}

/* Boutons côte à côte (Coller / Générer) */
.action-row {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    margin-bottom: 12px;
    align-items: stretch;
}

.action-row > .paste-btn,
.action-row > #uploadBtn {
    flex: 1;
    margin-top: 0;
}

.paste-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 14px;
    background: #f8f3fc;
    color: #a049cc;
    border: 2px dashed #d0b8e6;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    box-sizing: border-box;
    white-space: nowrap;
}

.paste-btn i {
    font-size: 1.1rem;
}

.paste-btn:hover {
    background: #f1e4fa;
    border-color: #a049cc;
    color: #8a3aad;
}

.paste-btn:active {
    background: #a049cc;
    color: #fff;
    border-color: #a049cc;
}

#uploadBtn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    border: none;
    padding: 12px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 700;
    font-family: inherit;
    transition: all 0.2s;
    background: #a049cc;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(160, 73, 204, 0.28);
    box-sizing: border-box;
    white-space: nowrap;
}

#uploadBtn i {
    font-size: 1.1rem;
}

#uploadBtn:hover {
    background: #8a3aad;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(160, 73, 204, 0.4);
}

#uploadBtn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(160, 73, 204, 0.3);
}

/* Aperçu image après upload/paste */
.preview-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 6px;
}

#previewImage {
    width: 100%;
    max-width: 600px;
    max-height: 40vh;
    display: none;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    object-fit: cover;
}

/* -------------- MODEL INFO -------------- */
#amount-model {
    margin-bottom: 15px;
}

#exp-model {
    font-weight: 700;
    font-size: 17px;
    color: darkcyan;
}

/* -------------- RESULT PANEL -------------- */
.result-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #f5f3fa;
    flex-direction: column;
    align-items: center;
    z-index: 2;
    overflow-y: auto;
    padding: 90px 20px 40px;
    box-sizing: border-box;
}

.result-header {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #fff;
    padding: 20px 24px;
    border-radius: 14px;
    border: 1px solid #e8ecf1;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    max-width: 1200px;
    width: 100%;
    margin-bottom: 20px;
}

.result-header > i {
    font-size: 1.8rem;
    color: #2e7d32;
    background: #e8f5e9;
    padding: 12px;
    border-radius: 12px;
}

.result-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a1a2e;
}

.result-header p {
    margin: 2px 0 0;
    font-size: 0.82rem;
    color: #888;
}

/* Preview */
.result-preview {
    display: flex;
    gap: 16px;
    max-width: 1200px;
    width: 100%;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.result-preview-item {
    flex: 1;
    min-width: 280px;
    background: #1a1a2e;
    border-radius: 12px;
    border: 1px solid #e8ecf1;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-preview-item img {
    width: 100%;
    height: 100%;
    min-height: 300px;
    max-height: 450px;
    object-fit: contain;
    display: block;
    background: #1a1a2e;
}

.result-preview-item video {
    width: 100%;
    height: 100%;
    min-height: 300px;
    max-height: 450px;
    object-fit: contain;
    display: block;
    background: #1a1a2e;
}

/* Downloads section */
.result-downloads {
    max-width: 1200px;
    width: 100%;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e8ecf1;
    padding: 16px 20px;
    margin-bottom: 12px;
}

.result-downloads h4 {
    margin: 0 0 12px;
    font-size: 0.88rem;
    font-weight: 600;
    color: #1a1a2e;
    display: flex;
    align-items: center;
    gap: 6px;
}

.result-downloads h4 i {
    color: #a049cc;
    font-size: 1rem;
}

.result-dl-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.result-dl-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    background: #a049cc;
    color: #fff;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    font-family: inherit;
}

.result-dl-btn:hover {
    background: #8a3aad;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(160, 73, 204, 0.3);
}

.result-dl-btn i {
    font-size: 0.95rem;
}

.result-dl-btn-outline {
    background: #fff;
    color: #a049cc;
    border: 1px solid #a049cc;
}

.result-dl-btn-outline:hover {
    background: #a049cc;
    color: #fff;
}

/* Download All */
.result-dl-all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    max-width: 1200px;
    width: 100%;
    padding: 14px 20px;
    background: #1a1a2e;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 12px;
}

.result-dl-all:hover {
    background: #a049cc;
    box-shadow: 0 4px 14px rgba(160, 73, 204, 0.35);
}

.result-dl-all i {
    font-size: 1.1rem;
}

/* Back button */
.result-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    max-width: 1200px;
    width: 100%;
    padding: 12px 20px;
    background: transparent;
    color: #888;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.result-back-btn:hover {
    border-color: #a049cc;
    color: #a049cc;
}

/* -------------- 3D VIEWER (page de succès) -------------- */
#gen-canvas-container {
    max-width: 1200px;
    width: 100%;
    height: 580px;
    min-height: 580px;
    flex: 0 0 580px;
    margin: 0 auto 20px;
    background: #1a1a2e;
    position: relative;
    border-radius: 12px;
    border: 1px solid #e8ecf1;
    overflow: hidden;
    display: none;
}

#gen-canvas-container > canvas {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    cursor: grab;
    display: block;
}

#gen-canvas-container > canvas:active {
    cursor: grabbing;
}

#gen-model-info {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 12px 14px;
    font-size: 13px;
    border-radius: 10px;
    line-height: 1.6;
    z-index: 2;
    max-width: 220px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

#gen-model-info b {
    font-weight: 600;
    color: #ddd;
}

#gen-model-info button {
    display: block;
    width: 100%;
    padding: 8px 10px;
    margin-top: 6px;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    transition: background 0.2s;
}

#gen-model-info button:hover {
    background: rgba(255, 255, 255, 0.25);
}

#gen-model-info #gen-toggle-model-version {
    background: #a049cc;
    color: #fff;
    font-weight: 600;
    margin-top: 8px;
}

#gen-model-info #gen-toggle-model-version:hover {
    background: #8a3aad;
}

#gen-model-info button.active {
    background: rgba(130, 220, 110, 0.35);
    color: #fff;
}

#error-label {
    display: none;
    color: red;
    font-weight: 900;
    text-align: left;
    padding-top: 20px;
    padding-bottom: 20px;
}

#loader-message {
    color: #000000;
    font-size: 20px;
    font-weight: 600;
    max-width: 80%;
    position: absolute;
    top: calc(50% + 50px);
}

#loader-progress-bar {
    width: 0;
    height: 5px;
    background-color: #3371e3;
    transition: width 50s linear;
    position: fixed;
    bottom: 0;
    left: 0;
    border-radius: 10px;
}

/* -------------- GENERATION INFO -------------- */
.generation-info {
    background: #f5f5f5;
    padding: 20px;
    margin: 30px auto;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-family: 'Montserrat', sans-serif;
    color: #333;
    max-width: 800px;
}

.generation-info p {
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 15px;
}

.generation-info a {
    color: #1c61e2;
    text-decoration: none;
    font-weight: bold;
}

/* -------------- RESPONSIVE -------------- */
@media (max-width: 900px) {
    #uploadForm em {
        font-size: 10px;
    }

    #uploadForm {
        padding: 20px;
    }

    .form-container {
        padding-top: 20vh;
        align-items: flex-start;
    }
}

@media (max-width: 768px) {
    #amount-model {
        margin-bottom: 12px;
        font-size: 14px;
    }

    #exp-model {
        font-size: 14px;
        text-align: justify;
    }

    .generation-info p {
        font-size: 12px;
    }

    .admin-bulk-panel {
        margin: 20px 12px 30px;
    }

    #gen-canvas-container {
        height: 400px;
        min-height: 400px;
        flex: 0 0 400px;
    }

    .action-row {
        flex-direction: column;
        gap: 8px;
    }

    .paste-btn,
    #uploadBtn {
        font-size: 0.85rem;
        padding: 11px 12px;
    }

    #gen-model-info {
        font-size: 11px;
        padding: 8px 10px;
        max-width: 170px;
        top: 8px;
        right: 8px;
    }

    #gen-model-info button {
        padding: 6px 8px;
        font-size: 0.72rem;
        margin-top: 4px;
    }
}

/* -------------- ADMIN BULK PANEL -------------- */
.admin-bulk-panel {
    max-width: 1200px;
    margin: 30px auto 40px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 24px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.admin-bulk-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid #f0f0f0;
}

.admin-bulk-header > i {
    font-size: 1.8rem;
    color: #a049cc;
    background: #f5f0fa;
    padding: 10px;
    border-radius: 12px;
}

.admin-bulk-header h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #1a1a2e;
}

.admin-bulk-header p {
    margin: 2px 0 0;
    font-size: 0.82rem;
    color: #888;
}

.admin-bulk-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 30px 20px;
    border: 2px dashed #d0c4e8;
    border-radius: 12px;
    background: #faf8fd;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.admin-bulk-dropzone:hover {
    border-color: #a049cc;
    background: #f3ecfa;
}

.admin-bulk-dropzone.dragover {
    border-color: #a049cc;
    background: #ede4f7;
    transform: scale(1.01);
}

.admin-bulk-dropzone > i {
    font-size: 2rem;
    color: #a049cc;
}

.admin-bulk-dropzone-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1a1a2e;
}

.admin-bulk-dropzone-info {
    font-size: 0.78rem;
    color: #999;
}

.admin-bulk-dropzone input[type="file"] {
    display: none;
}

.admin-bulk-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 14px;
    padding: 14px 20px;
    background: #a049cc;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.admin-bulk-btn:hover {
    background: #8a3aad;
    box-shadow: 0 4px 14px rgba(160, 73, 204, 0.35);
    transform: translateY(-1px);
}

.admin-bulk-btn i {
    font-size: 1.1rem;
}
