/* ====================================
   📱 AMÉLIORATIONS MOBILE COMPLÈTES
   ====================================*/

/* Animation de pulse pour les icônes actives */
@keyframes iconPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

/* Indicateur visuel pour l'état actif */
.mobile-tab-item.active::before {
    content: '';
    position: absolute;
    top: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background: var(--gradient-primary);
    border-radius: 2px;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Effet de ripple au touch */
.mobile-tab-item::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, transparent 50%, rgba(0, 102, 204, 0.1) 50%);
    border-radius: 16px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
}

.mobile-tab-item:active::after {
    opacity: 1;
    transform: scale(1.2);
}

/* Badge de notification */
.mobile-tab-item .notification-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--danger);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    border: 2px solid white;
    animation: badgePulse 2s infinite;
}

@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Adaptation pour différentes tailles d'écran */
@media (max-width: 380px) {
    .mobile-tab-item {
        min-width: 3.5rem;
        padding: 0.5rem 0.25rem;
    }

    .mobile-tab-item .tab-icon {
        font-size: 1.2rem;
    }

    .mobile-tab-item .tab-label {
        font-size: 0.65rem;
    }
}

/* États de chargement pour l'IA */
.mobile-tab-item.ai-loading .tab-icon {
    animation: spin 1s linear infinite;
}

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

/* Animation d'apparition au chargement */
@keyframes tabBarSlideUp {
    from {
        opacity: 0;
        transform: translateY(100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Effet de vibration tactile (visuel) */
.mobile-tab-item.vibrate {
    animation: vibrate 0.3s ease-in-out;
}

@keyframes vibrate {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-2px);
    }
    75% {
        transform: translateX(2px);
    }
}

/* Améliorations pour le dark mode */
@media (prefers-color-scheme: dark) {
    .mobile-tab-bar {
        background: rgba(30, 41, 59, 0.98);
        border-top-color: rgba(100, 116, 139, 0.3);
    }

    .mobile-tab-item {
        color: var(--gray-400);
    }

    .mobile-tab-item.active {
        background: rgba(0, 102, 204, 0.2);
    }

    .mobile-tab-item .notification-badge {
        border-color: var(--gray-800);
    }
}

/* ====================================
   📱 MENU MOBILE DÉROULANT
   ====================================*/

.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: none;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease-out;
}

.mobile-menu-overlay.active {
    display: block;
}

.mobile-menu-panel {
    position: fixed;
    bottom: var(--tab-bar-height);
    left: 0;
    right: 0;
    background: white;
    border-radius: 20px 20px 0 0;
    padding: 1.5rem;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 70vh;
    overflow-y: auto;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2);
}

.mobile-menu-overlay.active .mobile-menu-panel {
    transform: translateY(0);
}

.mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.mobile-menu-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-800);
}

.mobile-menu-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--gray-500);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.mobile-menu-close:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.mobile-menu-items {
    display: grid;
    gap: 0.75rem;
}

.mobile-menu-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: 12px;
    text-decoration: none;
    color: var(--gray-800);
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.mobile-menu-item:hover {
    background: var(--primary-blue);
    color: white;
    transform: translateX(4px);
    border-color: var(--primary-cyan);
}

.mobile-menu-item .item-icon {
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.125rem;
}

.mobile-menu-item:hover .item-icon {
    background: white;
    color: var(--primary-blue);
}

.mobile-menu-item .item-content {
    flex: 1;
}

.mobile-menu-item .item-title {
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.mobile-menu-item .item-subtitle {
    font-size: 0.75rem;
    opacity: 0.7;
}

.mobile-menu-item .item-arrow {
    font-size: 0.875rem;
    opacity: 0.5;
    transition: all 0.3s ease;
}

.mobile-menu-item:hover .item-arrow {
    opacity: 1;
    transform: translateX(4px);
}

/* ====================================
   📱 GESTES MOBILES
   ====================================*/

.mobile-swipe-indicator {
    position: absolute;
    bottom: 0.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 2px;
    animation: swipeHint 3s ease-in-out infinite;
}

@keyframes swipeHint {
    0%, 100% {
        opacity: 0.3;
        transform: translateX(-50%) scaleX(1);
    }
    50% {
        opacity: 0.8;
        transform: translateX(-50%) scaleX(1.5);
    }
}

/* ====================================
   📱 OPTIMISATIONS TACTILES
   ====================================*/

.mobile-tab-item,
.mobile-menu-item {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Améliore la zone de touch */
.mobile-tab-item {
    position: relative;
    min-height: 44px; /* Zone de touch recommandée */
}

.mobile-tab-item::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    min-width: 44px;
    min-height: 44px;
    z-index: -1;
}

/* ====================================
   📱 NOTIFICATIONS MOBILES
   ====================================*/

.mobile-notification {
    position: fixed;
    top: 1rem;
    left: 1rem;
    right: 1rem;
    background: white;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 3000;
    transform: translateY(-100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 4px solid var(--primary-blue);
}

.mobile-notification.show {
    transform: translateY(0);
}

.mobile-notification.success {
    border-left-color: var(--success);
}

.mobile-notification.warning {
    border-left-color: var(--warning);
}

.mobile-notification.error {
    border-left-color: var(--danger);
}

.mobile-notification-content {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.mobile-notification-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    color: white;
    background: var(--primary-blue);
}

.mobile-notification-text {
    flex: 1;
}

.mobile-notification-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
}

.mobile-notification-message {
    font-size: 0.75rem;
    color: var(--gray-600);
    line-height: 1.4;
}

.mobile-notification-close {
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.mobile-notification-close:hover {
    background: var(--gray-100);
    color: var(--gray-600);
}

/* ====================================
   📱 PULL TO REFRESH
   ====================================*/

.pull-to-refresh {
    position: relative;
    overflow: hidden;
}

.pull-to-refresh-indicator {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.125rem;
    transition: all 0.3s ease;
    z-index: 100;
}

.pull-to-refresh.pulling .pull-to-refresh-indicator {
    top: 10px;
}

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

/* ====================================
   📱 ACCESSIBILITY MOBILE
   ====================================*/

@media (prefers-reduced-motion: reduce) {
    .mobile-tab-item,
    .mobile-menu-item,
    .mobile-notification,
    .pull-to-refresh-indicator {
        animation: none !important;
        transition: none !important;
    }
}

/* Focus visible pour navigation clavier */
.mobile-tab-item:focus-visible {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}

/* Support pour les écrans haute densité */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 2dppx) {
    .mobile-tab-item .tab-icon,
    .mobile-menu-item .item-icon {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}