/* before/after image slider styles | jahrei labs | 2025 */
/* interactive comparison component styling */

.before-after-slider {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.before-after-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
}

.before-image-container,
.after-image-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.before-image,
.after-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Slider handle */
.slider-handle {
    position: absolute;
    top: 0;
    left: 60%; /* Default position */
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, 
        rgba(255, 255, 255, 0.9) 0%, 
        rgba(255, 255, 255, 0.7) 50%, 
        rgba(255, 255, 255, 0.9) 100%);
    cursor: ew-resize;
    z-index: 10;
    transform: translateX(-50%);
    transition: background 0.2s ease;
}

.slider-handle:hover {
    background: linear-gradient(to bottom, 
        rgba(255, 255, 255, 1) 0%, 
        rgba(255, 255, 255, 0.9) 50%, 
        rgba(255, 255, 255, 1) 100%);
}

.slider-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    cursor: ew-resize;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.slider-button:hover {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(0, 0, 0, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: translate(-50%, -50%) scale(1.1);
}

.slider-button svg {
    width: 16px;
    height: 16px;
    color: rgba(0, 0, 0, 0.7);
    transition: color 0.2s ease;
}

.slider-button:hover svg {
    color: rgba(0, 0, 0, 0.9);
}

/* Image labels */
.image-label {
    position: absolute;
    top: 20px;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 20px;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 5;
    pointer-events: none;
    user-select: none;
    transition: opacity 0.3s ease;
}

.before-label {
    left: 20px;
}

.after-label {
    right: 20px;
}

/* Dragging state */
.before-after-slider.dragging {
    cursor: ew-resize;
}

.before-after-slider.dragging .slider-handle {
    background: linear-gradient(to bottom, 
        rgba(255, 255, 255, 1) 0%, 
        rgba(255, 255, 255, 0.9) 50%, 
        rgba(255, 255, 255, 1) 100%);
}

.before-after-slider.dragging .slider-button {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(0, 0, 0, 0.3);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
    transform: translate(-50%, -50%) scale(1.15);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .slider-button {
        width: 40px;
        height: 40px;
    }
    
    .slider-button svg {
        width: 14px;
        height: 14px;
    }
    
    .image-label {
        font-size: 0.8rem;
        padding: 6px 12px;
        top: 15px;
    }
    
    .before-label {
        left: 15px;
    }
    
    .after-label {
        right: 15px;
    }
}

@media (max-width: 480px) {
    .slider-button {
        width: 36px;
        height: 36px;
    }
    
    .slider-button svg {
        width: 12px;
        height: 12px;
    }
    
    .image-label {
        font-size: 0.75rem;
        padding: 4px 10px;
        top: 12px;
    }
    
    .before-label {
        left: 12px;
    }
    
    .after-label {
        right: 12px;
    }
}

/* Special styling for project gallery integration */
.project-gallery.before-after .gallery-main {
    padding: 0;
    background: transparent;
}

.project-gallery.before-after .gallery-main-image {
    display: none; /* Hide the default image when using before/after slider */
}

.project-gallery.before-after .before-after-slider {
    border-radius: 15px 15px 0 0;
    overflow: hidden;
}

.project-gallery.before-after.single-image .before-after-slider {
    border-radius: 15px;
}

/* Expanded view styling */
.project-expanded-gallery.before-after .project-expanded-image {
    display: none; /* Hide the default image when using before/after slider */
}

.project-expanded-gallery.before-after .before-after-slider {
    width: 100%;
    height: 100%;
    border-radius: 0;
}

.project-expanded-gallery.before-after.single-image .before-after-slider {
    height: 100%;
}

.project-expanded-gallery.before-after.has-thumbnails .before-after-slider {
    height: calc(100% - 70px);
}

/* Custom Before/After Modal Styles */
.before-after-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.before-after-modal.active {
    opacity: 1;
    visibility: visible;
}

.before-after-modal-content {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.before-after-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.before-after-modal-close:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.before-after-modal-slider {
    flex: 1;
    width: 100%;
    height: 100%;
    position: relative;
}

.before-after-modal-info {
    position: absolute;
    bottom: 30px;
    right: 30px;
    width: 400px;
    max-width: calc(100vw - 60px);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 5;
    transform: translateY(20px);
    opacity: 0;
    animation: slideInUp 0.5s ease 0.3s forwards;
}

@keyframes slideInUp {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-info-content {
    padding: 24px;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: #333;
    line-height: 1.3;
}

.modal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
    font-size: 0.9rem;
    color: #666;
}

.modal-meta span {
    background: rgba(0, 0, 0, 0.05);
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 500;
}

.modal-status {
    background: rgba(34, 197, 94, 0.1) !important;
    color: #16a34a !important;
}

.modal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.modal-tag {
    background: rgba(147, 51, 234, 0.1);
    color: #7c3aed;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 0.8rem;
    font-weight: 500;
}

.modal-description {
    margin-bottom: 16px;
    line-height: 1.6;
    color: #444;
}

.modal-description p {
    margin: 0;
}

.modal-details {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    padding-top: 16px;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #555;
}

.modal-details h3 {
    margin-bottom: 12px;
    font-size: 1.1rem;
    color: #333;
}

.modal-details ul {
    margin: 0 0 12px 20px;
    padding: 0;
}

.modal-details li {
    margin-bottom: 6px;
}

.modal-details p {
    margin: 0 0 12px 0;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .before-after-modal-info {
        width: 350px;
        bottom: 20px;
        right: 20px;
    }
    
    .modal-info-content {
        padding: 20px;
    }
    
    .modal-title {
        font-size: 1.3rem;
    }
}

@media (max-width: 768px) {
    .before-after-modal-close {
        top: 15px;
        right: 15px;
        width: 40px;
        height: 40px;
        font-size: 1.3rem;
    }
    
    .before-after-modal-info {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: none;
        border-radius: 20px 20px 0 0;
        max-height: 60vh;
        overflow-y: auto;
        transform: translateY(100%);
        animation: slideInUpMobile 0.5s ease 0.3s forwards;
    }
    
    @keyframes slideInUpMobile {
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
    
    .modal-info-content {
        padding: 24px 20px 32px;
    }
    
    .modal-title {
        font-size: 1.4rem;
        margin-bottom: 16px;
    }
    
    .modal-meta {
        flex-direction: column;
        gap: 8px;
    }
    
    .modal-meta span {
        display: inline-block;
        margin-right: 8px;
        margin-bottom: 4px;
    }
}

@media (max-width: 480px) {
    .before-after-modal-close {
        top: 12px;
        right: 12px;
        width: 36px;
        height: 36px;
        font-size: 1.2rem;
    }
    
    .modal-info-content {
        padding: 20px 16px 28px;
    }
    
    .modal-title {
        font-size: 1.2rem;
    }
    
    .modal-tags {
        gap: 6px;
    }
    
    .modal-tag {
        font-size: 0.75rem;
        padding: 3px 10px;
    }
    
    .modal-details {
        font-size: 0.85rem;
    }
}

/* Ensure the slider fills the modal properly */
.before-after-modal .before-after-slider {
    width: 100%;
    height: 100%;
    border-radius: 0;
}

.before-after-modal .before-after-container {
    width: 100%;
    height: 100%;
}

.before-after-modal .before-image,
.before-after-modal .after-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Adjust labels for full-screen view */
.before-after-modal .image-label {
    top: 30px;
    font-size: 1rem;
    padding: 10px 20px;
}

.before-after-modal .before-label {
    left: 30px;
}

.before-after-modal .after-label {
    right: 30px;
}

@media (max-width: 768px) {
    .before-after-modal .image-label {
        top: 20px;
        font-size: 0.9rem;
        padding: 8px 16px;
    }
    
    .before-after-modal .before-label {
        left: 20px;
    }
    
    .before-after-modal .after-label {
        right: 20px;
    }
}

@media (max-width: 480px) {
    .before-after-modal .image-label {
        top: 15px;
        font-size: 0.8rem;
        padding: 6px 12px;
    }
    
    .before-after-modal .before-label {
        left: 15px;
    }
    
    .before-after-modal .after-label {
        right: 15px;
    }
}