/**
 * Mobile Enhancements CSS
 * Purpose: Pull-to-refresh, skeletons, ripple effects, toasts
 * Version: 1.0.0
 * Created: 2025-10-11
 */

/* ===================================
   PULL-TO-REFRESH
   =================================== */

.pull-to-refresh-indicator {
    position: fixed;
    top: -100px;
    left: 0;
    right: 0;
    height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #fff;
    z-index: 9999;
    opacity: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.pull-to-refresh-indicator.ready {
    background: #d1ecf1;
}

.pull-to-refresh-spinner {
    margin-bottom: 0.5rem;
}

.pull-to-refresh-text {
    font-size: 0.875rem;
    color: #6c757d;
    font-weight: 500;
}

/* ===================================
   LOADING SKELETONS
   =================================== */

.skeleton-loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
    color: transparent !important;
    pointer-events: none;
    user-select: none;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-text-sm {
    height: 0.875rem;
}

.skeleton-text-lg {
    height: 1.25rem;
}

.skeleton-avatar {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
}

.skeleton-button {
    height: 2.5rem;
    width: 6rem;
    border-radius: 0.25rem;
}

.skeleton-card {
    height: 10rem;
    border-radius: 0.5rem;
}

/* ===================================
   RIPPLE EFFECT
   =================================== */

.btn, button, [role="button"] {
    position: relative;
    overflow: hidden;
}

.ripple-effect {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: scale(0);
    animation: ripple 0.6s ease-out;
    pointer-events: none;
}

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Dark button ripple */
.btn-dark .ripple-effect,
.btn-secondary .ripple-effect {
    background: rgba(255, 255, 255, 0.3);
}

/* Light button ripple */
.btn-light .ripple-effect,
.btn-outline-primary .ripple-effect {
    background: rgba(0, 0, 0, 0.1);
}

/* ===================================
   MOBILE TOASTS
   =================================== */

.mobile-toast {
    position: fixed;
    bottom: -100px;
    left: 1rem;
    right: 1rem;
    padding: 1rem;
    border-radius: 0.5rem;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    transition: bottom 0.3s ease;
    display: flex;
    align-items: center;
}

.mobile-toast.show {
    bottom: calc(64px + 1rem); /* Above bottom nav */
}

.mobile-toast-content {
    display: flex;
    align-items: center;
    font-size: 0.9375rem;
    font-weight: 500;
}

.mobile-toast-success {
    background: #d1e7dd;
    color: #0f5132;
    border-left: 4px solid #198754;
}

.mobile-toast-error {
    background: #f8d7da;
    color: #842029;
    border-left: 4px solid #dc3545;
}

.mobile-toast-warning {
    background: #fff3cd;
    color: #664d03;
    border-left: 4px solid #ffc107;
}

.mobile-toast-info {
    background: #cfe2ff;
    color: #084298;
    border-left: 4px solid #0d6efd;
}

/* ===================================
   SWIPE INDICATORS
   =================================== */

.swipe-indicator {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 60px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.5rem;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    z-index: 9998;
}

.swipe-indicator-left {
    left: 1rem;
}

.swipe-indicator-right {
    right: 1rem;
}

.swipe-indicator.show {
    opacity: 1;
}

/* ===================================
   LOADING STATES
   =================================== */

.loading-fade {
    position: relative;
}

.loading-fade::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

/* ===================================
   SMOOTH SCROLL
   =================================== */

@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

/* ===================================
   TOUCH FEEDBACK
   =================================== */

@media (hover: none) {
    .btn:active,
    button:active,
    [role="button"]:active {
        transform: scale(0.98);
        opacity: 0.9;
    }
    
    .card-hover:active {
        transform: translateY(0) scale(0.98);
    }
}

/* ===================================
   MOBILE-SPECIFIC ANIMATIONS
   =================================== */

@keyframes slideInFromBottom {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInFromTop {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Apply animations on mobile only */
@media (max-width: 767px) {
    .animate-slide-up {
        animation: slideInFromBottom 0.3s ease-out;
    }
    
    .animate-slide-down {
        animation: slideInFromTop 0.3s ease-out;
    }
    
    .animate-fade-in {
        animation: fadeIn 0.3s ease-out;
    }
    
    .animate-scale-in {
        animation: scaleIn 0.3s ease-out;
    }
}

/* ===================================
   DARK MODE SUPPORT
   =================================== */

@media (prefers-color-scheme: dark) {
    .pull-to-refresh-indicator {
        background: #2d2d2d;
        color: #e0e0e0;
    }
    
    .pull-to-refresh-indicator.ready {
        background: #1a5a6e;
    }
    
    .pull-to-refresh-text {
        color: #adb5bd;
    }
    
    .skeleton-loading {
        background: linear-gradient(90deg, #2d2d2d 25%, #3d3d3d 50%, #2d2d2d 75%);
        background-size: 200% 100%;
    }
    
    .mobile-toast {
        background: #2d2d2d;
    }
    
    .mobile-toast-success {
        background: #1a4d2e;
        color: #a3cfbb;
    }
    
    .mobile-toast-error {
        background: #4d1a1a;
        color: #f1aeb5;
    }
    
    .mobile-toast-warning {
        background: #4d3d1a;
        color: #ffe69c;
    }
    
    .mobile-toast-info {
        background: #1a3a4d;
        color: #9ec5fe;
    }
}


