/* FORMULARIOS */
.slim-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.slim-form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.slim-1col-form {
    display: flex;
    gap: 15px;
    flex-direction: column;
}

.slim-form-row.full-row {
    grid-template-columns: repeat(1, 1fr);}

.slim-row-group {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.slim-row-group .list-image {
    margin: 1em 0;
}

.checkbox-group {
    display: flex;
    flex-direction: row-reverse;
    gap: 1em;
}

.row-action {
    display: flex;
    padding-top: 2px;
}

.row-action input {
    height: 18px;
    width: 18px;
}

.slim-row-group > .slim-inner-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.slim-row-group.align-right {
    align-items: flex-end;
}

.slim-2col-form {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.dropzone-container {
    align-items: center;
    min-height: 100px;
    padding: 20px 10px;
    display: flex;
    position: relative;
    border: 2px dashed var(--slim-main-dark-trans);
    border-radius: 5px;
    background-color: var(--slim-gray);
    margin: 4px 0;
}

.dropzone-input {
    opacity: 0;
    cursor: pointer;
    z-index: 1;
    width: 100%;
    height: 100%;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
}

.dropzone-placeholder {
    text-align: center;
    color: var(--slim-main-dark-trans);
    flex-grow: 1;
}

.dropzone-preview {
    align-items: center;
    max-width: 100%;
    display: flex;
}

.dropzone-preview-button {
    z-index: 1;
    width: auto;
    color: inherit;
    font: inherit;
    -webkit-font-smoothing: inherit;
    -moz-osx-font-smoothing: inherit;
    -webkit-appearance: none;
    background: 0 0;
    border: none;
    margin: 0;
    padding: 0;
    line-height: normal;
    position: absolute;
    top: 0;
    right: 0;
    overflow: visible;
}

.dropzone-preview-button::before {
    content: '×';
    padding: 3px 7px;
    cursor: pointer;
}

.dropzone-preview-image {
    background-position: 50%;
    background-repeat: no-repeat;
    background-size: contain;
    flex-basis: 0;
    min-width: 50px;
    max-width: 50px;
    height: 50px;
    margin-right: 10px;
}

.slim-form-row.slim-form-action-buttons {
    display: flex;
    flex-direction: row;
    justify-content: center;
    margin-top: 15px;
}

.quill-small .ql-editor {
    height: fit-content;
    min-height: fit-content;
}

.ql-toolbar.ql-snow {
    margin-top: 4px;
    border: 1px solid var(--slim-main-dark-trans);
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
}

.ql-container.ql-snow {
    border: 1px solid var(--slim-main-dark-trans);
    border-top: 0;
    max-height: fit-content;
    height: fit-content;
}

.ql-container.ql-snow.is-invalid {
    border: 1px solid var(--slim-alert-button);
}

.ql-editor {
    height: 350px;
    max-width: 100%;
    min-height: 150px;
    overflow-x: hidden;
    overflow-y: auto;
    background-color: #EEEEEE;
    padding: 12px;
    width: 100%;
    word-wrap: break-word;
    word-break: break-word;
    white-space: pre-wrap;
}

.slim-form-row.slim-button-row {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.dropzone {
    background-color: var(--slim-gray);
    border-radius: 5px;
    border: 2px dashed var(--slim-main-dark-trans);
    min-height: 75%;
    margin: 5px 0;
}

.dropzone .dz-preview.dz-image-preview {
    background-color: var(--slim-gray);
}

/* fs-dropzone (form_submission_edit_body.html.twig) usa una plantilla propia
   (#fs-file-preview-template) con icono de documento por defecto, ya que un
   mismo campo "file" puede aceptar tanto imágenes como documentos: solo se
   muestra la miniatura real cuando el fichero (nuevo o ya existente) resulta
   ser una imagen, ver isImageFile() en form_submission_edit_controller.js. */
.fs-dropzone .dz-preview .dz-image {
    display: none;
}

.fs-dropzone .dz-preview.fs-file-is-image .dz-image {
    display: block;
}

.fs-dropzone .dz-preview.fs-file-is-image .dz-icon {
    display: none;
}

.dropzone .dz-preview[draggable="true"] {
    cursor: grab;
    transition: box-shadow 0.25s cubic-bezier(0.2, 0.8, 0.2, 1),
                transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1),
                opacity 0.2s ease;
    will-change: transform;
}

.dropzone .dz-preview[draggable="true"] img {
    -webkit-user-drag: none;
    user-select: none;
}

.dropzone .dz-preview[draggable="true"]:active {
    cursor: grabbing;
}

.dropzone .dz-preview.dragging {
    opacity: 0.35;
    transform: scale(0.94) rotate(-1.5deg);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
    z-index: 5;
}

.dropzone .dz-preview.drag-over {
    box-shadow: 0 0 0 2px var(--slim-standard-button);
    transform: scale(1.04) translateY(-2px);
}

@keyframes file-manager-drop-settle {
    0% {
        box-shadow: 0 0 0 0 var(--slim-standard-button);
    }
    70% {
        box-shadow: 0 0 0 8px transparent;
    }
    100% {
        box-shadow: 0 0 0 0 transparent;
    }
}

.dropzone .dz-preview.drop-settled {
    animation: file-manager-drop-settle 0.45s ease-out;
}

.dropzone .dz-message .dz-button {
    color: var(--slim-main-dark-trans);
}

.dz-progress {
    display: none !important;
}

.dropzone .dz-preview .dz-remove {
    position: absolute;
    top: 10px;
    z-index: 33;
    right: 10px;
    background-color: var(--danger);
    font-size: 14px;
    font-weight: bold;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.dropzone.dz-clickable * {
    cursor: zoom-in;
}

/* Link de descarga del fichero ya subido en los previews de Dropzone (FormUtils.
   addExistingFileDownloadLink), usado en todos los multi-dropzone de la app. No debe
   heredar el cursor de zoom de la regla anterior, ya que no abre el lightbox. */
.dropzone .dz-preview .fs-existing-file-link {
    cursor: pointer;
}

/* dropzone.min.css solo pone el fondo semitransparente (para legibilidad sobre la
   miniatura) en el <span> que trae por defecto dentro de .dz-filename (selector
   ".dz-filename span"). Como lo sustituimos por un <a>, esa regla ya no aplica:
   se repite aquí sobre nuestra propia clase para no perder el fondo. */
.dz-filename .fs-existing-file-link {
    background-color: rgba(255, 255, 255, 0.4);
    padding: 0 0.4em;
    border-radius: 3px;
    border: 1px solid transparent;
}

.dz-filename:hover .fs-existing-file-link {
    background-color: rgba(255, 255, 255, 0.8);
    border-color: rgba(200, 200, 200, 0.8);
}

.dropzone .dz-preview .dz-remove span {
    font-size: 1.2em;
    color: white;
    font-weight: 600;
    cursor: pointer;
    margin-top: 3px;
}

.dropzone .dz-preview .dz-remove:hover {
    background-color: var(--slim-alert-button);;
    text-decoration: none;
}

.dropzone-container.is-invalid {
    border: 2px dashed var(--slim-alert-button);
}

.slim-form-preview {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.slim-form-preview ol, .slim-form-preview ul {
    list-style-position: inside;
    padding-left: 30px;
}

.preview-footer {
    display: flex;
    justify-content: flex-end;
}

/* PANEL DE PREVISUALIZACIÓN DE IMÁGENES INTERACTIVO */

.main-image-container {
    position: relative;
    width: 100%;
    height: 400px;
    background: #e9ecef;
    border: 2px dashed #adb5bd;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.main-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

.main-image-placeholder {
    text-align: center;
    color: #6c757d;
}

.main-image-placeholder i {
    font-size: 48px;
    margin-bottom: 10px;
    display: block;
}

/* Segunda fila - Galería */

.gallery-title {
    margin-bottom: 10px;
    font-size: 18px;
    font-weight: 600;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 15px;
}

.gallery-item {
    position: relative;
    aspect-ratio: 1;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gallery-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.gallery-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #adb5bd;
    font-size: 24px;
}

.gallery-item .hover-icon {
    position: absolute;
    top: 8px;
    right: 8px;
}

/* Botón de eliminar */
.delete-btn {

    width: 28px;
    height: 28px;
    background: var(--slim-alert-button);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.2s ease;
    opacity: 0;
    transform: scale(0.8);
}

.gallery-item:hover .delete-btn {
    opacity: 1;
    transform: scale(1);
}

.delete-btn:hover {
    background: #6e1010;
    transform: scale(1.1);
}

/* Botón para añadir imágenes */
.add-image-btn {
    background: #007bff;
    color: white;
    border: 2px dashed #007bff;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    font-size: 14px;
    transition: all 0.2s ease;
    aspect-ratio: 1;
}

.add-image-btn:hover {
    background: #0056b3;
    border-color: #0056b3;
    transform: translateY(-2px);
}

.add-image-btn i {
    font-size: 24px;
    margin-bottom: 5px;
}

/* Input file oculto */
.file-input {
    display: none;
}

.preview-body {
    background-color: var(--slim-gray);
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.translations-preview .preview-body {
    background-color: transparent;
    box-shadow: none;
}


.slim-card.translation-card {
    background: var(--slim-gray);
    box-shadow: none;
}

.slim-card.translation-card .slim-card-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* URL GRID */

.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 0.5rem;
}

.link-preview-item {
    position: relative;
    background: #f2f2f2;
    border: 1px solid #ddd;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0.5rem;
    text-align: center;
    aspect-ratio: 1 / 1;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.link-preview-item p {
    margin: 0.25rem 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.link-preview-item p:nth-child(2) {
    font-size: 0.8rem;
    opacity: 0.75;
}

.link-preview-item:hover {
    background: #e9e9e9;
    border-color: var(--slim-main-dark-trans);
}

.link-preview-item.add-new {
    background: #fff;
    border: 2px dashed var(--slim-main-dark-trans);
    font-size: 2rem;
    font-weight: bold;
    color: #999;
}

.link-preview-item.add-new:hover {
    border-color: #666;
    color: #666;
}

.link-preview-item img.link-logo-preview {
    max-width: 70%;
    max-height: 40px;
    object-fit: contain;
    margin-bottom: 0.25rem;
}

.link-preview-item .link-remove-btn {
    text-decoration: none;
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 33;

    color: #fff;
    background-color: var(--danger);

    font-size: 14px;
    font-weight: bold;

    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;

    transition: background-color 0.2s ease, transform 0.1s ease;
}

.link-preview-item .link-remove-btn span {
    font-size: 1.2em;
    color: white;
    font-weight: 600;
}

.link-preview-item .link-remove-btn:hover {
    background-color: var(--slim-alert-button);;
}

.u-form div:last-of-type {
    display: flex;
    justify-content: flex-end;
}

/* Responsive */
@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }

    .panel {
        margin: 10px;
    }

    .main-image-section,
    .gallery-section {
        padding: 20px;
    }

    .main-image-container {
        height: 250px;
    }
}

@media screen and (max-width: 850px) {
    .slim-form-row {
        grid-template-columns: unset;
        grid-template-rows: auto;
    }
    .slim-2col-form {
        display: grid;
        grid-template-columns: unset;
        grid-template-rows: repeat(2, 1fr);
        gap: 20px;
    }
}

.form-preview-lang-switcher {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.form-preview-lang-link {
    border: 1px solid var(--slim-main-dark-trans);
    border-radius: var(--radius);
    padding: 0.3rem 0.9rem;
    font-size: 0.85rem;
    text-decoration: none;
    color: var(--slim-main-dark);
}

.form-preview-lang-link.active {
    background: var(--slim-standard-button);
    color: white;
    border-color: var(--slim-standard-button);
}
