/**
 * Explor Image Editor CSS - Clean Version
 * Version: 6.2.0 - Integrated with Edit Mode (Dark Mode Removed)
 * 
 * Štýly pre inline image editing v rámci floating button systému
 * Kompatibilné s existujúcim edit-mode.css
 */

/* ========================================
   IMAGE EDITABLE ELEMENTS
   Integrácia s edit mode - označenie editovateľných obrázkov
   ======================================== */

/* Základné označenie editovateľných obrázkov */
[data-explor-editable][data-explor-type="image"] {
    position: relative;
    display: inline-block;
    cursor: default;
    transition: all 0.3s ease;
}

/* V edit mode - obrázky sú interaktívne */
body.explor-edit-mode [data-explor-editable][data-explor-type="image"] {
    cursor: pointer !important;
    outline: 2px dashed #764ba2 !important;
    outline-offset: 3px !important;
}

body.explor-edit-mode [data-explor-editable][data-explor-type="image"]:hover {
    outline: 3px solid #764ba2 !important;
    outline-offset: 4px !important;
    filter: brightness(1.05);
    transform: scale(1.02);
}

/* Hover tooltip - konzistentné s textovým editorom */
body.explor-edit-mode [data-explor-editable][data-explor-type="image"]::before {
    content: "🖼️ Kliknite pre úpravu obrázka";
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    z-index: 100000;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

/* Arrow pre tooltip */
body.explor-edit-mode [data-explor-editable][data-explor-type="image"]::after {
    content: "";
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid #764ba2;
    z-index: 100000;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

/* Zobraziť tooltip pri hover */
body.explor-edit-mode [data-explor-editable][data-explor-type="image"]:hover::before,
body.explor-edit-mode [data-explor-editable][data-explor-type="image"]:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Obrázky so zmenami - žltý outline */
body.explor-edit-mode [data-explor-editable][data-explor-type="image"].has-changes {
    outline-color: #ffb800 !important;
    box-shadow: 0 0 15px rgba(255, 184, 0, 0.3);
}

/* Indikátor zmien - červená bodka */
body.explor-edit-mode [data-explor-editable][data-explor-type="image"].has-changes::before {
    content: "•";
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ef4444;
    color: white;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
    z-index: 1000;
    opacity: 1;
    visibility: visible;
}

/* ========================================
   QUICK EDIT OVERLAY
   Jednoduchý inline editor namiesto modalu
   ======================================== */

.explor-image-quick-edit {
    position: absolute;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    background: white !important;
    color: #1d2327 !important;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 8px;
    z-index: 100001;
    animation: slideUpFadeIn 0.3s ease;
    min-width: 280px;
    border: 1px solid #e8e8e8;
}

@keyframes slideUpFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Quick edit buttons */
.explor-image-quick-edit button {
    padding: 8px 14px;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    flex: 1;
    justify-content: center;
}

.explor-image-quick-edit button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.explor-image-quick-edit button:active {
    transform: translateY(0);
}

/* Sekundárne tlačidlo */
.explor-image-quick-edit button.secondary {
    background: #f8f9fa !important;
    color: #333 !important;
    border: 1px solid #dee2e6;
}

.explor-image-quick-edit button.secondary:hover {
    background: #e8e8e8 !important;
}

/* Close button */
.explor-image-quick-edit .close-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    padding: 0;
    background: #ef4444;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    min-width: auto;
    flex: none;
}

.explor-image-quick-edit .close-btn:hover {
    background: #dc2626;
}

/* ========================================
   INLINE IMAGE PROPERTIES PANEL
   Panel pre rýchle úpravy vlastností
   ======================================== */

.explor-image-properties {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: white !important;
    color: #1d2327 !important;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    width: 320px;
    max-width: 90vw;
    z-index: 100002;
    animation: fadeIn 0.2s ease;
    border: 1px solid #e8e8e8;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Alt text input */
.explor-image-alt-wrapper {
    margin-bottom: 12px;
}

.explor-image-alt-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    margin-bottom: 4px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.explor-image-alt-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: white !important;
    color: #1d2327 !important;
}

.explor-image-alt-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Image info display */
.explor-image-info {
    background: #f8f9fa !important;
    color: #666 !important;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 12px;
    font-size: 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.explor-image-info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.explor-image-info-row:last-child {
    margin-bottom: 0;
}

.explor-image-info-label {
    font-weight: 600;
    color: #333 !important;
}

.explor-image-info-value {
    color: #666 !important;
}

/* Action buttons v properties paneli */
.explor-image-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.explor-image-actions button {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.explor-image-actions .save-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.explor-image-actions .save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.explor-image-actions .cancel-btn {
    background: #f5f5f5 !important;
    color: #666 !important;
    border: 1px solid #dee2e6;
}

.explor-image-actions .cancel-btn:hover {
    background: #e8e8e8 !important;
}

/* ========================================
   MINI IMAGE PREVIEW
   Pri nahrávaní alebo výmene obrázka
   ======================================== */

.explor-image-preview-mini {
    position: fixed;
    bottom: 120px;
    right: 30px;
    background: white !important;
    color: #1d2327 !important;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    width: 200px;
    z-index: 99997;
    animation: slideInRight 0.3s ease;
    border: 1px solid #e8e8e8;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.explor-image-preview-mini img {
    width: 100%;
    height: auto;
    border-radius: 4px;
    margin-bottom: 8px;
}

.explor-image-preview-mini .preview-actions {
    display: flex;
    gap: 6px;
}

.explor-image-preview-mini button {
    flex: 1;
    padding: 6px;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    background: #f8f9fa !important;
    color: #333 !important;
    border: 1px solid #dee2e6;
}

.explor-image-preview-mini button:hover {
    background: #e8e8e8 !important;
}

/* ========================================
   IMAGE UPLOAD PROGRESS
   Pri nahrávaní súborov
   ======================================== */

.explor-image-upload-progress {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: white !important;
    color: #1d2327 !important;
    border-radius: 50px;
    padding: 12px 24px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 100003;
    min-width: 200px;
    border: 1px solid #e8e8e8;
}

.explor-upload-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.explor-upload-text {
    font-size: 14px;
    color: #333 !important;
    font-weight: 500;
}

.explor-upload-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 0 0 50px 50px;
    transition: width 0.3s ease;
}

/* ========================================
   SAVED ANIMATION
   Animácia po uložení
   ======================================== */

[data-explor-editable][data-explor-type="image"].saved {
    animation: imageSavedPulse 0.6s ease;
}

@keyframes imageSavedPulse {
    0% { 
        outline-color: #764ba2; 
        transform: scale(1);
    }
    50% { 
        outline-color: #10b981; 
        outline-width: 4px;
        transform: scale(1.05);
        filter: brightness(1.1);
    }
    100% { 
        outline-color: #764ba2;
        transform: scale(1);
    }
}

/* ========================================
   INTEGRATION WITH EDIT PANEL
   Rozšírenie floating panelu o image tools
   ======================================== */

#explorImageTools {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e8e8e8;
}

.explor-image-stats {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    color: white;
    padding: 10px;
    border-radius: 6px;
    margin: 10px 0;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
}

.explor-image-tool-btn {
    display: block;
    width: 100%;
    padding: 10px;
    margin: 6px 0;
    background: #f8f9fa !important;
    color: #1d2327 !important;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    font-size: 14px;
    font-weight: 500;
}

.explor-image-tool-btn:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%) !important;
    color: white !important;
    transform: translateX(5px);
}

