/**
 * Interface Mobile Moderne - Mapster
 * Design system moderne avec gradients, glassmorphism et micro-interactions
 */

/* ========================================
   HEADER MOBILE MODERNE
   ======================================== */

@media (max-width: 768px) {
    .app-header {
        background: white;
        border-bottom: 1px solid rgba(0, 0, 0, 0.08);
        padding: 12px 16px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
        position: sticky;
        top: 0;
        z-index: 1001;
    }
    
    .app-header h1 {
        color: #1a1a1a;
        font-size: 20px;
        font-weight: 700;
        letter-spacing: 0.5px;
    }
    
    /* Boutons header modernes */
    .header-controls {
        gap: 8px;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 2px;
    }
    
    .header-controls::-webkit-scrollbar {
        display: none;
    }
    
    .header-controls .btn {
        background: #f8f9fa;
        color: #424242;
        border: 1px solid rgba(0, 0, 0, 0.08);
        padding: 10px 14px;
        border-radius: 12px;
        font-weight: 600;
        font-size: 13px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        white-space: nowrap;
        min-width: auto;
    }
    
    .header-controls .btn .icon {
        font-size: 18px;
        display: inline-block;
    }
    
    .header-controls .btn .text {
        display: none;
    }
    
    .header-controls .btn:active {
        transform: scale(0.92);
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    }
    
    .header-controls .btn-primary {
        background: #3498db;
        color: white;
        border: none;
        box-shadow: 0 2px 6px rgba(52, 152, 219, 0.25);
    }
    
    .header-controls .btn-primary:active {
        box-shadow: 0 1px 3px rgba(52, 152, 219, 0.3);
    }
    
    /* Bouton avec badge */
    .header-controls .btn {
        position: relative;
    }
    
    .header-controls .btn .badge {
        position: absolute;
        top: -4px;
        right: -4px;
        color: white;
        width: 18px;
        height: 18px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 10px;
        font-weight: 700;
        box-shadow: 0 2px 6px rgba(245, 87, 108, 0.4);
        border: 2px solid white;
    }
}

/* ========================================
   SIDE PANEL MOBILE MODERNE
   ======================================== */

