/**
 * STARIFY MOBILE NAVIGATION - STYLES AUTONOMES
 * Fichier CSS indépendant pour le menu de navigation mobile
 * Version universelle avec esthétique préservée
 */

/* Variables CSS pour le menu mobile - ESTHÉTIQUE PROPRE PRÉSERVÉE */
:root {
    --starify-nav-primary: #b8e6b8;
    --starify-nav-primary-dark: #90d690;
    
    /* VARIABLES MODE CLAIR (par défaut) - VERSION PROPRE */
    --starify-nav-text: #1d1d1f;
    --starify-nav-text-light: #f5f5f7;
    --starify-nav-surface: #ffffff;
    --starify-nav-dark: #2c2c2e;
    --starify-nav-dark-alt: #1c1c1e;
    --starify-nav-border: rgba(0, 0, 0, 0.1);
    --starify-nav-shadow: rgba(0, 0, 0, 0.1);
    --starify-nav-glass-light: rgba(255, 255, 255, 0.95);
    --starify-nav-glass-medium: rgba(255, 255, 255, 0.9);
    --starify-nav-glass-dark: rgba(255, 255, 255, 0.85);
}

/* VARIABLES MODE SOMBRE (selon les préférences système) */
@media (prefers-color-scheme: dark) {
    :root {
        --starify-nav-text: #f5f5f7;
        --starify-nav-text-light: #f5f5f7;
        --starify-nav-surface: #1d1d1f;
        --starify-nav-shadow: rgba(0, 0, 0, 0.4);
        --starify-nav-border: rgba(255, 255, 255, 0.3);
        --starify-nav-glass-light: rgba(44, 44, 46, 0.2);
        --starify-nav-glass-medium: rgba(28, 28, 30, 0.2);
        --starify-nav-glass-dark: rgba(0, 0, 0, 0.1);
    }
}

/* MENU MOBILE PRINCIPAL - ESTHÉTIQUE PROPRE UNIVERSELLE */
.starify-mobile-nav {
    position: fixed;
    bottom: 16px;
    left: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.95);
    opacity: 1;
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    display: none;
    justify-content: space-around;
    align-items: center;
    padding: 16px 20px;
    z-index: 1000;
    border-radius: 50px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin-bottom: 0;
    height: 68px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

/* Suppression complète des effets ::before pour éviter les dégradés */
.starify-mobile-nav::before {
    display: none;
}

