/**
 * Estilos para la interfaz de gestión en frontend del plugin WP 3D Virtual Tabletop
 */

/* Contenedor principal */
.wp-3d-tabletop-manager-container {
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    color: #444;
    line-height: 1.5;
}

/* Tabs */
.wp-3d-tabletop-tabs {
    background: #fff;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.wp-3d-tabletop-tab-links {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
}

.wp-3d-tabletop-tab-links li {
    margin: 0;
    padding: 0;
}

.wp-3d-tabletop-tab-links a {
    display: block;
    padding: 12px 20px;
    color: #666;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    border-bottom: 3px solid transparent;
}

.wp-3d-tabletop-tab-links a:hover {
    background: #eaeaea;
    color: #444;
}

.wp-3d-tabletop-tab-links a.active {
    background: #fff;
    color: #0073aa;
    border-bottom: 3px solid #0073aa;
}

/* Contenido de tabs */
.wp-3d-tabletop-tab-content {
    padding: 20px;
}

.wp-3d-tabletop-tab-pane {
    display: none;
}

.wp-3d-tabletop-tab-pane.active {
    display: block;
}

/* Encabezados */
.wp-3d-tabletop-tab-pane h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #23282d;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

/* Botones de acción */
.wp-3d-tabletop-actions {
    margin-bottom: 20px;
}

/* Listas de elementos */
.wp-3d-tabletop-list-container {
    margin-bottom: 30px;
    min-height: 150px;
    position: relative;
}

.wp-3d-tabletop-list-loading {
    padding: 30px;
    text-align: center;
    font-style: italic;
    color: #888;
}

.wp-3d-tabletop-miniatures-list,
.wp-3d-tabletop-obstacles-list,
.wp-3d-tabletop-maps-list,
.wp-3d-tabletop-scenes-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}

/* Tarjetas para cada elemento */
.wp-3d-tabletop-item {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    padding: 15px;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
}

