/* Estilos para gestión de imágenes (pp_subimg) y visor (pp_imagenes) */

/* ===== GESTIÓN DE IMÁGENES (pp_subimg) ===== */
.pp-subimg-container {
    max-width: 100%;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.pp-subimg-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.pp-subimg-title {
    font-size: 28px;
    font-weight: bold;
    color: #333;
    margin: 0;
}

.pp-subimg-header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.pp-subimg-search {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    min-width: 200px;
}

.pp-subimg-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    min-width: 120px;
    text-align: center;
}

.pp-subimg-btn-primary {
    background-color: #2271b1;
    color: white;
}

.pp-subimg-btn-primary:hover {
    background-color: #135e96;
}

/* Cancelar: mismo diseño que Agregar Imagen pero en gris */
.pp-subimg-btn-cancel {
    background-color: #6c757d;
    color: white;
}

.pp-subimg-btn-cancel:hover {
    background-color: #5a6268;
    color: white;
}

.pp-subimg-btn-secondary {
    background-color: #f0f0f0;
    color: #333;
}

.pp-subimg-table-container {
    overflow-x: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.pp-subimg-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.pp-subimg-table thead {
    background-color: #f5f5f5;
}

.pp-subimg-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #ddd;
}

.pp-subimg-sort-icon {
    font-size: 10px;
    margin-left: 5px;
    color: #999;
}

.pp-subimg-table td {
    padding: 12px;
    border-bottom: 1px solid #eee;
}

.pp-subimg-table tbody tr:hover {
    background-color: #f9f9f9;
}

.pp-subimg-col-position {
    width: 100px;
}

.pp-subimg-position-column {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pp-subimg-drag-handle {
    cursor: move;
    color: #999;
    font-size: 18px;
}

.pp-subimg-drag-handle:hover {
    color: #2271b1;
}

.pp-subimg-order-number {
    font-weight: 600;
    color: #666;
    min-width: 25px;
    font-size: 13px;
}

.pp-subimg-table tbody tr.pp-subimg-dragging {
    opacity: 0.5;
}

.pp-subimg-table tbody tr.pp-subimg-sortable-placeholder {
    background: #f0f0f0;
    height: 40px;
    border: 2px dashed #ddd;
}

.pp-subimg-status-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.pp-subimg-status-dot.visible {
    background-color: #46b450;
}

.pp-subimg-status-dot.hidden {
    background-color: #dc3232;
}

.pp-subimg-titulo-content strong {
    display: block;
    margin-bottom: 4px;
    color: #333;
}

.pp-subimg-descripcion {
    font-size: 12px;
    color: #666;
    line-height: 1.4;
}

.pp-subimg-btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 5px;
}

.pp-subimg-empty {
    text-align: center;
    padding: 40px;
    color: #999;
}

/* Modal pp_subimg */
.pp-subimg-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

.pp-subimg-modal.active {
    display: flex;
}

.pp-subimg-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999998;
    pointer-events: auto;
}

.pp-subimg-modal-content {
    position: relative;
    background: #fff;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 999999;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    pointer-events: auto;
    isolation: isolate;
}

.pp-subimg-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    position: relative;
    z-index: 1;
}

.pp-subimg-modal-header h2,
.pp-subimg-modal-header h3 {
    margin: 0;
    font-size: 20px;
    color: #333;
}

.pp-subimg-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    line-height: 1;
}

.pp-subimg-modal-close:hover {
    color: #000;
}

#pp-subimg-form {
    padding: 20px;
    position: relative;
    z-index: 1;
}

.pp-subimg-form-group {
    margin-bottom: 20px;
}

.pp-subimg-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.pp-subimg-form-group input[type="text"],
.pp-subimg-form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
}

.pp-subimg-form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.pp-subimg-form-group input[type="file"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
}

.pp-subimg-file-upload-progress {
    margin-top: 10px;
}

.pp-subimg-progress-bar {
    width: 100%;
    height: 20px;
    background: #f0f0f0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 5px;
}

.pp-subimg-progress-fill {
    height: 100%;
    background: #2271b1;
    width: 0%;
    transition: width 0.3s ease;
}

.pp-subimg-progress-text {
    font-size: 12px;
    color: #666;
    display: block;
}

.pp-subimg-status-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pp-subimg-status-option {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
}

.pp-subimg-status-option:hover {
    background: #f9f9f9;
    border-color: #2271b1;
}

.pp-subimg-status-dot-option {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
    flex-shrink: 0;
}

.pp-subimg-status-dot-option.pp-subimg-status-active {
    background-color: #46b450;
}

.pp-subimg-status-dot-option.pp-subimg-status-inactive {
    background-color: #999;
}

.pp-subimg-status-text {
    font-size: 14px;
    color: #333;
    flex: 1;
}

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

.pp-subimg-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ===== VISOR DE IMÁGENES (pp_imagenes) ===== */
.pp-imagenes-visor-container {
    display: flex;
    width: 100%;
    height: calc(100vh - 100px);
    min-height: 600px;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.pp-imagenes-sidebar {
    width: 15%;
    background-color: #f5f5f5;
    border-right: 1px solid #ddd;
    overflow-y: auto;
}

.pp-imagenes-thumbnails {
    padding: 10px;
}

.pp-imagenes-thumbnail-item {
    margin-bottom: 15px;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 4px;
    padding: 8px;
    transition: all 0.3s ease;
    background: white;
}

.pp-imagenes-thumbnail-item:hover {
    border-color: #2271b1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.pp-imagenes-thumbnail-item.active {
    border-color: #2271b1;
    background-color: #e6f3ff;
}

.pp-imagenes-thumbnail-image {
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 4px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
}

.pp-imagenes-thumbnail-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.pp-imagenes-thumbnail-title {
    font-size: 11px;
    color: #333;
    text-align: center;
    line-height: 1.3;
    word-wrap: break-word;
}

.pp-imagenes-main {
    width: 85%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pp-imagenes-viewer {
    width: 100%;
    height: 100%;
    overflow: auto;
    background: #525252;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.pp-imagenes-viewer img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.pp-imagenes-empty,
.pp-imagenes-empty-main {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
    font-size: 16px;
}

@media (max-width: 768px) {
    .pp-subimg-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .pp-subimg-header-actions {
        width: 100%;
        flex-direction: column;
    }
    
    .pp-subimg-search {
        width: 100%;
    }
    
    .pp-imagenes-visor-container {
        flex-direction: column;
        height: auto;
    }
    
    .pp-imagenes-sidebar {
        width: 100%;
        max-height: 200px;
        border-right: none;
        border-bottom: 1px solid #ddd;
    }
    
    .pp-imagenes-thumbnails {
        display: flex;
        overflow-x: auto;
        gap: 10px;
    }
    
    .pp-imagenes-thumbnail-item {
        min-width: 120px;
        margin-bottom: 0;
    }
    
    .pp-imagenes-main {
        width: 100%;
        height: 600px;
    }
}
