/**
 * Styles mobiles optimisés
 * Terrano VPS Platform
 */

/* ============================================
   MENU HAMBURGER
   ============================================ */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
    position: relative;
}

.hamburger-line {
    width: 100%;
    height: 3px;
    background: var(--primary-color, #6366f1);
    border-radius: 10px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* ============================================
   NAVIGATION MOBILE
   ============================================ */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }

    .mobile-nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 400px;
        height: 100vh;
        background: white;
        box-shadow: -2px 0 10px rgba(0,0,0,0.1);
        transition: right 0.3s ease;
        z-index: 1000;
        padding: 80px 30px 30px;
        overflow-y: auto;
    }

    .mobile-nav-menu.active {
        right: 0;
    }

    .mobile-nav-menu a {
        display: block;
        padding: 15px 0;
        border-bottom: 1px solid #f0f0f0;
        color: #333;
        text-decoration: none;
        font-size: 18px;
        transition: all 0.3s;
    }

    .mobile-nav-menu a:hover {
        color: var(--primary-color, #6366f1);
        padding-left: 10px;
    }

    /* Overlay */
    body.menu-open::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }
}

/* ============================================
   BOTTOM NAVIGATION - Style moderne
   ============================================ */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    background: white;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
    z-index: 9999 !important;
    padding: 8px 0 max(8px, env(safe-area-inset-bottom));
    border-top: 1px solid rgba(0,0,0,0.05);
}

.bottom-nav-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    padding: 0 10px;
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #9ca3af;
    font-size: 11px;
    padding: 8px 5px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    font-weight: 500;
    min-width: 60px;
}

.bottom-nav-item i {
    font-size: 22px;
    margin-bottom: 4px;
    transition: all 0.3s;
}

.bottom-nav-item span {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.bottom-nav-item:active {
    transform: scale(0.95);
}

.bottom-nav-item.active {
    color: #6366f1;
}

.bottom-nav-item.active i {
    transform: translateY(-2px);
}

/* Bouton central (FAB) */
.bottom-nav-fab {
    position: absolute;
    left: 50%;
    top: -25px;
    transform: translateX(-50%);
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: white;
    font-size: 24px;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 4px solid white;
}

.bottom-nav-fab:active {
    transform: translateX(-50%) scale(0.9);
}

.bottom-nav-fab:hover {
    box-shadow: 0 6px 25px rgba(99, 102, 241, 0.5);
}

/* Spacer pour le bouton central */
.bottom-nav-spacer {
    flex: 1;
    min-width: 60px;
}

@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: block !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        visibility: visible !important;
        opacity: 1 !important;
    }

    body {
        padding-bottom: max(65px, calc(65px + env(safe-area-inset-bottom))) !important;
    }

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

    .mobile-bottom-nav {
        animation: slideUp 0.4s ease-out;
    }
}

/* ============================================
   OPTIMISATIONS MOBILE
   ============================================ */
