/* Correctifs Responsive Mobile - Portfolio Nathan Diegelmann */

/* Fix général pour éviter le débordement horizontal */
* {
    max-width: 100%;
    box-sizing: border-box;
}

html,
body {
    overflow-x: hidden;
    width: 100%;
}

/* Fix pour les images */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Fix pour les conteneurs principaux */
.container,
[class*="container-"] {
    width: 100%;
    max-width: 100%;
    padding-left: 1rem;
    padding-right: 1rem;
    box-sizing: border-box;
}

/* Fix bouton navigation flottant */
#floatingNavBtn {
    width: 50px !important;
    height: 50px !important;
}

#floatingNavMenu {
    min-width: 200px !important;
    max-width: calc(100vw - 40px) !important;
}

/* Tablettes (768px - 1024px) */
@media (max-width: 1024px) and (min-width: 769px) {
    .container {
        padding-left: 2rem;
        padding-right: 2rem;
    }

    /* Grilles 2 colonnes pour tablettes */
    [class*="grid"] {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1.5rem;
    }
}

/* Media Queries Mobile */
@media (max-width: 768px) {

    /* Espacements généraux */
    * {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    /* Hero section */
    .hero {
        padding: 3rem 1rem !important;
        min-height: auto !important;
    }

    .hero-content {
        max-width: 100%;
        padding: 1.5rem 1rem !important;
        text-align: center;
    }

    .hero-badge {
        font-size: 0.75rem !important;
        padding: 0.5rem 1rem !important;
    }

    /* Titres responsive */
    h1,
    .hero-title {
        font-size: clamp(2rem, 7vw, 3.5rem) !important;
        line-height: 1.2 !important;
        word-break: break-word;
        margin-bottom: 1rem !important;
    }

    h2 {
        font-size: clamp(1.5rem, 5vw, 2.5rem) !important;
        line-height: 1.3 !important;
        margin-bottom: 1rem !important;
    }

    h3 {
        font-size: clamp(1.2rem, 4vw, 2rem) !important;
    }

    p {
        font-size: 1rem;
        line-height: 1.6;
    }

    /* Stats hero */
    .hero-stats {
        flex-direction: column !important;
        gap: 1rem !important;
        width: 100%;
    }

    .stat {
        width: 100% !important;
        max-width: 300px;
        margin: 0 auto;
    }

    /* Grilles responsive */
    [class*="grid"]:not(.technologies-grid),
    [class*="-grid"]:not(.technologies-grid),
    .projects-grid,
    .skills-grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem;
    }

    /* Technologies grille - garder 4 colonnes */
    .technologies-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 0.75rem !important;
    }

    /* Cartes et conteneurs */
    .card,
    [class*="card"],
    .project-card,
    .skill-card {
        margin: 1rem 0;
        padding: 1.5rem;
    }

    /* Boutons */
    .btn,
    button,
    [class*="btn"] {
        width: 100%;
        max-width: 100%;
        margin: 0.75rem 0;
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }

    .btn-group {
        flex-direction: column !important;
        width: 100%;
    }

    /* Fix pour les barres de progression */
    .skill-bar,
    [class*="bar"] {
        width: 100%;
    }

    /* Navigation flottante mobile */
    #floatingNavBtn {
        top: 15px !important;
        right: 15px !important;
        width: 45px !important;
        height: 45px !important;
    }

    #floatingNavMenu {
        top: 70px !important;
        right: 15px !important;
        left: 15px !important;
        min-width: auto !important;
    }

    /* Sections */
    section {
        padding: 3rem 1rem !important;
    }

    /* Formulaires */
    .contact-form,
    form {
        padding: 1.5rem 1rem !important;
    }

    .form-row {
        flex-direction: column !important;
    }

    input,
    textarea,
    select {
        width: 100% !important;
        font-size: 16px !important;
    }

    /* Contact form - espacement mobile confortable */
    .contact-form-container {
        padding: 2rem 1.5rem !important;
        margin-bottom: 2rem !important;
    }

    .contact-form-title {
        font-size: 1.3rem !important;
        margin-bottom: 0.75rem !important;
    }

    .contact-form-subtitle {
        margin-bottom: 1.5rem !important;
    }

    #contactForm .form-group {
        margin-bottom: 1.5rem !important;
    }

    #contactForm .form-group label {
        margin-bottom: 0.75rem !important;
        font-size: 0.95rem !important;
    }

    #contactForm .form-group input,
    #contactForm .form-group textarea {
        padding: 0.875rem 1rem !important;
        font-size: 16px !important;
        min-height: 48px !important;
    }

    #contactForm .form-group textarea {
        min-height: 140px !important;
    }

    .form-row {
        gap: 0 !important;
    }

    .form-checkbox-group {
        margin-top: 0.5rem !important;
        margin-bottom: 1rem !important;
    }

    .checkbox-label {
        padding: 0.75rem 1rem !important;
        font-size: 0.85rem !important;
        line-height: 1.5 !important;
    }

    .form-submit-btn {
        width: 100% !important;
        padding: 1rem 1.5rem !important;
        min-height: 50px !important;
        margin-top: 1rem !important;
    }

    /* Contact cards */
    .contact-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
        margin-bottom: 2rem !important;
    }

    .contact-card {
        padding: 1.25rem !important;
        margin: 0 !important;
    }

    /* Alternance box */
    .alternance-box {
        padding: 1.5rem !important;
        margin-top: 1.5rem !important;
    }
}

