/**
 * Modal Gesture Interactions
 * 
 * Swipe-to-close and touch-friendly modal enhancements for mobile devices.
 * Provides native-app-like gesture support for modals and detail views.
 * 
 * @package Silva_Customer_Portal
 * @version 2.6.0
 */

/* ========================================
   TOUCH INTERACTION INDICATORS
   ======================================== */

/* Swipe indicator for modals on mobile */
.estimate-viewer-modal::before,
.invoice-viewer-modal::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 4px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 2px;
    z-index: 10001;
    display: none;
}

@media (max-width: 768px) {
    .estimate-viewer-modal::before,
    .invoice-viewer-modal::before {
        display: block;
    }
}

/* ========================================
   SWIPE TO CLOSE SUPPORT
   ======================================== */

/* Enable GPU-accelerated transforms for smooth swiping */
.estimate-viewer-container,
.invoice-viewer-container {
    will-change: transform;
}

/* Touch action optimization */
@media (hover: none) {
    .estimate-viewer-modal,
    .invoice-viewer-modal {
        touch-action: pan-y;
    }
    
    .estimate-viewer-content,
    .invoice-viewer-content {
        touch-action: pan-y;
        overscroll-behavior: contain;
    }
}

/* ========================================
   DETAIL VIEW SLIDE ANIMATIONS
   ======================================== */

/* Slide in from right animation for detail views */
.projects-detail-view {
    animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Slide out to right when closing */
.projects-detail-view.closing {
    animation: slideOutRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Mobile-specific slide animations */
@media (max-width: 768px) {
    .projects-detail-view {
        animation: slideUpMobile 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .projects-detail-view.closing {
        animation: slideDownMobile 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    @keyframes slideUpMobile {
        from {
            transform: translateY(100%);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
    
    @keyframes slideDownMobile {
        from {
            transform: translateY(0);
            opacity: 1;
        }
        to {
            transform: translateY(100%);
            opacity: 0;
        }
    }
}

/* ========================================
   REDUCED MOTION SUPPORT
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    .estimate-viewer-container,
    .invoice-viewer-container,
    .projects-detail-view {
        animation: none !important;
    }
    
    .accordion-chevron,
    .accordion-body,
    .accordion-header {
        transition: none !important;
    }
}

/* ========================================
   HIGH CONTRAST MODE
   ======================================== */

@media (prefers-contrast: high) {
    .estimate-viewer-modal::before,
    .invoice-viewer-modal::before {
        background: rgba(255, 255, 255, 0.8);
    }
}
