/**
 * Styles pour l'expérience utilisateur mobile - Mapster
 * Interface moderne avec design glassmorphism et animations fluides
 */

/* ========================================
   DÉTAILS DE LIEU MOBILE - DESIGN MODERNE
   ======================================== */

.mobile-place-details-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.4s;
}

.mobile-place-details-container.active {
    opacity: 1;
    visibility: visible;
    pointer-events: none;
}

.mobile-place-details-backdrop,
.mobile-place-details-panel {
    pointer-events: auto;
}

.mobile-place-details-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.6) 100%);
    backdrop-filter: blur(8px);
    transition: opacity 0.4s ease;
}

.mobile-place-details-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: 88vh;
    background: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
    border-radius: 24px 24px 0 0;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.12), 0 -2px 8px rgba(0, 0, 0, 0.08);
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    will-change: transform;
    overscroll-behavior: contain;
}

.mobile-place-details-container.active .mobile-place-details-panel {
    transform: translateY(0);
}

.mobile-place-details-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

/* Indicateur de swipe moderne */
.mobile-place-details-panel::before {
    content: '';
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 48px;
    height: 5px;
    background: linear-gradient(90deg, #e0e0e0 0%, #bdbdbd 50%, #e0e0e0 100%);
    border-radius: 3px;
    opacity: 0.8;
    transition: all 0.3s ease;
    z-index: 1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.mobile-place-details-panel:active::before {
    opacity: 1;
    width: 56px;
    background: linear-gradient(90deg, #bdbdbd 0%, #9e9e9e 50%, #bdbdbd 100%);
}

/* Bouton de fermeture moderne */
.mobile-place-details-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #424242;
    cursor: pointer;
    z-index: 2;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.1);
    min-width: 44px;
    min-height: 44px;
}

.mobile-place-details-close:hover,
.mobile-place-details-close:focus {
    background: #ffffff;
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2), 0 2px 4px rgba(0, 0, 0, 0.12);
}

.mobile-place-details-close:active {
    transform: scale(0.9) rotate(90deg);
}

/* Contenu popup mobile moderne */
.mobile-popup-container {
    flex: 1;
    padding: 28px 20px 20px 20px;
    overflow-y: auto;
}

.mobile-popup-container.no-images {
    padding-top: 28px;
}

/* Titre et header du lieu */
.mobile-popup-container h3 {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 12px;
    line-height: 1.3;
}

.mobile-popup-container .place-description {
    font-size: 15px;
    color: #616161;
    line-height: 1.6;
    margin-bottom: 16px;
}

/* Slider d'images moderne avec overlay gradient */
.mobile-image-slider {
    width: 100%;
    height: 280px;
    position: relative;
    overflow: hidden;
    border-radius: 24px 24px 0 0;
    background: var(--gray-200);
}

.mobile-image-slider.empty {
    display: none;
}

/* Overlay gradient sur les images */
.mobile-image-slider::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 120px;
    background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.4) 100%);
    pointer-events: none;
    z-index: 1;
}

