/**
 * Premium Touch Interaction Styles
 * Relicform Studios - Mobile Enhancement (TASK-017)
 */

/* ========================================
   Ripple Effect
   ======================================== */
.ripple-effect {
    position: absolute;
    border-radius: 50%;
    background: rgba(212, 175, 55, 0.25);
    transform: scale(0);
    animation: ripple-animation 0.6s ease-out forwards;
    pointer-events: none;
    width: 100px;
    height: 100px;
    margin-left: -50px;
    margin-top: -50px;
    z-index: 1;
}

@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* ========================================
   Pull-to-Refresh Indicator
   ======================================== */
.pull-refresh-indicator {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%) translateY(-60px);
    z-index: 999;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: rgba(4, 6, 11, 0.95);
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.pull-refresh-indicator.ready .refresh-spinner {
    animation: none;
    fill: var(--color-accent, #d4af37);
}

.pull-refresh-indicator.refreshing .refresh-spinner {
    animation: spin 1s linear infinite;
}

.refresh-spinner {
    width: 20px;
    height: 20px;
    fill: var(--color-text-secondary, #9ca3b0);
    transition: fill 0.2s ease;
}

.refresh-text {
    font-size: 0.75rem;
    color: var(--color-text-secondary, #9ca3b0);
    font-weight: 500;
    font-family: var(--font-body, 'Inter', sans-serif);
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ========================================
   Image Gallery Swipe Styles
   ======================================== */
.product-gallery,
.product-images {
    position: relative;
    overflow: hidden;
    touch-action: pan-y;
}

.gallery-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.gallery-image.active {
    position: relative;
    opacity: 1;
}

/* Pagination Dots */
.gallery-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 0;
}

.gallery-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-text-muted, #5c6370);
    opacity: 0.3;
    transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease;
    cursor: pointer;
    border: none;
    padding: 0;
}

.gallery-dot:hover {
    opacity: 0.6;
}

.gallery-dot.active {
    opacity: 1;
    background: var(--color-accent, #d4af37);
    transform: scale(1.25);
}

/* ========================================
   Pinch-to-Zoom
   ======================================== */
.product-detail-image,
.product-main-image,
.product-image-main img {
    touch-action: manipulation;
    transition: transform 0.2s ease;
    transform-origin: center center;
    cursor: zoom-in;
}

.product-detail-image.zooming,
.product-main-image.zooming,
.product-image-main img.zooming {
    transition: none;
    cursor: move;
}

/* ========================================
   Enhanced Touch Targets
   ======================================== */
@media (max-width: 767px) {
    /* Ensure minimum touch target size */
    .btn,
    .filter-btn,
    button,
    [role="button"],
    .nav-link,
    .bottom-nav-item {
        min-height: 48px;
        min-width: 48px;
    }

    /* Increase spacing for better touch targets */
    .filter-btn {
        padding: 0.75rem 1.25rem;
        margin: 0.25rem;
    }

    /* Product card touch optimization */
    .product-card {
        -webkit-tap-highlight-color: transparent;
    }

    .product-card:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }

    /* Thumbnail touch targets */
    .product-thumbnails .thumbnail {
        min-width: 60px;
        min-height: 60px;
        padding: 4px;
    }

    /* Add to cart button enhancement */
    .btn-add-to-cart,
    .add-to-cart-btn {
        padding: 1rem 1.5rem;
        font-size: 1rem;
    }
}

/* ========================================
   Touch Feedback States
   ======================================== */
@media (hover: none) and (pointer: coarse) {
    /* Touch-only styles */
    .product-card:active,
    .btn:active,
    .filter-btn:active {
        opacity: 0.8;
    }

    /* Disable hover effects on touch */
    .product-card:hover {
        transform: none;
        box-shadow: var(--shadow-md);
    }
}

/* ========================================
   Swipe Hint Animation
   ======================================== */
.swipe-hint {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--color-text-secondary, #9ca3b0);
    font-size: 0.75rem;
    opacity: 0;
    animation: swipe-hint-appear 3s ease-out forwards;
    animation-delay: 2s;
}

.swipe-hint svg {
    width: 16px;
    height: 16px;
    animation: swipe-hint-arrow 1s ease-in-out infinite;
}

@keyframes swipe-hint-appear {
    0%, 80% { opacity: 0.7; }
    100% { opacity: 0; }
}

@keyframes swipe-hint-arrow {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(5px); }
}

/* ========================================
   Prevent Text Selection on Touch
   ======================================== */
@media (max-width: 767px) {
    .bottom-nav-item,
    .filter-btn,
    .product-card-actions {
        -webkit-user-select: none;
        user-select: none;
    }
}
