/**
 * Estilos para el Plugin Mosaico Generator
 * Paleta de colores: #002E52 (azul oscuro), #85CCD5 (azul claro)
 */

.mosaico-generator-panel {
    max-width: 1200px;
    margin: 20px 0;
}

.mosaico-generator-panel h3 {
    color: #002E52;
    border-bottom: 2px solid #85CCD5;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

/* Estado del Mosaico */
.generator-status {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#mosaic-status p {
    margin: 10px 0;
    font-size: 14px;
}

#mosaic-status strong {
    color: #002E52;
}

/* Controles de Generación */
.generator-controls {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.generator-controls button {
    margin-right: 10px;
    margin-bottom: 10px;
}

#generate-mosaic-btn {
    background-color: #85CCD5 !important;
    border-color: #85CCD5 !important;
    color: #002E52 !important;
    font-weight: bold;
}

#generate-mosaic-btn:hover {
    background-color: #002E52 !important;
    border-color: #002E52 !important;
    color: white !important;
}

#regenerate-mosaic-btn {
    background-color: #f0f0f0;
    border-color: #ccc;
    color: #002E52;
}

#regenerate-mosaic-btn:hover {
    background-color: #85CCD5;
    border-color: #85CCD5;
    color: #002E52;
}

/* Configuración del Mosaico */
.generator-settings {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.generator-settings .form-table th {
    color: #002E52;
    font-weight: 600;
}

.generator-settings input[type="number"],
.generator-settings input[type="url"] {
    border: 1px solid #85CCD5;
    border-radius: 4px;
    padding: 8px 12px;
}

.generator-settings input[type="number"]:focus,
.generator-settings input[type="url"]:focus {
    border-color: #002E52;
    box-shadow: 0 0 0 2px rgba(133, 204, 213, 0.3);
    outline: none;
}

/* Log de Generación */
.generation-log {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#generation-log {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.4;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    height: 200px;
    overflow-y: auto;
}

.log-entry {
    margin-bottom: 5px;
    padding: 2px 0;
}

.log-entry.success {
    color: #28a745;
}

.log-entry.error {
    color: #dc3545;
}

.log-entry.warning {
    color: #ffc107;
}

.log-entry.info {
    color: #17a2b8;
}

.log-timestamp {
    color: #6c757d;
    font-size: 11px;
}

/* Estados de carga */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #85CCD5;
    border-top: 2px solid #002E52;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Progreso de generación */
.generation-progress {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 15px;
    margin: 15px 0;
    display: none;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background-color: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    margin: 10px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #85CCD5, #002E52);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 10px;
}

.progress-text {
    text-align: center;
    font-size: 14px;
    color: #002E52;
    margin-top: 5px;
}

/* Estadísticas del mosaico */
.mosaic-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.stat-card {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
}

.stat-number {
    font-size: 24px;
    font-weight: bold;
    color: #002E52;
    display: block;
}

.stat-label {
    font-size: 12px;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Notificaciones */
.mosaico-notification {
    padding: 12px 16px;
    border-radius: 4px;
    margin: 10px 0;
    font-size: 14px;
}

.mosaico-notification.success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.mosaico-notification.error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.mosaico-notification.warning {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
}

.mosaico-notification.info {
    background-color: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

/* Responsive */
@media (max-width: 768px) {
    .mosaico-generator-panel {
        margin: 10px 0;
    }
    
    .generator-controls button {
        width: 100%;
        margin-right: 0;
        margin-bottom: 10px;
    }
    
    .generator-settings .form-table th,
    .generator-settings .form-table td {
        display: block;
        width: 100%;
        padding: 10px 0;
    }
    
    .generator-settings input[type="number"],
    .generator-settings input[type="url"] {
        width: 100%;
        max-width: none;
    }
    
    .mosaic-stats {
        grid-template-columns: 1fr;
    }
}

/* Animaciones */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-down {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Estilos para Imagen de Referencia */
.reference-image-field {
    margin-bottom: 20px;
}

.reference-image-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.reference-image-controls button {
    padding: 8px 16px;
    border-radius: 4px;
    border: 1px solid #ddd;
    background: #f7f7f7;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
}

.reference-image-controls button:hover {
    background: #85CCD5;
    border-color: #85CCD5;
    color: #002E52;
}

.reference-image-controls button.remove-btn {
    background: #dc3545;
    border-color: #dc3545;
    color: white;
}

.reference-image-controls button.remove-btn:hover {
    background: #c82333;
    border-color: #bd2130;
}

#reference-image-preview {
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    background: #f9f9f9;
    margin-top: 15px;
    display: none;
}

.reference-image-preview {
    display: flex;
    align-items: center;
    gap: 15px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 15px;
}

.reference-image-preview img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.reference-image-preview .image-info {
    flex: 1;
}

.reference-image-preview .image-info strong {
    color: #002E52;
    display: block;
    margin-bottom: 5px;
}

.reference-image-preview .image-info small {
    color: #666;
}

.reference-image-description {
    font-style: italic;
    color: #666;
    margin-top: 10px;
    font-size: 13px;
    line-height: 1.4;
}

/* Configuración de repetición de imágenes */
.image-repetition-settings {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 15px;
}

.image-repetition-settings label {
    display: block;
    margin-bottom: 8px;
    cursor: pointer;
}

.image-repetition-settings input[type="radio"] {
    margin-right: 8px;
}

#custom-repetition-settings {
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 15px;
}

#custom-repetition-settings .widefat {
    margin-bottom: 10px;
}

#custom-repetition-settings th {
    background: #002E52;
    color: white;
    padding: 10px;
    text-align: left;
}

#custom-repetition-settings td {
    padding: 8px 10px;
    border-bottom: 1px solid #eee;
}

.repetition-image-preview {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.repetition-input {
    width: 80px;
    text-align: center;
}

.repetition-percentage {
    font-weight: bold;
    color: #002E52;
}

.repetition-total-info {
    background: #e7f3ff;
    border: 1px solid #85CCD5;
    border-radius: 4px;
    padding: 10px;
    margin-top: 10px;
    font-size: 13px;
}

.repetition-error {
    background: #ffe7e7;
    border: 1px solid #ff9999;
    color: #cc0000;
}

.repetition-success {
    background: #e7ffe7;
    border: 1px solid #99ff99;
    color: #006600;
}

/* Responsive para imagen de referencia */
@media (max-width: 768px) {
    .reference-image-controls {
        flex-direction: column;
    }
    
    .reference-image-controls button {
        width: 100%;
    }
    
    .reference-image-preview {
        flex-direction: column;
        text-align: center;
    }
    
    .reference-image-preview img {
        width: 120px;
        height: 120px;
    }
    
    #custom-repetition-settings .widefat th,
    #custom-repetition-settings .widefat td {
        font-size: 12px;
        padding: 6px;
    }
    
    .repetition-input {
        width: 60px;
    }
}

.pixel-rect {
    cursor: crosshair;
    box-sizing: border-box;
}