/**
 * Omni Image Optimizer - Mobile Blur Preview Styles
 * CSS for adaptive image loading functionality
 */

/* Blur container styles */
.omni-blur-container {
    position: relative;
    display: inline-block;
    overflow: visible;
    margin-bottom: 10px;
}

/* Blur overlay styles */
.omni-blur-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
    cursor: pointer;
    z-index: 1;
}

.omni-blur-overlay:hover {
    background: rgba(0, 0, 0, 0.5);
}

/* Text styles in overlay */
.omni-blur-text,
.omni-blur-loading,
.omni-blur-error {
    color: white;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 4px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    max-width: 80%;
    line-height: 1.4;
}

/* Loading state */
.omni-blur-loading {
    background: rgba(0, 123, 255, 0.8);
}

.omni-blur-loading::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-left: 8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: omni-spin 1s linear infinite;
}

/* Error state */
.omni-blur-error {
    background: rgba(220, 53, 69, 0.8);
}

/* Spin animation for loading indicator */
@keyframes omni-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Image styles */
.omni-mobile-blur {
    transition: opacity 0.3s ease, filter 0.3s ease;
    cursor: pointer;
}

/* Desktop mode - no blur effects */
body:not(.omni-mobile-mode) .omni-mobile-blur {
    cursor: default;
}

body:not(.omni-mobile-mode) .omni-blur-overlay {
    display: none;
}

/* Mobile mode specific styles */
body.omni-mobile-mode .omni-mobile-blur:not(.omni-full-loaded) {
    filter: blur(3px);
}

/* Always apply blur to mobile blur images initially */
.omni-mobile-blur:not(.omni-full-loaded) {
    filter: blur(2px);
}

/* Full image loaded state */
.omni-mobile-blur.omni-full-loaded {
    cursor: default;
}

/* Animation when full image loads */
.omni-mobile-blur.omni-loaded-animation {
    animation: omni-image-reveal 0.5s ease-out;
}

@keyframes omni-image-reveal {
    from {
        opacity: 0.8;
        transform: scale(1.02);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .omni-blur-text,
    .omni-blur-loading,
    .omni-blur-error {
        font-size: 12px;
        padding: 6px 10px;
    }
    
    /* Smaller overlay for small images */
    .omni-blur-container img[width] {
        max-width: 100%;
        height: auto;
    }
}

@media (max-width: 480px) {
    .omni-blur-text,
    .omni-blur-loading,
    .omni-blur-error {
        font-size: 11px;
        padding: 4px 8px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .omni-blur-overlay:hover {
        background: rgba(0, 0, 0, 0.4);
    }
    
    .omni-blur-overlay:active {
        background: rgba(0, 0, 0, 0.6);
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .omni-blur-text,
    .omni-blur-loading,
    .omni-blur-error {
        font-weight: 400;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .omni-blur-overlay {
        background: rgba(255, 255, 255, 0.2);
    }
    
    .omni-blur-overlay:hover {
        background: rgba(255, 255, 255, 0.3);
    }
    
    .omni-blur-text {
        background: rgba(255, 255, 255, 0.9);
        color: #333;
        text-shadow: none;
    }
}

/* Accessibility improvements */
.omni-blur-overlay:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .omni-blur-overlay,
    .omni-mobile-blur,
    .omni-mobile-blur.omni-loaded-animation {
        transition: none;
        animation: none;
    }
    
    .omni-blur-loading::after {
        animation: none;
        border: 2px solid white;
    }
}

/* Image description styles */
.omni-image-description {
    font-size: 14px;
    line-height: 1.4;
    color: #333;
    margin-top: 8px;
    padding: 5px 8px;
    background-color: #f5f5f5;
    border-radius: 4px;
    text-align: center;
    max-width: 100%;
    word-wrap: break-word;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Dark mode support for description */
@media (prefers-color-scheme: dark) {
    .omni-image-description {
        background-color: #333;
        color: #f5f5f5;
        box-shadow: 0 1px 3px rgba(255,255,255,0.1);
    }
}

/* Responsive adjustments for description */
@media (max-width: 768px) {
    .omni-image-description {
        font-size: 13px;
        padding: 4px 6px;
    }
}

@media (max-width: 480px) {
    .omni-image-description {
        font-size: 12px;
        padding: 3px 5px;
    }
}

/* Print styles */
@media print {
    .omni-blur-overlay {
        display: none;
    }
    
    .omni-mobile-blur {
        filter: none !important;
    }
}
