/* Before After Elementor Frontend Styles */

.before-after-widget {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
}

.before-after-title {
    text-align: center;
    margin-bottom: 20px;
    font-size: clamp(18px, 4vw, 24px);
    font-weight: bold;
}

.before-after-container {
    position: relative !important;
    width: 100% !important;
    height: 0 !important;
    padding-bottom: 56.25% !important; /* 16:9 aspect ratio */
    max-width: 100%;
    overflow: hidden !important;
    border-radius: clamp(4px, 1vw, 8px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: col-resize;
    user-select: none;
    display: block !important;
    touch-action: none;
}

.before-after-slider {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.image-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.before-image {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    display: block !important;
    z-index: 1 !important;
}

.after-image {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    display: block !important;
    z-index: 2 !important;
    /* After image on top, will be clipped by JavaScript */
}

.after-image-container {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
    /* Full container size - clipping handled by JavaScript */
}

.slider-line {
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 100%;
    background-color: #ffffff;
    transform: translateX(-50%);
    z-index: 10;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

.slider-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: clamp(35px, 8vw, 44px);
    height: clamp(35px, 8vw, 44px);
    background-color: #ffffff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    cursor: col-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
    z-index: 20;
}

.slider-handle:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

.slider-handle:active {
    transform: translate(-50%, -50%) scale(0.95);
}

.slider-left-arrow,
.slider-right-arrow {
    width: 0;
    height: 0;
    margin: 0 2px;
}

.slider-left-arrow {
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-right: 8px solid #333;
}

.slider-right-arrow {
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-left: 8px solid #333;
}

.before-label,
.after-label {
    position: absolute;
    top: clamp(10px, 3vw, 20px);
    padding: clamp(6px, 1.5vw, 8px) clamp(12px, 3vw, 16px);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: clamp(11px, 2.5vw, 14px);
    font-weight: 600;
    border-radius: clamp(3px, 0.8vw, 4px);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 5;
    transition: opacity 0.3s ease-in-out;
}

.before-label {
    left: clamp(10px, 3vw, 20px);
}

.after-label {
    right: clamp(10px, 3vw, 20px);
}

/* Gallery styles for multiple comparisons */
.before-after-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin: 20px 0;
}

.before-after-item {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.comparison-title,
.before-after-title {
    margin-bottom: 15px;
    font-size: 20px;
    font-weight: 600;
    color: #333;
    line-height: 1.4;
    display: block;
}

.before-after-title {
    margin-bottom: 20px;
    font-size: 24px;
}

.comparison-description {
    margin-top: 15px;
    color: #666;
    line-height: 1.6;
}

/* Social Sharing Styles */
.social-sharing-buttons {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 15px 0;
    flex-wrap: wrap;
}

.sharing-label {
    font-weight: 600;
    color: #666;
    font-size: 14px;
    margin-right: 8px;
}

.social-share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    text-decoration: none;
    transition: all 0.3s ease;
    color: #ffffff;
    position: relative;
    overflow: hidden;
}

.social-share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.social-share-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Platform-specific colors */
.social-facebook { background-color: #1877f2; }
.social-twitter { background-color: #1da1f2; }
.social-linkedin { background-color: #0077b5; }
.social-pinterest { background-color: #bd081c; }
.social-whatsapp { background-color: #25d366; }
.social-instagram { background-color: #e4405f; }
.social-email { background-color: #666666; }

.social-facebook:hover { background-color: #166fe5; }
.social-twitter:hover { background-color: #1a91da; }
.social-linkedin:hover { background-color: #006397; }
.social-pinterest:hover { background-color: #a0071a; }
.social-whatsapp:hover { background-color: #22c35e; }
.social-instagram:hover { background-color: #d62d51; }
.social-email:hover { background-color: #555555; }

/* Overlay positioning */
.social-sharing-overlay {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 15;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 8px;
    padding: 8px;
}

.social-sharing-overlay .social-sharing-buttons {
    margin: 0;
    gap: 8px;
}

.social-sharing-overlay .sharing-label {
    display: none;
}

.social-sharing-overlay .social-share-btn {
    width: 32px;
    height: 32px;
}

.social-sharing-overlay .social-share-btn svg {
    width: 16px;
    height: 16px;
}

/* Copy notification */
.copy-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #4caf50;
    color: white;
    padding: 12px 20px;
    border-radius: 4px;
    z-index: 10000;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
}

.copy-notification.show {
    opacity: 1;
    transform: translateX(0);
}

/* Responsive styles */
/* Large tablets and small desktops */
@media (max-width: 1024px) {
    .before-after-container {
        padding-bottom: 60% !important; /* Slightly taller on tablets */
    }
    
    .before-after-gallery {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 25px;
    }
}

/* Tablets */
@media (max-width: 768px) {
    .before-after-container {
        padding-bottom: 65% !important;
        border-radius: 6px;
    }
    
    .before-after-gallery {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .before-after-item {
        padding: 15px;
    }
    
    .social-sharing-overlay {
        top: 10px;
        right: 10px;
        padding: 6px;
    }
    
    .social-sharing-overlay .social-share-btn {
        width: 28px;
        height: 28px;
    }
    
    .social-sharing-overlay .social-share-btn svg {
        width: 14px;
        height: 14px;
    }
}

/* Mobile phones */
@media (max-width: 480px) {
    .before-after-container {
        padding-bottom: 75% !important; /* Taller on mobile for better visibility */
        border-radius: 4px;
    }
    
    .slider-line {
        width: 1.5px;
    }
    
    .slider-left-arrow {
        border-right: 5px solid #333;
        border-top: 3px solid transparent;
        border-bottom: 3px solid transparent;
        margin: 0 1px;
    }
    
    .slider-right-arrow {
        border-left: 5px solid #333;
        border-top: 3px solid transparent;
        border-bottom: 3px solid transparent;
        margin: 0 1px;
    }
    
    .before-after-item {
        padding: 12px;
    }
    
    .copy-notification {
        top: 10px;
        right: 10px;
        padding: 10px 16px;
        font-size: 13px;
    }
}

/* Very small phones */
@media (max-width: 360px) {
    .before-after-container {
        padding-bottom: 80% !important;
    }
    
    .placeholder-badge {
        font-size: 10px;
        padding: 5px 10px;
    }
}

/* Animation for smooth transitions */
.before-after-container * {
    transition: all 0.1s ease-out;
}

/* Loading state */
.before-after-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 250px;
    background-color: #f0f0f0;
    color: #666;
    font-size: clamp(14px, 2.5vw, 16px);
}

/* Error state */
.before-after-error {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 250px;
    background-color: #f8f8f8;
    color: #999;
    font-size: clamp(12px, 2.5vw, 14px);
    border: 2px dashed #ddd;
    border-radius: clamp(4px, 1vw, 8px);
}

/* Placeholder image styling */
.before-after-widget.has-placeholder .before-after-container {
    border: 2px dashed #e0e0e0;
}

.before-after-widget.has-placeholder .before-image,
.before-after-widget.has-placeholder .after-image {
    opacity: 0.7;
    filter: grayscale(20%);
}

.placeholder-badge {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 12px;
    z-index: 25;
    pointer-events: none;
}

/* Property detail page styles */
.property-before-after-section {
    margin: clamp(20px, 5vw, 30px) 0;
    padding: clamp(15px, 4vw, 20px);
    background: #f9f9f9;
    border-radius: clamp(6px, 1vw, 8px);
}

.property-section-title {
    font-size: clamp(20px, 4vw, 24px);
    margin-bottom: clamp(15px, 3vw, 20px);
    color: #333;
    font-weight: 600;
}

.property-comparison {
    background: white;
    border-radius: clamp(6px, 1vw, 8px);
    padding: clamp(15px, 4vw, 20px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.property-comparison .comparison-title {
    font-size: clamp(16px, 3.5vw, 18px);
    margin-bottom: clamp(12px, 3vw, 15px);
    color: #333;
    font-weight: 500;
}

.property-comparison .comparison-description {
    margin-top: clamp(12px, 3vw, 15px);
}

.property-comparison .comparison-description p {
    color: #666;
    line-height: 1.6;
    margin: 0;
    font-size: clamp(14px, 2.5vw, 16px);
}

/* WordPress theme override styles - ensure aspect ratio works */
.houzez-property .before-after-container,
.property-detail .before-after-container,
.property-content .before-after-container {
    overflow: hidden !important;
}

.houzez-property .before-image,
.houzez-property .after-image,
.property-detail .before-image,
.property-detail .after-image,
.property-content .before-image,
.property-content .after-image {
    height: 100% !important;
}

/* Loading state styles */
.before-after-container.loading {
    opacity: 0.7;
}

.before-after-container.loading::before {
    content: "Loading images...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 4px;
    z-index: 1000;
    font-size: 14px;
}

/* Debug styles (disabled by default) */
.before-after-container.show-debug .after-image-container {
    border: 2px solid red !important;
    background: rgba(255, 0, 0, 0.1) !important;
}

.before-after-container.show-debug .after-image {
    border: 2px solid blue !important;
}

/* Ensure container is interactive */
.before-after-container {
    cursor: col-resize;
    user-select: none;
}

.before-after-container.dragging {
    cursor: col-resize !important;
}

/* Landscape orientation adjustments */
@media (max-height: 600px) and (orientation: landscape) {
    .before-after-container {
        padding-bottom: 50% !important;
    }
}

/* Print styles */
@media print {
    .before-after-container {
        padding-bottom: 56.25% !important;
        page-break-inside: avoid;
    }
    
    .slider-handle,
    .slider-line,
    .social-sharing-overlay,
    .social-sharing-buttons {
        display: none !important;
    }
}