@media (max-width: 768px) {
    .side-panel {
        background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
        box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
    }
    
    .side-panel-header {
        background: var(--primary-color);
        color: white;
        padding: 16px 20px;
        border-bottom: none;
    }
    
    .side-panel-header h3 {
        color: white;
        font-weight: 700;
        font-size: 18px;
    }
    
    .side-panel-header .btn {
        background: rgba(255, 255, 255, 0.2);
        backdrop-filter: blur(8px);
        color: white;
        border: 1px solid rgba(255, 255, 255, 0.3);
        width: 36px;
        height: 36px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        font-size: 18px;
    }
    
    .side-panel-header .btn:active {
        background: rgba(255, 255, 255, 0.3);
        transform: scale(0.9);
    }
    
    /* Filtres section moderne */
    .filters-section {
        background: white;
        padding: 16px;
        border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    }
    
    .search-group input {
        border: 2px solid rgba(102, 126, 234, 0.2);
        border-radius: 12px;
        padding: 12px 16px;
        font-size: 15px;
        background: #f8f9fa;
        transition: all 0.3s ease;
    }
    
    .search-group input:focus {
        border-color: var(--primary-color);
        background: white;
        box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
    }
    
    /* Accordion moderne */
    .accordion-toggle {
        background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
        border: 2px solid rgba(52, 152, 219, 0.15);
        border-radius: 12px;
        padding: 12px 16px;
        font-weight: 600;
        color: #424242;
        transition: all 0.3s ease;
    }
    
    .accordion-toggle:active {
        transform: scale(0.98);
        background: var(--primary-color);
        color: white;
    }
    
    .accordion-toggle .toggle-icon {
        font-size: 14px;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .accordion-toggle.active .toggle-icon {
        transform: rotate(180deg);
    }
    
    /* Boutons de filtres */
    .filter-actions .btn {
        border-radius: 12px;
        padding: 12px 20px;
        font-weight: 600;
        font-size: 14px;
        transition: all 0.3s ease;
    }
    
    .filter-actions .btn-primary {
        background: var(--primary-color);
        box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
    }
    
    .filter-actions .btn-primary:active {
        transform: scale(0.96);
        box-shadow: 0 2px 6px rgba(52, 152, 219, 0.4);
    }
    
    .filter-actions .btn-secondary {
        background: white;
        border: 2px solid rgba(52, 152, 219, 0.2);
        color: var(--primary-color);
    }
    
    .filter-actions .btn-secondary:active {
        background: #f8f9fa;
        transform: scale(0.96);
    }
}

/* ========================================
   PLACE ITEMS MODERNES
   ======================================== */

@media (max-width: 768px) {
    .place-item {
        background: white;
        border: 2px solid rgba(0, 0, 0, 0.06);
        border-radius: 16px;
        padding: 16px;
        margin-bottom: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .place-item:active {
        transform: scale(0.98);
        box-shadow: 0 4px 16px rgba(52, 152, 219, 0.15);
        border-color: rgba(52, 152, 219, 0.3);
    }
    
    .place-title {
        font-size: 17px;
        font-weight: 700;
        color: #1a1a1a;
        margin-bottom: 8px;
    }
    
    .place-description {
        font-size: 14px;
        color: #616161;
        line-height: 1.5;
    }
    
    .place-meta {
        margin-top: 12px;
        padding-top: 12px;
        border-top: 1px solid rgba(0, 0, 0, 0.06);
    }
    
    .place-rating {
        background: linear-gradient(135deg, #ffd89b 0%, #ff9a56 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
        font-weight: 700;
    }
}

/* ========================================
   MODALES MODERNES
   ======================================== */

@media (max-width: 768px) {
    .modal {
        padding: 0;
        background: linear-gradient(180deg, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0.7) 100%);
        backdrop-filter: blur(8px);
    }
    
    .modal-content {
        border-radius: 24px 24px 0 0;
        max-height: 95vh;
        margin: 0;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        max-width: none;
        animation: slideUpModal 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    }
    
    @keyframes slideUpModal {
        from {
            transform: translateY(100%);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
    
    .modal-header {
        background: var(--white);
        color: var(--gray-800);
        border-bottom: 1px solid var(--gray-200);
        padding: 20px;
        border-radius: 24px 24px 0 0;
        position: relative;
    }
    
    .modal-header::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 4px;
        background: var(--gray-300);
        border-radius: 2px;
    }
    
    .modal-header h2 {
        color: var(--gray-800);
        font-size: 20px;
        font-weight: 700;
        margin-top: 8px;
    }
    
    .modal-header .btn {
        background: var(--gray-100);
        color: var(--gray-700);
        border: 1px solid var(--gray-300);
        width: 36px;
        height: 36px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
    }
    
    /* Form inputs sobres comme desktop */
    .form-group input,
    .form-group textarea,
    .form-group select {
        border: 1px solid var(--gray-300);
        border-radius: 8px;
        padding: 12px 16px;
        font-size: 15px;
        background: var(--white);
        transition: all 0.2s ease;
    }
    
    .form-group input:focus,
    .form-group textarea:focus,
    .form-group select:focus {
        border-color: var(--primary-color);
        background: var(--white);
        outline: none;
        box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
    }
    
    .form-group label {
        font-weight: 600;
        color: #424242;
        font-size: 14px;
        margin-bottom: 8px;
    }
    
    /* Boutons de formulaire */
    .form-actions .btn,
    .location-controls .btn {
        border-radius: 12px;
        padding: 12px 20px;
        font-weight: 600;
        font-size: 14px;
        transition: all 0.3s ease;
    }
    
    .form-actions .btn-primary,
    .location-controls .btn-primary {
        background: var(--primary-color);  /* Bleu comme desktop */
        color: white;
        border: none;
        box-shadow: 0 2px 4px rgba(52, 152, 219, 0.2);
    }
    
    .form-actions .btn-primary:active {
        transform: scale(0.96);
        box-shadow: 0 2px 6px rgba(102, 126, 234, 0.4);
    }
    
    .form-actions .btn-secondary,
    .location-controls .btn-secondary {
        background: white;
        border: 2px solid rgba(52, 152, 219, 0.2);
        color: var(--primary-color);
    }
    
    .form-actions .btn-danger {
        background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
        box-shadow: 0 4px 12px rgba(245, 87, 108, 0.3);
    }
}

/* ========================================
   TAGS MODERNES
   ======================================== */

@media (max-width: 768px) {
    .selected-tags .tag-item,
    .popular-tags .tag-item {
        background: var(--primary-color);
        color: white;
        padding: 8px 14px;
        border-radius: 20px;
        font-size: 13px;
        font-weight: 600;
        box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
        transition: all 0.3s ease;
        border: none;
    }
    
    .selected-tags .tag-item:active,
    .popular-tags .tag-item:active {
        transform: scale(0.92);
        box-shadow: 0 1px 4px rgba(52, 152, 219, 0.4);
    }
    
    .selected-tags .tag-item .remove-tag {
        background: rgba(255, 255, 255, 0.3);
        color: white;
        width: 18px;
        height: 18px;
        border-radius: 50%;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-left: 6px;
        font-size: 12px;
        transition: all 0.2s ease;
    }
    
    .selected-tags .tag-item .remove-tag:active {
        background: rgba(255, 255, 255, 0.5);
        transform: scale(0.9);
    }
}

/* ========================================
   TOAST NOTIFICATIONS MODERNES
   ======================================== */

@media (max-width: 768px) {
    .toast-container {
        top: auto;
        bottom: calc(20px + env(safe-area-inset-bottom));
        left: 16px;
        right: 16px;
    }
    
    .toast {
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(12px);
        border-radius: 16px;
        padding: 16px;
        border-left: 4px solid var(--primary-color);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
        animation: slideUpToast 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    }
    
    @keyframes slideUpToast {
        from {
            transform: translateY(100px);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
    
    .toast.success {
        border-left-color: #4ade80;
    }
    
    .toast.error {
        border-left-color: #f87171;
    }
    
    .toast.warning {
        border-left-color: #fbbf24;
    }
}

/* ========================================
   ANIMATIONS ET MICRO-INTERACTIONS
   ======================================== */

@media (max-width: 768px) {
    /* Effet de ripple sur les boutons */
    .btn {
        position: relative;
        overflow: hidden;
    }
    
    .btn::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 0;
        height: 0;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.5);
        transform: translate(-50%, -50%);
        transition: width 0.6s, height 0.6s;
    }
    
    .btn:active::after {
        width: 300px;
        height: 300px;
    }
    
    /* Skeleton loading pour les places */
    .place-item.loading {
        background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
        background-size: 200% 100%;
        animation: loading 1.5s ease-in-out infinite;
    }
    
    @keyframes loading {
        0% { background-position: 200% 0; }
        100% { background-position: -200% 0; }
    }
}

/* ========================================
   SAFE AREA ET NOTCH
   ======================================== */

@media (max-width: 768px) {
    .app-header {
        padding-top: max(12px, env(safe-area-inset-top));
    }
    
    .side-panel {
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .modal-content {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* ========================================
   DARK MODE SUPPORT (optionnel)
   ======================================== */

@media (max-width: 768px) and (prefers-color-scheme: dark) {
    .app-header {
        background: var(--gray-800);
    }
    
    .side-panel {
        background: linear-gradient(180deg, #1a1a1a 0%, #2d2d2d 100%);
    }
    
    .place-item {
        background: #2d2d2d;
        border-color: rgba(255, 255, 255, 0.1);
        color: #e0e0e0;
    }
    
    .place-title {
        color: #ffffff;
    }
    
    .place-description {
        color: #b0b0b0;
    }
}
