/* Watermark Protection Styles */

/* Base protection for all property images */
.property-image,
.property-gallery img,
.wp-post-image,
.attachment-full,
.watermark-protected {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
    -webkit-user-drag: none !important;
    -khtml-user-drag: none !important;
    -moz-user-drag: none !important;
    -o-user-drag: none !important;
    user-drag: none !important;
    -webkit-touch-callout: none !important;
    pointer-events: auto;
    cursor: default;
    transition: filter 0.3s ease, transform 0.3s ease;
}

/* Screenshot protection active state - only affects images */
.screenshot-protection-active {
    filter: blur(2px) contrast(1.2) brightness(1.1) !important;
    transform: scale(1.01) !important;
    animation: protectionPulse 0.5s ease-in-out infinite alternate !important;
}

@keyframes protectionPulse {
    0% {
        filter: blur(2px) contrast(1.2) brightness(1.1) saturate(1.2);
    }
    100% {
        filter: blur(3px) contrast(1.3) brightness(1.2) saturate(1.3);
    }
}

/* Container for watermarked images */
.watermark-container {
    position: relative;
    display: inline-block;
    overflow: hidden;
    background-color: #f8f9fa;
}

/* Invisible overlay to prevent interactions */
.watermark-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    z-index: 10;
    cursor: not-allowed;
}

.watermark-overlay:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Visible watermark text overlay */
.watermark-text-overlay {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: #ffffff;
    padding: 4px 8px;
    font-size: 11px;
    font-family: Arial, Helvetica, sans-serif;
    border-radius: 3px;
    pointer-events: none;
    z-index: 15;
    opacity: 0.8;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-shadow: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Alternative positions for watermark text */
.watermark-text-overlay.top-left {
    top: 10px;
    left: 10px;
    bottom: auto;
    right: auto;
}

.watermark-text-overlay.top-right {
    top: 10px;
    right: 10px;
    bottom: auto;
    left: auto;
}

.watermark-text-overlay.bottom-left {
    bottom: 10px;
    left: 10px;
    top: auto;
    right: auto;
}

.watermark-text-overlay.center {
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 16px;
    font-size: 14px;
}

/* Warning popup styles - removed for subtle experience */

/* Download button protection */
.download-property-image,
.property-download-btn {
    position: relative;
    overflow: hidden;
}

.download-property-image:disabled,
.property-download-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Gallery protection */
.property-gallery {
    position: relative;
}

.property-gallery::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.02) 50%, transparent 70%);
    pointer-events: none;
    z-index: 1;
}

.property-gallery img {
    position: relative;
    z-index: 2;
}

/* Print protection */
@media print {
    .property-image,
    .property-gallery img,
    .wp-post-image,
    .attachment-full,
    .watermark-protected {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
    }
    
    .watermark-container::after {
        content: "🔒 Property image protected from printing";
        display: block !important;
        text-align: center;
        padding: 40px 20px;
        background: #f8f9fa;
        border: 2px solid #dee2e6;
        border-radius: 5px;
        font-family: Arial, sans-serif;
        font-size: 14px;
        color: #6c757d;
        margin: 10px 0;
    }
    
    .property-gallery::after {
        content: "🔒 Property gallery protected from printing";
        display: block !important;
        text-align: center;
        padding: 60px 20px;
        background: #f8f9fa;
        border: 2px solid #dee2e6;
        border-radius: 5px;
        font-family: Arial, sans-serif;
        font-size: 16px;
        color: #6c757d;
        margin: 20px 0;
    }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .watermark-warning-popup {
        max-width: 300px !important;
        min-width: 250px !important;
        padding: 15px 20px !important;
        font-size: 13px !important;
        margin: 0 20px !important;
        left: 20px !important;
        right: 20px !important;
        transform: translateY(-50%) !important;
        width: calc(100% - 40px) !important;
    }
    
    .watermark-text-overlay {
        font-size: 10px;
        padding: 3px 6px;
    }
    
    .watermark-text-overlay.center {
        font-size: 12px;
        padding: 6px 12px;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .watermark-text-overlay {
        font-size: 10px;
    }
    
    .watermark-warning-popup {
        border-width: 1px !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .watermark-container {
        background-color: #2c3e50;
    }
    
    .watermark-text-overlay {
        background: rgba(255, 255, 255, 0.8);
        color: #000000;
    }
}

/* Accessibility */
.watermark-protected:focus,
.watermark-container:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .watermark-warning-popup {
        animation: none !important;
    }
    
    .watermark-warning-popup:hover {
        transform: translate(-50%, -50%) !important;
    }
}

/* Additional security styles */
.property-image,
.property-gallery img,
.wp-post-image,
.watermark-protected {
    /* Prevent highlighting */
    -webkit-tap-highlight-color: transparent;
    -webkit-highlight-color: transparent;
    
    /* Prevent text selection cursor */
    cursor: default !important;
    
    /* Additional touch protection */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Prevent saving via right-click context menu alternatives */
.watermark-protected[contextmenu],
.property-image[contextmenu],
.property-gallery img[contextmenu] {
    pointer-events: none !important;
}

/* Hide from screen readers when appropriate */
.watermark-overlay {
    speak: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Ensure watermarks don't interfere with legitimate interactions */
.watermark-text-overlay,
.watermark-overlay {
    pointer-events: none;
}

/* Style for legitimate download buttons */
.legitimate-download-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background-color 0.2s;
}

.legitimate-download-btn:hover {
    background: #218838;
}

.legitimate-download-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

/* Intensive watermark overlay styles - only for images */
.intensive-watermark-overlay {
    pointer-events: none !important;
    z-index: 9999 !important;
    animation: intensiveWatermarkFade 0.3s ease-in !important;
}

.intensive-watermark-text {
    user-select: none !important;
    pointer-events: none !important;
    font-family: Arial, Helvetica, sans-serif !important;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8) !important;
    animation: watermarkRotate 2s linear infinite !important;
}

.watermark-stripe {
    pointer-events: none !important;
    user-select: none !important;
}

@keyframes intensiveWatermarkFade {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

@keyframes watermarkRotate {
    0% {
        transform: rotate(-45deg);
    }
    25% {
        transform: rotate(-40deg);
    }
    50% {
        transform: rotate(-45deg);
    }
    75% {
        transform: rotate(-50deg);
    }
    100% {
        transform: rotate(-45deg);
    }
}

/* Enhanced protection during screenshot attempts - only on images */
.screenshot-protection-active .watermark-container {
    position: relative !important;
    overflow: hidden !important;
}

.screenshot-protection-active .watermark-container::before {
    content: '';
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: repeating-linear-gradient(
        -45deg,
        rgba(255, 255, 255, 0.1) 0px,
        rgba(255, 255, 255, 0.1) 10px,
        transparent 10px,
        transparent 20px
    ) !important;
    z-index: 8000 !important;
    pointer-events: none !important;
    animation: protectionStripes 0.5s linear infinite !important;
}

@keyframes protectionStripes {
    0% {
        background-position: 0px 0px;
    }
    100% {
        background-position: 20px 20px;
    }
}

/* Canvas protection styles - enhanced for screenshots */
.canvas-protection-active {
    transition: filter 0.2s ease !important;
    filter: contrast(1.1) saturate(1.1) !important;
}

/* High contrast mode support - simplified */
@media (prefers-contrast: high) {
    .watermark-text-overlay {
        background: rgba(0, 0, 0, 0.9) !important;
        color: rgba(255, 255, 255, 1) !important;
    }
}