.wp-3d-tabletop-item:hover {
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.wp-3d-tabletop-item-thumb {
    width: 100%;
    height: 150px;
    background-size: cover;
    background-position: center;
    background-color: #eee;
    margin-bottom: 10px;
    border-radius: 3px;
    position: relative;
    overflow: hidden;
}

/* AÑADIDO: Estilos específicos para thumbnails de obstáculos en la gestión */
.wp-3d-tabletop-obstacle .wp-3d-tabletop-item-thumb {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border: 1px solid #ddd;
    min-height: 150px;
}

/* AÑADIDO: Asegurar que se muestra "Sin imagen" cuando no hay thumbnail */
.wp-3d-tabletop-obstacle .wp-3d-tabletop-item-thumb:not([style*="background-image"])::before {
    content: "Sin imagen";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #888;
    font-style: italic;
    text-align: center;
}

.wp-3d-tabletop-item-info {
    flex: 1;
}

.wp-3d-tabletop-item-title {
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 5px;
}

.wp-3d-tabletop-item-description {
    color: #666;
    font-size: 14px;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wp-3d-tabletop-item-actions {
    display: flex;
    justify-content: flex-end;
    gap: 5px;
    margin-top: 10px;
}

/* Formularios */
.wp-3d-tabletop-form-container {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 20px;
    margin-bottom: 20px;
}

.wp-3d-tabletop-form-container h3 {
    margin-top: 0;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.form-field {
    margin-bottom: 20px;
}

.form-field label {
    display: block;
    font-weight: 500;
    margin-bottom: 5px;
}

.form-field input[type="text"],
.form-field input[type="number"],
.form-field select,
.form-field textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.form-field .description {
    font-size: 13px;
    color: #666;
    margin-top: 5px;
}

.scale-inputs {
    display: flex;
    gap: 10px;
}

.scale-inputs label {
    flex: 1;
    font-weight: normal;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

/* Vista previa de imágenes */
.image-preview,
.texture-preview {
    width: 200px;
    height: 150px;
    background-color: #f0f0f0;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    margin-bottom: 10px;
    border: 1px dashed #ccc;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
}

.image-preview:empty::before,
.texture-preview:empty::before {
    content: "Sin imagen";
    font-style: italic;
}

/* Vista previa de escena */
.wp-3d-tabletop-scene-preview {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 20px;
    margin-top: 20px;
}

.scene-preview-container {
    min-height: 400px;
    background: #f5f5f5;
    margin-bottom: 20px;
    border-radius: 5px;
    overflow: hidden;
}

.shortcode-container {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.shortcode-display {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 5px;
}

.scene-shortcode {
    flex: 1;
    padding: 8px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: monospace;
}

/* Asignación de usuarios Adalid */
.adalid-assignment-item {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 10px;
}

.assignment-fields {
    display: flex;
    gap: 10px;
    align-items: center;
}

.assignment-fields select {
    flex: 1;
}

.remove-assignment {
    background: #f0f0f0;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.remove-assignment:hover {
    background: #e0e0e0;
}

.adalid-assignments-list {
    margin-bottom: 10px;
}

.no-adalids-message {
    font-style: italic;
    color: #888;
    padding: 10px;
}

/* Vista de Adalid */
.wp-3d-tabletop-adalid-view {
    background: #fff;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 20px;
}

.wp-3d-tabletop-scene-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.wp-3d-tabletop-scene-item {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    padding: 15px;
    transition: all 0.2s ease;
}

.wp-3d-tabletop-scene-item:hover {
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

.wp-3d-tabletop-scene-actions {
    margin-top: 15px;
}

.wp-3d-tabletop-scene-view {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.wp-3d-tabletop-assigned-miniature {
    background: #f9f9f9;
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    border-left: 3px solid #0073aa;
}

/* Mensajes de error */
.wp-3d-tabletop-error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    border: 1px solid #f5c6cb;
}

/* Mensajes de éxito */
.wp-3d-tabletop-success-message {
    background: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    border: 1px solid #c3e6cb;
}

/* Estilos responsivos */
@media (max-width: 768px) {
    .wp-3d-tabletop-tab-links {
        flex-direction: column;
    }
    
    .wp-3d-tabletop-tab-links a {
        border-bottom: none;
        border-left: 3px solid transparent;
    }
    
    .wp-3d-tabletop-tab-links a.active {
        border-bottom: none;
        border-left: 3px solid #0073aa;
    }
    
    .scale-inputs {
        flex-direction: column;
        gap: 10px;
    }
    
    .assignment-fields {
        flex-direction: column;
    }
    
    .wp-3d-tabletop-miniatures-list,
    .wp-3d-tabletop-obstacles-list,
    .wp-3d-tabletop-maps-list,
    .wp-3d-tabletop-scenes-list,
    .wp-3d-tabletop-scene-list {
        grid-template-columns: 1fr;
    }
}

/* Estilos para la tabla de asignaciones */
.wp-3d-assignments-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
}

.wp-3d-assignments-table th,
.wp-3d-assignments-table td {
    padding: 8px;
    border: 1px solid #ddd;
    text-align: left;
}

.wp-3d-assignments-table th {
    background-color: #f2f2f2;
    font-weight: bold;
}

.wp-3d-assignments-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.wp-3d-assignments-table tr:hover {
    background-color: #f0f0f0;
}

.wp-3d-assignments-table .remove-assignment {
    background-color: #d9534f;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
}

.wp-3d-assignments-table .remove-assignment:hover {
    background-color: #c9302c;
}

/* Estilos para notificaciones */
.notice {
    padding: 10px;
    margin: 10px 0;
    border-radius: 4px;
}

.notice-info {
    background-color: #d9edf7;
    border-left: 4px solid #31708f;
    color: #31708f;
}

.notice-success {
    background-color: #dff0d8;
    border-left: 4px solid #3c763d;
    color: #3c763d;
}

.notice-error {
    background-color: #f2dede;
    border-left: 4px solid #a94442;
    color: #a94442;
}

/* Estilos mejorados específicos para acciones de escenas - Versión compacta */
.wp-3d-tabletop-scene .wp-3d-tabletop-item-actions {
    display: flex;
    flex-wrap: nowrap; /* Cambiado a nowrap para mantener en una línea */
    justify-content: space-between; /* Distribuir uniformemente */
    gap: 3px; /* Reducir espacio entre botones */
    margin-top: 10px;
    width: 100%; /* Asegurar que ocupe todo el ancho disponible */
}

.wp-3d-tabletop-scene .wp-3d-tabletop-item-actions .button {
    padding: 3px 6px; /* Reducir padding */
    font-size: 11px; /* Reducir fuente */
    line-height: 1.1; /* Reducir altura de línea */
    min-height: auto;
    border-radius: 3px;
    flex: 1; /* Cada botón ocupa el mismo espacio */
    white-space: nowrap;
    text-decoration: none;
    display: inline-block;
    box-sizing: border-box;
    text-align: center; /* Centrar texto */
    min-width: 0; /* Permitir que se reduzcan */
}

/* Estilos específicos para cada tipo de botón con colores más sutiles */
.wp-3d-tabletop-scene .wp-3d-tabletop-item-preview {
    background-color: #0073aa;
    color: white;
    border: 1px solid #005177;
}

.wp-3d-tabletop-scene .wp-3d-tabletop-item-preview:hover {
    background-color: #005177;
    border-color: #003c5c;
}

.wp-3d-tabletop-scene .wp-3d-tabletop-item-edit {
    background-color: #00a0d2;
    color: white;
    border: 1px solid #0087be;
}

.wp-3d-tabletop-scene .wp-3d-tabletop-item-edit:hover {
    background-color: #0087be;
    border-color: #006c96;
}

.wp-3d-tabletop-scene .wp-3d-tabletop-item-delete {
    background-color: #dc3232;
    color: white;
    border: 1px solid #b32d2e;
}

.wp-3d-tabletop-scene .wp-3d-tabletop-item-delete:hover {
    background-color: #b32d2e;
    border-color: #8e2424;
}

/* Ajuste específico para mantener botones en línea en pantallas pequeñas */
@media (max-width: 768px) {
    .wp-3d-tabletop-scene .wp-3d-tabletop-item-actions {
        flex-wrap: nowrap; /* Mantener en línea incluso en móvil */
        gap: 2px; /* Reducir aún más el espacio en móvil */
    }
    
    .wp-3d-tabletop-scene .wp-3d-tabletop-item-actions .button {
        padding: 2px 4px; /* Padding aún más pequeño en móvil */
        font-size: 10px; /* Fuente más pequeña en móvil */
    }
}

/* Asegurar que el contenedor de la escena tenga suficiente espacio */
.wp-3d-tabletop-scene {
    min-width: 250px; /* Ancho mínimo para acomodar botones */
}

/* Asegurar que los botones de acción tienen el ancho adecuado */
.wp-3d-tabletop-scene .wp-3d-tabletop-item-actions .button {
    min-width: 60px; /* Ancho mínimo para acomodar "Ver" */
    text-align: center;
    padding: 4px 8px;
}

/* Estilos mejorados para los campos de GLTF */
.form-fields-gltf,
.form-fields-gltf-obstacle {
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: 5px;
    margin-bottom: 15px;
    display: block !important; /* Forzar visualización */
}

.input-group {
    display: flex;
    margin-bottom: 8px;
    gap: 5px;
}

.input-group input {
    flex-grow: 1;
}

.selected-model-info {
    background-color: #eaf6fd;
    padding: 10px;
    border-radius: 4px;
    border-left: 3px solid #2271b1;
}

.image-preview, 
.texture-preview {
    width: 150px;
    height: 150px;
    background-size: cover;
    background-position: center;
    background-color: #f0f0f0;
    border: 1px dashed #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}

.manual-entry-form {
    background-color: #f8f8f8;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin: 10px 0;
}

/* Asegurar que los campos sean siempre visibles cuando deben estarlo */
#miniature_type[value="gltf"] ~ .form-fields-gltf,
#obstacle_type[value="gltf"] ~ .form-fields-gltf-obstacle {
    display: block !important;
}

/* Estilos críticos para la visibilidad de los campos */
.form-fields-gltf,
.form-fields-gltf-obstacle {
    display: block !important;
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: 5px;
    margin-bottom: 15px;
}

/* Forzar la visualización en todos los casos */
#miniature_type option[value="gltf"],
#obstacle_type option[value="gltf"] {
    display: block !important;
}

/* Estilos básicos para inputs */
.image-preview {
    width: 150px;
    height: 150px;
    background-size: cover;
    background-position: center;
    background-color: #f0f0f0;
    border: 1px dashed #ccc;
    margin-bottom: 10px;
}

/* Estilos críticos para asegurar que los campos GLTF sean visibles */
.form-fields-gltf,
.form-fields-gltf-obstacle {
    display: block !important;
    background-color: #f9f9f9;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

/* Estilos para previsualización de imágenes */
.image-preview, 
.texture-preview {
    width: 150px;
    height: 150px;
    background-color: #f0f0f0;
    background-position: center;
    background-size: cover;
    border: 1px dashed #ccc;
    margin-bottom: 8px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Información de modelo seleccionado */
.selected-model-info {
    background-color: #e6f6ff;
    border-left: 3px solid #0073aa;
    padding: 8px 12px;
    margin-top: 8px;
}

/* Estilos para previsualización de imágenes */
.image-preview, 
.texture-preview {
    width: 150px;
    height: 150px;
    background-color: #f0f0f0;
    background-position: center;
    background-size: cover;
    border: 1px dashed #ccc;
    margin-bottom: 8px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Texto "Sin imagen" que aparece solo cuando no hay imagen */
.image-preview::before,
.texture-preview::before {
    content: "Sin imagen";
    position: absolute;
    color: #888;
    font-style: italic;
    z-index: 1;
}

/* Ocultar el texto "Sin imagen" cuando hay una imagen de fondo */
.image-preview[style*="background-image"]::before,
.texture-preview[style*="background-image"]::before {
    display: none;
}

