/* ========================================
   DAILY-REWARDS-MOBILE-FIX.CSS
   Corrections pour le bug de décalage sur mobile
   ======================================== */

/* Empêcher le décalage du modal sur tous les appareils tactiles */
@media (hover: none) and (pointer: coarse) {
    /* Le modal principal */
    .daily-rewards-modal {
        position: fixed !important;
        touch-action: none !important;
        -webkit-user-drag: none !important;
        user-select: none !important;
        -webkit-touch-callout: none !important;
    }
    
    /* Le backdrop */
    .daily-rewards-backdrop {
        position: fixed !important;
        touch-action: none !important;
        pointer-events: auto !important;
    }
    
    /* Le container du modal */
    .daily-rewards-container {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) scale(0.8) !important;
        -webkit-transform: translate(-50%, -50%) scale(0.8) !important;
        will-change: transform, opacity !important;
        -webkit-overflow-scrolling: touch !important;
        /* Permettre seulement le scroll vertical à l'intérieur */
        touch-action: pan-y !important;
        /* Empêcher la sélection de texte */
        -webkit-user-select: none !important;
        user-select: none !important;
    }
    
    .daily-rewards-container.active {
        transform: translate(-50%, -50%) scale(1) !important;
        -webkit-transform: translate(-50%, -50%) scale(1) !important;
    }
    
    /* Empêcher les tap highlights sur iOS */
    .daily-rewards-container * {
        -webkit-tap-highlight-color: transparent !important;
    }
    
    /* Les cartes de récompenses */
    .reward-card {
        touch-action: manipulation !important;
        -webkit-user-select: none !important;
        user-select: none !important;
        /* Empêcher le zoom au double tap */
        -ms-touch-action: manipulation !important;
    }
    
    /* Les boutons */
    .daily-rewards-claim-button,
    .daily-rewards-close {
        touch-action: manipulation !important;
        -webkit-user-select: none !important;
        user-select: none !important;
    }
    
    /* Empêcher le bounce effect sur iOS */
    .daily-rewards-modal,
    .daily-rewards-container {
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior: contain !important;
    }
}

/* Styles spécifiques pour iOS */
@supports (-webkit-touch-callout: none) {
    .daily-rewards-modal {
        position: fixed !important;
        -webkit-transform: translate3d(0, 0, 0) !important;
    }
    
    .daily-rewards-container {
        -webkit-backface-visibility: hidden !important;
        -webkit-perspective: 1000 !important;
        -webkit-transform-style: preserve-3d !important;
    }
}

/* Fix pour le body quand le modal est ouvert */
body.modal-open {
    position: fixed !important;
    width: 100% !important;
    overflow: hidden !important;
    -webkit-overflow-scrolling: auto !important;
}

/* Amélioration de la performance */
.daily-rewards-container,
.daily-rewards-backdrop {
    will-change: transform, opacity;
}

/* S'assurer que le modal reste centré même après interaction */
@media (max-width: 768px) {
    .daily-rewards-container {
        /* Utiliser des valeurs viewport pour le centrage */
        top: 50vh !important;
        left: 50vw !important;
        right: auto !important;
        bottom: auto !important;
        margin: 0 !important;
    }
}