.mobile-image-slider-track {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

.mobile-image-slider-track.swiping {
    transition: none;
}

.mobile-image-slider-item {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.mobile-image-slider-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.mobile-image-slider-item:active img {
    transform: scale(1.05);
}

.mobile-image-slider-item.loading img {
    opacity: 0;
}

.mobile-image-slider-item.loading::after {
    content: '⏳';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 32px;
    animation: pulse 1.5s ease-in-out infinite;
}

.mobile-image-slider-item.error::after {
    content: '❌';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 32px;
}

/* Compteur d'images moderne */
.mobile-image-counter {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(12px);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Pagination moderne du slider */
.mobile-image-slider-pagination {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 2;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
    padding: 8px 12px;
    border-radius: 20px;
}

.mobile-image-slider-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.mobile-image-slider-dot.active {
    background: #ffffff;
    transform: scale(1.4);
    width: 20px;
    border-radius: 3px;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.7; transform: translate(-50%, -50%) scale(1.1); }
}

/* Cartes d'informations modernes */
.mobile-info-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    margin-bottom: 8px;
    background: #f8f9fa;
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    font-size: 15px;
    line-height: 1.5;
    color: #424242;
    transition: all 0.3s ease;
}

.mobile-info-item:active {
    transform: scale(0.98);
    background: #f0f1f3;
}

.mobile-info-item .icon {
    font-size: 20px;
    min-width: 24px;
    text-align: center;
}

.mobile-info-item:last-child {
    margin-bottom: 0;
}

/* Description preview in mobile popup */
.popup-description-preview {
    font-size: 14px;
    color: #555;
    line-height: 1.4;
    margin-bottom: 10px;
    padding: 0 2px;
}

.popup-voir-plus {
    color: #007bff;
    text-decoration: none;
    font-size: 13px;
    margin-left: 4px;
    white-space: nowrap;
}

.popup-voir-plus:active {
    opacity: 0.7;
}

/* Google Maps button in mobile popup */
.popup-google-maps-btn {
    display: block;
    text-align: center;
    padding: 8px 12px;
    margin-bottom: 10px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    text-decoration: none;
    transition: background 0.2s ease;
}

.popup-google-maps-btn:active {
    background: #e9ecef;
}

/* Rating + description fusionnés sur une ligne */
.mobile-rating-desc {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-rating-desc .mobile-rating-text {
    flex-shrink: 0;
}

/* Description tronquée à deux lignes */
.mobile-desc-line {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: #666;
    font-style: italic;
    line-height: 1.3;
}

/* Bouton flottant moderne avec gradient */
.mobile-fab-container {
    position: fixed;
    bottom: calc(24px + env(safe-area-inset-bottom));
    right: 20px;
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.8) translateY(20px);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mobile-fab-container.visible {
    opacity: 1;
    visibility: visible;
    transform: scale(1) translateY(0);
}

.mobile-fab-button {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--primary-color);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(52, 152, 219, 0.4), 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.mobile-fab-button::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: var(--primary-color);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
    filter: blur(12px);
}

.mobile-fab-button:active {
    transform: scale(0.92);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3), 0 2px 4px rgba(0, 0, 0, 0.1);
}

.mobile-fab-button:active::before {
    opacity: 0.6;
}

/* Animation de pulsation moderne */
.mobile-fab-button.pulse {
    animation: fab-pulse-modern 2s ease-in-out infinite;
}

@keyframes fab-pulse-modern {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 8px 24px rgba(52, 152, 219, 0.4), 0 4px 8px rgba(0, 0, 0, 0.1);
    }
    50% {
        transform: scale(1.08);
        box-shadow: 0 12px 32px rgba(52, 152, 219, 0.5), 0 6px 12px rgba(0, 0, 0, 0.15);
    }
}

/* Badge de notification sur le FAB */
.mobile-fab-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(245, 87, 108, 0.4);
    border: 2px solid white;
}

/* ========================================
   ANIMATIONS ET TRANSITIONS
   ======================================== */

/* Styles pour le swipe en cours */
.mobile-place-details-panel.swipe-active {
    transition: none !important;
    will-change: transform;
}

.mobile-place-details-backdrop.swipe-active {
    transition: none !important;
    will-change: opacity;
}

/* ========================================
   ACCESSIBILITÉ ET PRÉFÉRENCES UTILISATEUR
   ======================================== */

/* Mode mouvement réduit */
@media (prefers-reduced-motion: reduce) {
    .mobile-place-details-container,
    .mobile-place-details-panel,
    .mobile-place-details-backdrop,
    .mobile-fab-container,
    .mobile-fab-button,
    .mobile-image-slider-track {
        transition: none;
    }
    
    .mobile-fab-button.pulse {
        animation: none;
    }
    
    @keyframes fab-pulse {
        /* Pas d'animation */
    }
}

/* Mode contraste élevé */
@media (prefers-contrast: high) {
    .mobile-place-details-panel {
        border: 2px solid var(--gris-900, #111827);
    }
    
    .mobile-place-details-close {
        border: 1px solid var(--gris-500, #6b7280);
    }
    
    .mobile-info-item {
        border-bottom-width: 2px;
    }
}

/* ========================================
   RESPONSIVE - TRÈS PETIT ÉCRAN
   ======================================== */

@media (max-width: 480px) {
    .mobile-place-details-panel {
        max-height: 92vh;
        border-radius: 20px 20px 0 0;
    }
    
    .mobile-image-slider {
        height: 240px;
        border-radius: 20px 20px 0 0;
    }
    
    .mobile-fab-container {
        bottom: calc(20px + env(safe-area-inset-bottom));
        right: 16px;
    }
    
    .mobile-fab-button {
        width: 56px;
        height: 56px;
        font-size: 24px;
    }
    
    .mobile-popup-container {
        padding: 24px 16px 16px 16px;
    }
    
    .mobile-info-item {
        padding: 12px 14px;
        font-size: 14px;
    }
}

/* ========================================
   UTILITÉS
   ======================================== */

/* Empêcher le défilement du body quand les détails sont ouverts */
.body--mobile-details-ouverts {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}