/* VARIANTES DE THÈME - VERSION PROPRE UNIVERSELLE */
.starify-mobile-nav.theme-dark {
    background: rgba(44, 44, 46, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.starify-mobile-nav.theme-dark::before {
    display: none;
}

.starify-mobile-nav.theme-light {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.starify-mobile-nav.theme-light::before {
    display: none;
}

/* POSITION ALTERNATIVE (TOP) */
.starify-mobile-nav.position-top {
    top: 16px;
    bottom: auto;
}

/* AFFICHAGE RESPONSIVE */
@media (max-width: 768px) {
    .starify-mobile-nav {
        display: flex;
    }
}

@media (min-width: 769px) {
    .starify-mobile-nav {
        display: none !important;
    }
}

/* BOUTONS DE NAVIGATION - SANS BARRES D'INDICATION */
.starify-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 10px 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 20px;
    flex: 1;
    position: relative;
    z-index: 1;
    height: 100%;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    outline: none;
    min-height: 44px; /* Taille tactile minimum */
    min-width: 44px;
}

/* États des boutons - SUPPRESSION COMPLÈTE DES BARRES */
.starify-nav-btn:active {
    background: transparent !important;
    transform: none !important;
}

.starify-nav-btn:focus {
    outline: none !important;
}

.starify-nav-btn.active {
    background: transparent !important;
}

/* SUPPRESSION DE TOUTES LES BARRES ET INDICATEURS */
.starify-nav-btn::after,
.starify-nav-btn::before,
.starify-nav-btn.active::after,
.starify-nav-btn.active::before {
    display: none !important;
    content: none !important;
}

/* ICÔNES */
.starify-nav-icon {
    font-size: 20px;
    color: var(--starify-nav-text);
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    width: 24px;
    height: 24px;
    opacity: 1;
}

.starify-nav-icon svg {
    width: 20px;
    height: 20px;
    stroke: var(--starify-nav-text);
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: all 0.2s ease;
    opacity: 1;
}

/* LABELS */
.starify-nav-text {
    font-size: 10px;
    color: var(--starify-nav-text);
    font-weight: 600;
    margin-top: 2px;
    text-align: center;
    line-height: 1;
    opacity: 0;
    transform: translateY(-5px);
    transition: all 0.2s ease;
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Menu avec labels - SANS BARRES */
.starify-mobile-nav.show-labels .starify-nav-text {
    opacity: 1;
    transform: translateY(0);
}

.starify-mobile-nav.show-labels {
    height: 80px;
    padding: 12px 20px;
}

.starify-mobile-nav.show-labels .starify-nav-btn {
    gap: 4px;
    padding: 8px 6px;
}

/* SUPPRESSION DES BARRES MÊME AVEC LABELS */
.starify-mobile-nav.show-labels .starify-nav-btn::after,
.starify-mobile-nav.show-labels .starify-nav-btn.active::after {
    display: none !important;
    content: none !important;
}

/* THÈMES POUR LES ÉLÉMENTS - SANS BARRES */
.starify-mobile-nav.theme-dark .starify-nav-icon,
.starify-mobile-nav.theme-dark .starify-nav-text {
    color: var(--starify-nav-text-light);
    opacity: 1;
}

.starify-mobile-nav.theme-dark .starify-nav-icon svg {
    stroke: var(--starify-nav-text-light);
    opacity: 1;
}

/* Suppression des barres pour thème dark */
.starify-mobile-nav.theme-dark .starify-nav-btn::after,
.starify-mobile-nav.theme-dark .starify-nav-btn.active::after {
    display: none !important;
}

.starify-mobile-nav.theme-light .starify-nav-icon,
.starify-mobile-nav.theme-light .starify-nav-text {
    color: var(--starify-nav-text);
    opacity: 1;
}

.starify-mobile-nav.theme-light .starify-nav-btn:active {
    background: transparent !important;
}

/* Suppression des barres pour thème light */
.starify-mobile-nav.theme-light .starify-nav-btn::after,
.starify-mobile-nav.theme-light .starify-nav-btn.active::after {
    display: none !important;
}

.starify-mobile-nav.theme-light .starify-nav-btn:active {
    background-color: rgba(0, 0, 0, 0.1);
}

/* ANIMATIONS */
.starify-mobile-nav {
    animation: starifyNavSlideIn 0.3s ease-out;
}

@keyframes starifyNavSlideIn {
    from {
        transform: translateY(100%) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.starify-mobile-nav.position-top {
    animation: starifyNavSlideInTop 0.3s ease-out;
}

@keyframes starifyNavSlideInTop {
    from {
        transform: translateY(-100%) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Animation de pulsation pour les notifications */
@keyframes starifyNavPulse {
    0% {
        box-shadow: 0 8px 32px var(--starify-nav-shadow), 0 0 0 0 var(--starify-nav-primary);
    }
    70% {
        box-shadow: 0 8px 32px var(--starify-nav-shadow), 0 0 0 6px rgba(255, 255, 255, 0);
    }
    100% {
        box-shadow: 0 8px 32px var(--starify-nav-shadow), 0 0 0 0 rgba(255, 255, 255, 0);
    }
}

/* ADAPTATIONS POUR DIFFÉRENTES TAILLES D'ÉCRAN */

/* Très petits écrans (iPhone SE, etc.) */
@media (max-width: 320px) {
    .starify-mobile-nav {
        padding: 12px 16px;
        height: 60px;
        left: 4px;
        right: 4px;
    }

    .starify-nav-icon {
        font-size: 18px;
        width: 20px;
        height: 20px;
    }

    .starify-nav-icon svg {
        width: 18px;
        height: 18px;
    }

    .starify-nav-text {
        font-size: 9px;
    }

    .starify-mobile-nav.show-labels {
        height: 72px;
    }
}

/* Écrans moyens (iPhone 12, 13, etc.) */
@media (min-width: 375px) and (max-width: 414px) {
    .starify-mobile-nav {
        padding: 16px 24px;
    }
}

/* Grands écrans mobiles (iPhone 14 Plus, etc.) */
@media (min-width: 415px) and (max-width: 768px) {
    .starify-mobile-nav {
        padding: 18px 28px;
        height: 72px;
    }

    .starify-nav-icon {
        font-size: 22px;
        width: 26px;
        height: 26px;
    }

    .starify-nav-icon svg {
        width: 22px;
        height: 22px;
    }

    .starify-mobile-nav.show-labels {
        height: 84px;
    }
}

/* GESTION DE L'ORIENTATION */
@media (orientation: landscape) and (max-height: 500px) {
    /* Mode paysage sur mobile */
    .starify-mobile-nav {
        height: 50px;
        padding: 12px 20px;
        bottom: 8px;
    }

    .starify-nav-btn {
        min-height: 36px;
        gap: 1px;
        padding: 6px 4px;
    }

    .starify-nav-icon {
        font-size: 18px;
        width: 20px;
        height: 20px;
    }

    .starify-nav-icon svg {
        width: 18px;
        height: 18px;
    }

    .starify-nav-text {
        font-size: 9px;
    }

    .starify-mobile-nav.show-labels {
        height: 60px;
    }

    .starify-mobile-nav.show-labels .starify-nav-text {
        opacity: 0.8;
    }
}

/* ADAPTATIONS POUR LES ENCOCHES (iPhone X+) */
@supports (padding: max(0px)) {
    .starify-mobile-nav {
        padding-left: max(8px, env(safe-area-inset-left));
        padding-right: max(8px, env(safe-area-inset-right));
        padding-bottom: max(8px, env(safe-area-inset-bottom));
        left: max(8px, env(safe-area-inset-left));
        right: max(8px, env(safe-area-inset-right));
    }

    .starify-mobile-nav.position-top {
        padding-top: max(8px, env(safe-area-inset-top));
        padding-bottom: 8px;
        top: max(16px, env(safe-area-inset-top));
    }
}

/* ÉTATS SPÉCIAUX */

/* Menu désactivé */
.starify-mobile-nav.disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* Menu en mode chargement */
.starify-mobile-nav.loading {
    animation: starifyNavPulse 2s infinite;
}

/* Menu avec notification */
.starify-mobile-nav.has-notification {
    animation: starifyNavPulse 1.5s ease-in-out 3;
}

/* Badge de notification sur un bouton */
.starify-nav-btn .notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    background: #ff3b30;
    border-radius: 50%;
    border: 2px solid var(--starify-nav-surface);
    z-index: 2;
}

.starify-nav-btn .notification-count {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    background: #ff3b30;
    color: white;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--starify-nav-surface);
    z-index: 2;
    padding: 0 4px;
}

/* AMÉLIORATIONS D'ACCESSIBILITÉ */

/* Réduction des mouvements */
@media (prefers-reduced-motion: reduce) {
    .starify-mobile-nav,
    .starify-nav-btn,
    .starify-nav-icon,
    .starify-nav-text {
        animation: none !important;
        transition: none !important;
    }

    .starify-nav-btn:active {
        transform: none;
    }
}

/* Contraste élevé */
@media (prefers-contrast: high) {
    .starify-mobile-nav {
        border: 2px solid var(--starify-nav-text);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    }

    .starify-nav-btn.active {
        background-color: var(--starify-nav-text);
    }

    .starify-nav-btn.active .starify-nav-icon,
    .starify-nav-btn.active .starify-nav-text {
        color: var(--starify-nav-surface);
    }

    .starify-nav-btn.active .starify-nav-icon svg {
        stroke: var(--starify-nav-surface);
        opacity: 1;
    }
}

/* MODE SOMBRE SYSTÈME - VERSION PROPRE UNIVERSELLE */
@media (prefers-color-scheme: dark) {
    .starify-mobile-nav:not(.theme-light) {
        background: rgba(44, 44, 46, 0.95);
        border: 1px solid rgba(255, 255, 255, 0.3);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    }

    .starify-mobile-nav:not(.theme-light)::before {
        display: none;
    }
    
    .starify-mobile-nav:not(.theme-light) .starify-nav-icon,
    .starify-mobile-nav:not(.theme-light) .starify-nav-text {
        color: #f5f5f7;
        opacity: 1;
    }

    .starify-mobile-nav:not(.theme-light) .starify-nav-icon svg {
        stroke: #f5f5f7;
        opacity: 1;
    }
}

/* OPTIMISATIONS PERFORMANCE */
.starify-mobile-nav {
    will-change: transform, opacity;
    contain: layout style paint;
}

.starify-nav-btn {
    will-change: transform, background-color;
}

.starify-nav-btn:hover {
    will-change: transform, background-color, box-shadow;
}

/* CORRECTIONS SPÉCIFIQUES NAVIGATEURS */

/* Safari/WebKit */
@supports (-webkit-touch-callout: none) {
    .starify-mobile-nav {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
    }

    .starify-nav-btn {
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
    }
}

/* Firefox */
@-moz-document url-prefix() {
    .starify-nav-btn {
        -moz-user-select: none;
    }
}

/* STYLES POUR DÉVELOPPEMENT/DEBUG */
.starify-mobile-nav.debug {
    border: 2px dashed #ff3b30;
    background: rgba(255, 59, 48, 0.1) !important;
}

.starify-mobile-nav.debug .starify-nav-btn {
    border: 1px solid #ff9500;
    background: rgba(255, 149, 0, 0.1) !important;
}

/* CLASSES UTILITAIRES */
.starify-mobile-nav.fade-in {
    animation: starifyNavFadeIn 0.3s ease-out;
}

.starify-mobile-nav.fade-out {
    animation: starifyNavFadeOut 0.3s ease-out;
}

@keyframes starifyNavFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes starifyNavFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

.starify-mobile-nav.slide-up {
    animation: starifyNavSlideUp 0.3s ease-out;
}

@keyframes starifyNavSlideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}