@media (max-width: 768px) {
    /* Header mobile */
    header {
        padding: 15px 20px !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 1000 !important;
        background: white !important;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1) !important;
    }

    /* Ajouter du padding pour compenser le header fixe */
    body > section:first-of-type,
    body > .hero {
        padding-top: 80px !important;
    }

    .nav, .navbar {
        padding: 0 !important;
    }

    .nav-brand, .logo {
        font-size: 0 !important; /* Cache le texte */
    }

    .nav-brand img, .logo img {
        height: 35px !important;
        margin-right: 0 !important; /* Enlève la marge */
    }

    /* Cache le texte span sur mobile */
    .nav-brand span {
        display: none !important;
    }

    /* Hero section mobile */
    .hero {
        padding: 60px 20px !important;
        min-height: auto !important;
    }

    .hero h1 {
        font-size: 32px !important;
        line-height: 1.2 !important;
    }

    .hero p {
        font-size: 16px !important;
    }

    /* Pricing cards mobile */
    .pricing-container {
        padding: 30px 15px !important;
    }

    .pricing-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }

    .pricing-card {
        margin-bottom: 20px;
    }

    .pricing-price {
        font-size: 36px !important;
    }

    /* Features mobile */
    .features-grid {
        grid-template-columns: 1fr !important;
    }

    /* Forms mobile */
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px !important; /* Prevent zoom on iOS */
    }

    /* Buttons mobile */
    .btn {
        padding: 14px 24px !important;
        font-size: 15px !important;
        border-radius: 8px !important;
        min-height: 48px; /* Taille tactile recommandée */
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
    }

    .btn-lg {
        padding: 16px 32px !important;
        font-size: 16px !important;
        min-height: 52px;
    }

    .btn-primary, .btn-outline, .btn-secondary {
        width: 100%;
        max-width: 400px;
        margin: 0 auto;
    }

    .hero .btn-group {
        flex-direction: column !important;
        gap: 12px !important;
        width: 100%;
    }

    .hero .btn-group .btn {
        width: 100%;
        max-width: none;
    }

    /* Tables mobile */
    table {
        font-size: 14px !important;
    }

    th, td {
        padding: 10px !important;
    }

    /* Modals mobile */
    .modal-content {
        width: 95% !important;
        max-width: 95% !important;
        margin: 20px auto !important;
    }

    /* Stats cards mobile */
    .stats-grid {
        grid-template-columns: 1fr !important;
    }

    .stat-card {
        padding: 20px !important;
    }

    /* Footer mobile - Design amélioré */
    footer {
        padding: 40px 20px !important;
    }

    .footer-grid {
        grid-template-columns: 1fr !important;
        gap: 30px !important;
        text-align: left !important;
    }

    .footer-column {
        border-bottom: 1px solid rgba(255,255,255,0.1);
        padding-bottom: 20px;
    }

    .footer-column:last-child {
        border-bottom: none;
    }

    .footer-column h4 {
        font-size: 16px !important;
        margin-bottom: 15px !important;
        color: white;
    }

    .footer-column ul li {
        margin-bottom: 10px !important;
    }

    .footer-column a {
        font-size: 14px !important;
        display: inline-block;
        padding: 5px 0;
    }

    .footer-bottom {
        flex-direction: column !important;
        text-align: center !important;
        gap: 15px !important;
        padding-top: 30px !important;
    }

    .footer-social {
        justify-content: center !important;
        margin-top: 15px;
    }

    /* Contact rapide mobile */
    .mobile-quick-contact {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        padding: 20px;
        border-radius: 12px;
        margin: 20px 0;
        text-align: center;
        color: white;
    }

    .mobile-quick-contact h4 {
        margin-bottom: 15px;
        font-size: 18px;
    }

    .mobile-contact-buttons {
        display: flex;
        gap: 10px;
        justify-content: center;
        flex-wrap: wrap;
    }

    .mobile-contact-btn {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 10px 20px;
        background: rgba(255,255,255,0.2);
        border-radius: 8px;
        text-decoration: none;
        color: white;
        font-size: 14px;
        transition: all 0.3s;
    }

    .mobile-contact-btn:hover {
        background: rgba(255,255,255,0.3);
    }
}

/* ============================================
   MOBILE PETIT (< 480px)
   ============================================ */
@media (max-width: 480px) {
    .hero h1 {
        font-size: 28px !important;
    }

    .pricing-card {
        padding: 25px 20px !important;
    }

    .section-title {
        font-size: 24px !important;
    }

    .btn {
        width: 100%;
        display: block;
    }

    .header-actions {
        flex-direction: column !important;
        gap: 10px !important;
    }

    .header-actions .btn {
        width: 100%;
    }
}

/* ============================================
   CLASSES UTILITAIRES MOBILE
   ============================================ */
.hide-mobile {
    display: none !important;
}

@media (min-width: 769px) {
    .hide-desktop {
        display: none !important;
    }

    .show-mobile {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .show-mobile {
        display: block !important;
    }

    .hide-mobile {
        display: none !important;
    }
}

/* ============================================
   TOUCH OPTIMISATIONS
   ============================================ */
.is-mobile .no-hover:hover {
    /* Désactiver les effets hover sur mobile */
}

.is-mobile * {
    -webkit-tap-highlight-color: rgba(99, 102, 241, 0.1);
}

.is-mobile button,
.is-mobile a {
    touch-action: manipulation;
}

/* ============================================
   VIEWPORT HEIGHT FIX
   ============================================ */
@media (max-width: 768px) {
    .full-height {
        height: 100vh;
        height: calc(var(--vh, 1vh) * 100);
    }
}

/* ============================================
   SAFE AREA (iPhone X+)
   ============================================ */
@supports (padding: max(0px)) {
    .mobile-bottom-nav {
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }

    body {
        padding-bottom: max(70px, calc(70px + env(safe-area-inset-bottom)));
    }
}

/* ============================================
   LOADING SPINNER MOBILE
   ============================================ */
.mobile-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.mobile-loader.hidden {
    display: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color, #6366f1);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================
   PULL TO REFRESH
   ============================================ */
.pull-to-refresh {
    position: fixed;
    top: -50px;
    left: 0;
    right: 0;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    transition: top 0.3s;
    z-index: 99;
}

.pull-to-refresh.active {
    top: 0;
}

/* ============================================
   SWIPE INDICATORS
   ============================================ */
.swipe-indicator {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.swipe-indicator.left {
    left: 20px;
}

.swipe-indicator.right {
    right: 20px;
}

.swipe-indicator.active {
    opacity: 1;
}
