/* ============================================
   SICMI SARL - Mobile Optimizations
   ============================================ */

/* ============================================
   MOBILE-FIRST BASE STYLES
   ============================================ */

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Touch-friendly tap targets */
a, button, input, select, textarea {
    min-height: 44px;
    min-width: 44px;
}

/* Remove 300ms tap delay on mobile */
a, button, input, select, textarea {
    touch-action: manipulation;
}

/* ============================================
   MOBILE NAVIGATION
   ============================================ */

@media (max-width: 991.98px) {
    /* Navbar mobile amélioration */
    .navbar-collapse {
        max-height: 80vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        background: linear-gradient(135deg, #0056b3 0%, #003d82 100%);
        margin: 10px -12px;
        border-radius: 12px;
        padding: 20px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    }
    
    .navbar-nav .nav-link {
        padding: 14px 20px;
        margin: 5px 0;
        border-radius: 8px;
        font-size: 1.1rem;
        transition: all 0.3s ease;
    }
    
    .navbar-nav .nav-link:active {
        transform: scale(0.98);
        background: rgba(255, 255, 255, 0.15);
    }
    
    /* Menu burger animation */
    .navbar-toggler {
        border: none;
        padding: 10px;
        position: relative;
        width: 50px;
        height: 50px;
    }
    
    .navbar-toggler:focus {
        box-shadow: none;
        outline: 2px solid rgba(255, 255, 255, 0.3);
    }
    
    /* Dropdown mobile */
    .dropdown-menu {
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(10px);
        border: none;
        border-radius: 12px;
        box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
        margin-top: 10px;
    }
    
    .dropdown-item {
        padding: 12px 20px;
        font-size: 1rem;
    }
}

/* ============================================
   HERO SECTIONS MOBILE
   ============================================ */

@media (max-width: 768px) {
    .hero-section {
        min-height: 60vh !important;
        padding: 60px 0 40px !important;
    }
    
    .hero-section .display-1,
    .hero-section .display-2,
    .hero-section .display-3,
    .hero-section .display-4 {
        font-size: 2rem !important;
        line-height: 1.2;
    }
    
    .hero-section .lead {
        font-size: 1rem !important;
    }
    
    .hero-section h1 {
        font-size: 1.75rem !important;
    }
}

/* ============================================
   BUTTONS MOBILE
   ============================================ */

@media (max-width: 768px) {
    .btn {
        padding: 12px 24px;
        font-size: 1rem;
        border-radius: 8px;
    }
    
    .btn-lg {
        padding: 14px 28px;
        font-size: 1.1rem;
        width: 100%;
        margin-bottom: 10px;
    }
    
    .btn-group-mobile {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    
    .btn-group-mobile .btn {
        width: 100%;
    }
    
    /* Touch feedback */
    .btn:active {
        transform: scale(0.97);
    }
}

/* ============================================
   CARDS MOBILE
   ============================================ */

@media (max-width: 768px) {
    .card {
        margin-bottom: 20px;
        border-radius: 12px;
    }
    
    .card-img-top {
        height: 200px !important;
        object-fit: cover;
    }
    
    .card-body {
        padding: 1.25rem;
    }
    
    .card-title {
        font-size: 1.25rem;
    }
    
    /* Grid 1 colonne sur mobile */
    .row.g-4 > [class*="col-"] {
        padding-bottom: 1rem;
    }
}

/* ============================================
   FORMS MOBILE
   ============================================ */

@media (max-width: 768px) {
    .form-control,
    .form-select {
        padding: 14px 16px;
        font-size: 16px; /* Évite le zoom sur iOS */
        border-radius: 8px;
    }
    
    textarea.form-control {
        min-height: 120px;
    }
    
    .form-label {
        font-size: 1rem;
        margin-bottom: 8px;
        font-weight: 600;
    }
    
    /* Amélioration des inputs focus */
    .form-control:focus,
    .form-select:focus {
        box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.15);
        border-color: #0056b3;
    }
}

/* ============================================
   TABLES MOBILE (Responsive)
   ============================================ */

@media (max-width: 768px) {
    .table-responsive {
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    
    table {
        font-size: 0.9rem;
    }
    
    /* Table devient cards sur mobile */
    .table-mobile-cards thead {
        display: none;
    }
    
    .table-mobile-cards tbody,
    .table-mobile-cards tr {
        display: block;
        margin-bottom: 15px;
    }
    
    .table-mobile-cards tr {
        border: 1px solid #dee2e6;
        border-radius: 8px;
        padding: 15px;
        background: white;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    }
    
    .table-mobile-cards td {
        display: flex;
        justify-content: space-between;
        padding: 8px 0;
        border: none;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .table-mobile-cards td::before {
        content: attr(data-label);
        font-weight: bold;
        margin-right: 10px;
    }
    
    .table-mobile-cards td:last-child {
        border-bottom: none;
    }
}

/* ============================================
   TYPOGRAPHY MOBILE
   ============================================ */

@media (max-width: 768px) {
    h1, .h1 {
        font-size: 1.75rem;
    }
    
    h2, .h2 {
        font-size: 1.5rem;
    }
    
    h3, .h3 {
        font-size: 1.25rem;
    }
    
    h4, .h4 {
        font-size: 1.1rem;
    }
    
    h5, .h5 {
        font-size: 1rem;
    }
    
    p, .lead {
        font-size: 1rem;
        line-height: 1.6;
    }
    
    /* Meilleur espacement */
    .container {
        padding-left: 20px;
        padding-right: 20px;
    }
    
    section {
        padding: 40px 0 !important;
    }
}

/* ============================================
   IMAGES MOBILE
   ============================================ */

@media (max-width: 768px) {
    img {
        max-width: 100%;
        height: auto;
    }
    
    .img-fluid {
        border-radius: 8px;
    }
    
    /* Galeries d'images */
    .gallery-item {
        margin-bottom: 15px;
    }
    
    /* Optimisation des images de fond */
    [style*="background-image"] {
        background-size: cover !important;
        background-position: center !important;
        background-attachment: scroll !important; /* Évite les problèmes sur iOS */
    }
}

/* ============================================
   MODALS MOBILE
   ============================================ */

@media (max-width: 768px) {
    .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }
    
    .modal-content {
        border-radius: 16px;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1.25rem;
    }
    
    .modal-title {
        font-size: 1.25rem;
    }
}

/* ============================================
   FOOTER MOBILE
   ============================================ */

@media (max-width: 768px) {
    footer {
        text-align: center;
    }
    
    footer .row > [class*="col-"] {
        margin-bottom: 30px;
    }
    
    footer h5, footer h6 {
        font-size: 1.1rem;
        margin-bottom: 15px;
        color: #fff !important;
    }
    
    footer ul {
        padding-left: 0;
        list-style: none;
    }
    
    footer li {
        margin-bottom: 10px;
    }
    
    footer li a {
        display: inline-block;
        padding: 8px 15px;
        border-radius: 6px;
        transition: all 0.3s ease;
    }
    
    footer li a:hover {
        background: rgba(255, 255, 255, 0.1);
        transform: translateX(3px);
    }
    
    /* Améliorer la lisibilité des icônes */
    footer .social-links,
    footer .contact-icons {
        justify-content: center;
        gap: 8px;
        flex-wrap: wrap;
        margin: 15px 0;
    }
    
    /* Info de contact avec icônes */
    footer .d-flex {
        justify-content: center;
        margin-bottom: 12px;
    }
    
    footer .fa-map-marker-alt,
    footer .fa-phone-alt,
    footer .fa-envelope {
        min-width: 30px;
        font-size: 1.1rem;
    }
    
    /* Bouton CTA footer */
    footer .btn {
        width: 100%;
        max-width: 300px;
        margin: 15px auto 0;
        display: block;
        font-size: 1rem;
        padding: 12px 20px;
    }
    
    /* Copyright et mentions légales */
    footer .row.align-items-center > div {
        text-align: center !important;
        margin-bottom: 10px;
    }
    
    footer hr {
        margin: 2rem 0 !important;
        opacity: 0.2;
    }
}

/* ============================================
   SPACING UTILITIES MOBILE
   ============================================ */

@media (max-width: 768px) {
    .py-5 {
        padding-top: 3rem !important;
        padding-bottom: 3rem !important;
    }
    
    .my-5 {
        margin-top: 2.5rem !important;
        margin-bottom: 2.5rem !important;
    }
    
    .mb-5 {
        margin-bottom: 2rem !important;
    }
    
    .mt-5 {
        margin-top: 2rem !important;
    }
}

/* ============================================
   SCROLL OPTIMIZATIONS
   ============================================ */

@media (max-width: 768px) {
    /* Scroll to top button mobile */
    .scroll-to-top {
        width: 45px;
        height: 45px;
        bottom: 20px;
        right: 20px;
    }
    
    .scroll-to-top i {
        font-size: 1.2rem;
    }
    
    /* Améliorer le scroll momentum sur iOS */
    .modal-body,
    .navbar-collapse,
    .overflow-auto {
        -webkit-overflow-scrolling: touch;
    }
}

/* ============================================
   CHATBOT MOBILE
   ============================================ */

@media (max-width: 768px) {
    .chat-widget {
        bottom: 80px !important;
        right: 15px !important;
        width: calc(100% - 30px) !important;
        max-width: 350px;
    }
    
    .chat-messages {
        max-height: 300px !important;
    }
    
    .chat-toggle {
        width: 55px !important;
        height: 55px !important;
        bottom: 15px !important;
        right: 15px !important;
    }
}

/* ============================================
   STATISTICS / COUNTERS MOBILE
   ============================================ */

@media (max-width: 768px) {
    .counter {
        font-size: 2rem !important;
    }
    
    .stat-box {
        padding: 15px 20px !important;
        margin-bottom: 15px;
    }
    
    .trust-card,
    .trust-indicator {
        margin-bottom: 20px;
    }
}

/* ============================================
   TEAM MEMBERS MOBILE
   ============================================ */

@media (max-width: 768px) {
    .team-member-card {
        margin-bottom: 20px;
    }
    
    .team-member-card .card-img-top {
        height: 280px !important;
    }
}

/* ============================================
   ATELIERS & SERVICES MOBILE
   ============================================ */

@media (max-width: 768px) {
    .atelier-card,
    .service-card {
        margin-bottom: 20px;
    }
    
    .advantage-card {
        margin-bottom: 15px;
    }
}

/* ============================================
   BREADCRUMB MOBILE
   ============================================ */

@media (max-width: 768px) {
    .breadcrumb {
        font-size: 0.875rem;
        padding: 10px 15px;
        flex-wrap: wrap;
    }
    
    .breadcrumb-item + .breadcrumb-item::before {
        padding: 0 5px;
    }
}

/* ============================================
   ALERTS & NOTIFICATIONS MOBILE
   ============================================ */

@media (max-width: 768px) {
    .alert {
        font-size: 0.95rem;
        padding: 12px 15px;
        border-radius: 8px;
    }
}

/* ============================================
   TIMELINE MOBILE
   ============================================ */

@media (max-width: 768px) {
    .timeline::before {
        left: 20px !important;
    }
    
    .timeline-item {
        padding-left: 50px;
    }
    
    .timeline-item::before {
        left: 20px !important;
    }
    
    .timeline-year {
        position: relative;
        left: 0;
        margin-bottom: 10px;
    }
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */

@media (max-width: 768px) {
    /* Réduire les ombres sur mobile pour performance */
    .shadow-lg {
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15) !important;
    }
    
    /* Simplifier les animations sur mobile */
    .float,
    .pulse {
        animation-duration: 4s !important;
    }
    
    /* Désactiver parallax sur mobile */
    .parallax {
        background-attachment: scroll !important;
    }
}

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

@media (max-width: 768px) {
    /* Améliorer la lisibilité */
    *:focus {
        outline: 3px solid rgba(0, 86, 179, 0.5);
        outline-offset: 2px;
    }
    
    /* Skip to content link */
    .skip-to-content {
        position: absolute;
        top: -40px;
        left: 0;
        background: #0056b3;
        color: white;
        padding: 8px 16px;
        text-decoration: none;
        z-index: 10000;
    }
    
    .skip-to-content:focus {
        top: 0;
    }
}

/* ============================================
   LANDSCAPE MODE
   ============================================ */

@media (max-width: 768px) and (orientation: landscape) {
    .hero-section {
        min-height: 100vh !important;
    }
    
    .modal-dialog {
        margin: 5px;
    }
}

/* ============================================
   IPHONE X+ SAFE AREA
   ============================================ */

@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }
    
    .navbar {
        padding-left: max(15px, env(safe-area-inset-left));
        padding-right: max(15px, env(safe-area-inset-right));
    }
    
    .scroll-to-top {
        bottom: max(20px, env(safe-area-inset-bottom));
        right: max(20px, env(safe-area-inset-right));
    }
}

/* ============================================
   PREVENT TEXT SIZING ON IOS
   ============================================ */

@media (max-width: 768px) {
    html {
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }
}

/* ============================================
   SWIPE GESTURES FEEDBACK
   ============================================ */

@media (max-width: 768px) {
    .swipeable {
        touch-action: pan-y;
        user-select: none;
    }
    
    .swipeable:active {
        cursor: grabbing;
    }
}

/* ============================================
   LOADING STATES MOBILE
   ============================================ */

@media (max-width: 768px) {
    .loading-spinner {
        width: 40px;
        height: 40px;
    }
    
    .skeleton {
        animation-duration: 1.2s;
    }
}
