/* ========================================
   RESPONSIVE STYLES - MOBILE FIRST
   JEC-CI Application Publique
   ======================================== */

/* ========================================
   BASE - Mobile First (< 576px)
   ======================================== */

/* Conteneurs généraux */
.container,
.container-fluid {
    padding-left: 15px;
    padding-right: 15px;
}

/* Images responsives par défaut */
img {
    max-width: 100%;
    height: auto;
}

/* Cards */
.card {
    margin-bottom: 1.5rem;
}

.card-img,
.card-img-top {
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* Ratios d'images optimisés mobile */
.formation-card img,
.product-card img,
.blog-card img,
.testimonial-img-preview img {
    aspect-ratio: 16 / 9;
    object-fit: cover;
    width: 100%;
    height: auto;
}

/* Textes */
h1 {
    font-size: 1.75rem;
    line-height: 1.2;
}

h2 {
    font-size: 1.5rem;
    line-height: 1.3;
}

h3 {
    font-size: 1.25rem;
    line-height: 1.4;
}

h4 {
    font-size: 1.125rem;
}

h5 {
    font-size: 1rem;
}

p {
    font-size: 0.9375rem;
    line-height: 1.6;
}

/* Boutons */
.btn {
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    white-space: nowrap;
}

.btn-lg {
    font-size: 1rem;
    padding: 0.625rem 1.25rem;
}

.btn-sm {
    font-size: 0.8125rem;
    padding: 0.375rem 0.75rem;
}

/* Espacement */
.section-spacing {
    padding-top: 2rem;
    padding-bottom: 2rem;
}

/* Grilles */
.row {
    margin-left: -10px;
    margin-right: -10px;
}

.row > * {
    padding-left: 10px;
    padding-right: 10px;
}

/* Navigation mobile */
.navbar-toggler {
    border: none;
    padding: 0.5rem;
}

.navbar-collapse {
    background: #fff;
    padding: 1rem 0;
}

.navbar-nav .nav-link {
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
}

/* Header carousel mobile */
.header-carousel {
    min-height: 350px;
}

.header-carousel .carousel-caption {
    padding: 1rem;
}

.header-carousel .carousel-caption h1 {
    font-size: 1.5rem;
}

.header-carousel .carousel-caption p {
    font-size: 0.875rem;
    display: none; /* Masquer sur très petits écrans */
}

/* Cards de formation/produit */
.formation-card,
.product-card {
    margin-bottom: 1.5rem;
}

.formation-card .card-body,
.product-card .card-body {
    padding: 1rem;
}

.formation-card .card-title,
.product-card .card-title {
    font-size: 1.125rem;
    margin-bottom: 0.75rem;
}

/* Stats cards */
.stats-card {
    padding: 1.25rem !important;
    margin-bottom: 1rem;
    text-align: center;
}

.stats-card h3 {
    font-size: 1.75rem;
}

.stats-card i {
    font-size: 2rem;
}

/* Filtres latéraux */
.filter-section {
    margin-bottom: 2rem;
    position: static !important; /* Pas de sticky sur mobile */
}

/* Pagination */
.pagination {
    font-size: 0.875rem;
}

.pagination .page-link {
    padding: 0.5rem 0.75rem;
}

/* Tableaux responsifs */
.table-responsive {
    margin-bottom: 1rem;
}

table {
    font-size: 0.875rem;
}

/* Breadcrumbs */
.breadcrumb {
    font-size: 0.8125rem;
    padding: 0.75rem 0;
}

/* Back to top button */
.back-to-top {
    right: 20px;
    bottom: 20px;
    width: 40px;
    height: 40px;
}

/* Modals */
.modal-content {
    border-radius: 0.5rem;
}

.modal-body {
    padding: 1.25rem;
}

/* Forms */
.form-control,
.form-select {
    font-size: 0.9375rem;
    padding: 0.625rem 0.75rem;
}

.form-label {
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

/* Badges */
.badge {
    font-size: 0.75rem;
    padding: 0.35rem 0.65rem;
}

/* ========================================
   PETITS MOBILES (< 375px)
   ======================================== */
@media (max-width: 374.98px) {
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    .btn {
        font-size: 0.8125rem;
        padding: 0.45rem 0.875rem;
    }

    .header-carousel {
        min-height: 300px;
    }

    .stats-card h3 {
        font-size: 1.5rem;
    }
}

/* ========================================
   MOBILES (≥ 576px) - SM
   ======================================== */
@media (min-width: 576px) {
    .container {
        max-width: 540px;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.75rem;
    }

    h3 {
        font-size: 1.5rem;
    }

    .header-carousel {
        min-height: 400px;
    }

    .header-carousel .carousel-caption h1 {
        font-size: 1.75rem;
    }

    .header-carousel .carousel-caption p {
        display: block;
        font-size: 0.9375rem;
    }

    .section-spacing {
        padding-top: 2.5rem;
        padding-bottom: 2.5rem;
    }

    .stats-card {
        padding: 1.5rem !important;
    }

    .row {
        margin-left: -12px;
        margin-right: -12px;
    }

    .row > * {
        padding-left: 12px;
        padding-right: 12px;
    }
}

/* ========================================
   TABLETTES (≥ 768px) - MD
   ======================================== */
@media (min-width: 768px) {
    .container {
        max-width: 720px;
    }

    h1 {
        font-size: 2.5rem;
    }

    h2 {
        font-size: 2rem;
    }

    h3 {
        font-size: 1.75rem;
    }

    p {
        font-size: 1rem;
    }

    .btn {
        font-size: 0.9375rem;
        padding: 0.625rem 1.25rem;
    }

    .header-carousel {
        min-height: 500px;
    }

    .header-carousel .carousel-caption h1 {
        font-size: 2.5rem;
    }

    .header-carousel .carousel-caption p {
        font-size: 1rem;
    }

    .section-spacing {
        padding-top: 3rem;
        padding-bottom: 3rem;
    }

    /* Grilles tablette */
    .row {
        margin-left: -15px;
        margin-right: -15px;
    }

    .row > * {
        padding-left: 15px;
        padding-right: 15px;
    }

    /* Sidebar sticky sur tablette */
    .filter-section {
        position: sticky !important;
        top: 100px;
    }

    /* Cards */
    .formation-card .card-body,
    .product-card .card-body {
        padding: 1.25rem;
    }

    .formation-card .card-title,
    .product-card .card-title {
        font-size: 1.25rem;
    }

    /* Stats cards tablette */
    .stats-card {
        padding: 2rem !important;
    }

    .stats-card h3 {
        font-size: 2rem;
    }

    .stats-card i {
        font-size: 2.5rem;
    }

    /* Navigation */
    .navbar-nav .nav-link {
        font-size: 1rem;
    }

    /* Ratios d'images ajustés */
    .testimonial-img-preview {
        height: 250px;
    }
}

/* ========================================
   DESKTOP (≥ 992px) - LG
   ======================================== */
@media (min-width: 992px) {
    .container {
        max-width: 960px;
    }

    h1 {
        font-size: 3rem;
    }

    h2 {
        font-size: 2.25rem;
    }

    h3 {
        font-size: 1.875rem;
    }

    .header-carousel {
        min-height: 600px;
    }

    .header-carousel .carousel-caption h1 {
        font-size: 3rem;
    }

    .header-carousel .carousel-caption p {
        font-size: 1.125rem;
    }

    .section-spacing {
        padding-top: 4rem;
        padding-bottom: 4rem;
    }

    /* Cards desktop */
    .formation-card .card-body,
    .product-card .card-body {
        padding: 1.5rem;
    }

    .formation-card .card-title,
    .product-card .card-title {
        font-size: 1.5rem;
    }

    /* Stats cards desktop */
    .stats-card {
        padding: 2.5rem !important;
    }

    .stats-card h3 {
        font-size: 2.5rem;
    }

    .stats-card i {
        font-size: 3rem;
    }

    /* Back to top */
    .back-to-top {
        right: 45px;
        bottom: 45px;
        width: 48px;
        height: 48px;
    }

    /* Testimonial images */
    .testimonial-img-preview {
        height: 300px;
    }

    /* Sidebar */
    .filter-section {
        position: sticky !important;
        top: 100px;
    }
}

/* ========================================
   GRANDS ÉCRANS (≥ 1200px) - XL
   ======================================== */
@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }

    h1 {
        font-size: 3.5rem;
    }

    h2 {
        font-size: 2.5rem;
    }

    .header-carousel {
        min-height: 700px;
    }

    .header-carousel .carousel-caption h1 {
        font-size: 3.5rem;
    }

    .section-spacing {
        padding-top: 5rem;
        padding-bottom: 5rem;
    }
}