@media (max-width: 480px) {

    /* Espacements réduits sur petits mobiles */
    section {
        padding: 2.5rem 0.75rem !important;
    }

    .hero {
        padding: 2rem 0.75rem !important;
    }

    .hero-content {
        padding: 1rem 0.75rem !important;
    }

    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    /* Titres encore plus petits */
    h1,
    .hero-title {
        font-size: clamp(1.75rem, 8vw, 2.5rem) !important;
    }

    h2 {
        font-size: clamp(1.4rem, 6vw, 2rem) !important;
    }

    h3 {
        font-size: clamp(1.1rem, 5vw, 1.5rem) !important;
    }

    /* Textes */
    p,
    .text,
    [class*="text"] {
        font-size: 0.95rem;
        line-height: 1.6;
    }

    /* Cards et spacing */
    .card,
    [class*="card"]:not(.contact-card):not(.contact-form-container),
    .project-card {
        padding: 1rem;
        margin: 0.75rem 0;
    }

    /* Fix pour les stats */
    .hero-stats {
        gap: 0.75rem 0.5rem !important;
    }

    .hero-content {
        padding: 0.75rem 0.5rem !important;
    }

    .container {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    h1,
    .hero-title {
        font-size: 1.5rem !important;
    }

    h2 {
        font-size: 1.25rem !important;
    }

    h3 {
        font-size: 1.1rem !important;
    }

    p {
        font-size: 0.875rem;
    }

    .card,
    [class*="card"]:not(.contact-card):not(.contact-form-container) {
        padding: 0.75rem;
        margin: 0.5rem 0;
    }

    .btn {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }

    /* Contact form - garder l'espacement confortable sur petit mobile */
    .contact-form-container {
        padding: 1.5rem 1.25rem !important;
    }

    .contact-card {
        padding: 1.25rem 1rem !important;
        margin: 0 !important;
    }

    #contactForm .form-group {
        margin-bottom: 1.25rem !important;
    }

    #contactForm .form-group input,
    #contactForm .form-group textarea {
        padding: 0.875rem 1rem !important;
    }

    .alternance-box {
        padding: 1.25rem 1rem !important;
    }
}

/* Grands écrans (Desktop) */
@media (min-width: 1441px) {
    .container {
        max-width: 1400px;
        margin: 0 auto;
    }

    section {
        padding: 5rem 2rem;
    }
}

/* Très grands écrans (4K et plus) */
@media (min-width: 2560px) {
    .container {
        max-width: 2000px;
    }

    h1 {
        font-size: 4.5rem !important;
    }

    h2 {
        font-size: 3.5rem !important;
    }

    p {
        font-size: 1.25rem;
    }
}

/* Petit mobile - navigation */
@media (max-width: 480px) {
    #floatingNavMenu {
        padding: 1rem !important;
    }

    .floating-nav-link {
        padding: 0.75rem 1rem !important;
        font-size: 0.9rem !important;
    }
}

@media (max-width: 360px) {

        /* Ultra petits écrans */
        section {
            padding: 2.5rem 0.25rem 1.5rem !important;
        }

        .hero-content {
            padding: 0.25rem !important;
        }

        h1 {
            font-size: 1.4rem !important;
        }

        h2 {
            font-size: 1.2rem !important;
        }

        h3 {
            font-size: 1.1rem !important;
        }

        p {
            font-size: 0.85rem;
        }

        .card,
        [class*="card"]:not(.contact-card):not(.contact-form-container) {
            padding: 0.5rem;
            margin: 0.5rem 0;
        }

        .contact-card {
            padding: 1rem !important;
            margin: 0 !important;
        }

        .contact-form-container {
            padding: 1.25rem 1rem !important;
        }
    }

/* Fix pour empêcher le zoom sur les inputs mobile */
@media (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    input[type="password"],
    textarea,
    select {
        font-size: 16px !important;
    }
}

/* Fix pour les tables responsive */
@media (max-width: 768px) {
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

/* Fix pour les vidéos et iframes */
.video-container,
iframe {
    max-width: 100%;
    height: auto;
}

/* Fix pour les formulaires */
@media (max-width: 768px) {
    form {
        width: 100%;
    }

    .form-group,
    .form-row {
        width: 100%;
    }

    .form-group {
        margin: 0.5rem 0;
    }

    #contactForm .form-group {
        margin-bottom: 1.5rem;
    }

    input,
    textarea,
    select {
        width: 100%;
        box-sizing: border-box;
    }
}