/* ========================================
   FORCE LIGHT MODE FOR ADMIN
   Vynútenie svetlého režimu v admin prostredí
   ======================================== */

/* Admin stránky - vynútenie svetlého pozadia */
.wp-admin .explor-image-quick-edit,
.wp-admin .explor-image-properties,
.wp-admin .explor-image-preview-mini,
.wp-admin .explor-image-upload-progress {
    background: white !important;
    color: #1d2327 !important;
    border-color: #e8e8e8 !important;
}

.wp-admin .explor-image-quick-edit button.secondary,
.wp-admin .explor-image-actions .cancel-btn,
.wp-admin .explor-image-tool-btn {
    background: #f8f9fa !important;
    color: #333 !important;
    border-color: #dee2e6 !important;
}

.wp-admin .explor-image-alt-input {
    background: white !important;
    color: #1d2327 !important;
    border-color: #dee2e6 !important;
}

.wp-admin .explor-image-info {
    background: #f8f9fa !important;
    color: #666 !important;
}

.wp-admin .explor-image-info-label {
    color: #333 !important;
}

.wp-admin .explor-image-info-value {
    color: #666 !important;
}

.wp-admin .explor-upload-text {
    color: #333 !important;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .explor-image-quick-edit {
        min-width: 240px;
        flex-direction: column;
    }
    
    .explor-image-quick-edit button {
        width: 100%;
    }
    
    .explor-image-properties {
        width: 280px;
    }
    
    body.explor-edit-mode [data-explor-editable][data-explor-type="image"]::before {
        font-size: 11px;
        padding: 4px 8px;
    }
}

@media (max-width: 480px) {
    .explor-image-quick-edit {
        bottom: -80px;
    }
    
    .explor-image-preview-mini {
        right: 10px;
        width: 160px;
    }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    body.explor-edit-mode [data-explor-editable][data-explor-type="image"] {
        outline-width: 3px !important;
    }
    
    .explor-image-quick-edit {
        border: 2px solid black;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .explor-image-quick-edit,
    .explor-image-properties,
    .explor-image-preview-mini,
    .explor-image-upload-progress,
    [data-explor-editable]::before,
    [data-explor-editable]::after {
        display: none !important;
    }
    
    [data-explor-editable][data-explor-type="image"] {
        outline: none !important;
        filter: none !important;
    }
}