/* ========================================
   TRÈS GRANDS ÉCRANS (≥ 1400px) - XXL
   ======================================== */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }

    h1 {
        font-size: 4rem;
    }

    .header-carousel {
        min-height: 800px;
    }

    .header-carousel .carousel-caption h1 {
        font-size: 4rem;
    }
}

/* ========================================
   UTILITAIRES RESPONSIVE
   ======================================== */

/* Espacement responsive */
.py-mobile-3 {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
}

@media (min-width: 768px) {
    .py-mobile-3 {
        padding-top: 3rem !important;
        padding-bottom: 3rem !important;
    }
}

/* Texte responsive */
.text-truncate-mobile {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

@media (min-width: 768px) {
    .text-truncate-mobile {
        -webkit-line-clamp: 5;
    }
}

/* Images aspect ratio helpers */
.ratio-16x9 {
    aspect-ratio: 16 / 9;
}

.ratio-4x3 {
    aspect-ratio: 4 / 3;
}

.ratio-1x1 {
    aspect-ratio: 1 / 1;
}

/* Masquer/Afficher selon taille écran */
.hide-mobile {
    display: none;
}

@media (min-width: 768px) {
    .hide-mobile {
        display: block;
    }
}

.show-mobile {
    display: block;
}

@media (min-width: 768px) {
    .show-mobile {
        display: none;
    }
}

/* Alignement responsive */
.text-mobile-center {
    text-align: center;
}

@media (min-width: 768px) {
    .text-mobile-center {
        text-align: left;
    }
}
