/**
 * Kaptmedia - Styles responsive globaux pour mobile et tablette
 * Appliqués à toutes les pages du site public
 */

/* ===== BASE & CONTAINERS ===== */
html {
    overflow-x: hidden;
}
body {
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.main-content-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    padding-bottom: clamp(1.25rem, 3vw, 2.5rem);
}

/* .container : ne pas forcer 100 % — Bootstrap applique des max-width par breakpoint (lecture confortable). */
.container-fluid {
    max-width: 100%;
}

.container,
.container-fluid {
    padding-left: clamp(0.75rem, 2.8vw, 1.5rem);
    padding-right: clamp(0.75rem, 2.8vw, 1.5rem);
}

@media (max-width: 576px) {
    .container,
    .container-fluid {
        padding-left: clamp(0.625rem, 4vw, 1rem);
        padding-right: clamp(0.625rem, 4vw, 1rem);
    }
}

/* En-tête de page (layout app) — retrouver une largeur utile type Tailwind 7xl */
.max-w-7xl {
    width: 100%;
    max-width: min(80rem, 100%);
    margin-left: auto;
    margin-right: auto;
    padding-left: clamp(0.75rem, 2.8vw, 1.5rem);
    padding-right: clamp(0.75rem, 2.8vw, 1.5rem);
    box-sizing: border-box;
}
@media (max-width: 576px) {
    .max-w-7xl {
        padding-left: clamp(0.625rem, 4vw, 1rem);
        padding-right: clamp(0.625rem, 4vw, 1rem);
    }
}

/* Largeur éditoriale : nav, colonnes et footer sur la même colonne (layouts publics avec .min-h-screen) */
:root {
    --site-content-max: 1200px;
}

@media (min-width: 1200px) {
    .min-h-screen .container {
        max-width: min(1140px, calc(100vw - 2.5rem));
    }
}

@media (min-width: 1400px) {
    .min-h-screen .container {
        max-width: min(var(--site-content-max), calc(100vw - 3rem));
    }
}

.min-h-screen .footer-minimal-container {
    max-width: min(var(--site-content-max), calc(100vw - 2rem));
    margin-left: auto;
    margin-right: auto;
}

/* Accueil : espacement entre flux principal et sidebar */
.home-main-row {
    --bs-gutter-x: 1.25rem;
    --bs-gutter-y: 1.25rem;
}

@media (min-width: 768px) {
    .home-main-row {
        --bs-gutter-x: 1.75rem;
        --bs-gutter-y: 1.5rem;
    }
}

@media (min-width: 992px) {
    .home-main-row {
        --bs-gutter-x: 2rem;
        --bs-gutter-y: 1.75rem;
    }
}

/* ===== FOOTER MINIMAL (renfort responsive si thème non chargé) ===== */
@media (max-width: 768px) {
    .modern-footer.modern-footer-minimal {
        padding: 1.5rem 0 1.25rem !important;
    }
    .footer-minimal-container {
        padding: 0 0.75rem;
    }
    .footer-minimal-inner {
        flex-direction: column;
        align-items: flex-start;
        padding-bottom: 1rem;
        gap: 1rem;
    }
    .footer-minimal-logo img {
        height: 36px;
    }
    .footer-minimal-nav {
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 0.5rem 1rem;
    }
    .footer-minimal-nav a {
        font-size: 0.8125rem;
    }
    .footer-minimal-bottom {
        flex-direction: column;
        align-items: flex-start;
        padding-top: 0.75rem;
        gap: 0.5rem;
    }
    .footer-minimal-copy,
    .footer-minimal-powered {
        font-size: 0.6875rem;
    }
}

@media (max-width: 480px) {
    .footer-minimal-nav a {
        font-size: 0.75rem;
    }
}

/* ===== PUBLICITÉ & BANNIÈRES ===== */
.advertisement-slot img,
.ad-space-card,
.ad-space-card-body {
    max-width: 100%;
    height: auto;
}

@media (max-width: 768px) {
    .advertisement-slot[data-slot="728x90"],
    .advertisement-slot[data-slot="970x250"] {
        max-width: 100%;
        overflow: hidden;
    }
}

/* ===== PAGES : ACCUEIL ===== */
@media (max-width: 768px) {
    .container.mt-4 {
        margin-top: 1rem !important;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    .category-row .category-articles,
    .economy-layout,
    .category-articles .row {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .categories-list {
        margin-left: -0.75rem;
        margin-right: -0.75rem;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}

/* ===== PAGES : ARTICLES INDEX ===== */
@media (max-width: 768px) {
    .articles-main-section {
        margin-top: 1rem !important;
    }
    .articles-filters .d-flex {
        flex-direction: column;
        align-items: stretch !important;
        gap: 0.75rem;
    }
    .articles-filters .form-select {
        width: 100% !important;
    }
}

/* ===== PAGES : ARTICLE SHOW ===== */
@media (max-width: 768px) {
    .article-show-page {
        padding: 1rem 0;
    }
    .article-show-page .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    .content-wrapper.article-body-format {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .content-wrapper.article-body-format img {
        max-width: 100%;
        height: auto;
    }
    .comment-item .ms-5 {
        margin-left: 1rem !important;
    }
}

/* ===== PAGES : KIOSQUE ===== */
.kiosque-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}
@media (max-width: 768px) {
    .kiosque-hero-section .display-4 {
        font-size: 1.75rem;
    }
    .kiosque-hero-section .lead {
        font-size: 1rem !important;
    }
    .kiosque-filters .col-md-9,
    .kiosque-filters .col-md-3 {
        max-width: 100%;
        flex: 0 0 100%;
    }
    .kiosque-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .kiosque-card {
        min-width: 0;
    }
    .kiosque-actions {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .kiosque-actions .btn {
        flex: 1 1 auto;
        min-width: 120px;
    }
}
@media (max-width: 480px) {
    .kiosque-hero-section .display-4 {
        font-size: 1.5rem;
    }
}

/* ===== PAGES : CATÉGORIES INDEX ===== */
.categories-overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}
@media (max-width: 768px) {
    .categories-overview-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .page-header .page-title {
        font-size: 1.75rem;
    }
}
@media (max-width: 576px) {
    .article-preview-item {
        flex-direction: column;
        text-align: center;
    }
    .article-preview-image {
        margin: 0 auto;
    }
}

/* ===== PAGES : AUTEURS ===== */
@media (max-width: 768px) {
    .authors-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .authors-hero-section .display-4 {
        font-size: 1.75rem;
    }
    .authors-hero-section .lead {
        font-size: 1rem !important;
    }
    .author-card {
        padding: 1.25rem;
    }
}
@media (max-width: 480px) {
    .authors-hero-section .display-4 {
        font-size: 1.5rem;
    }
}

/* ===== SIDEBAR ARTICLE (col-lg-4) ===== */
@media (max-width: 991px) {
    .sidebar-sticky {
        position: static;
        top: auto;
    }
}

/* ===== FORMULAIRES & BOUTONS ===== */
@media (max-width: 576px) {
    .btn {
        white-space: normal;
        text-align: center;
    }
    .form-control,
    .form-select {
        font-size: 16px; /* évite zoom iOS sur focus */
    }
}

/* ===== MODALS ===== */
@media (max-width: 576px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    .modal-fullscreen-sm-down .modal-dialog {
        margin: 0;
        max-width: 100%;
    }
}

/* ===== TABLES (admin / listes) ===== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
@media (max-width: 768px) {
    .table {
        font-size: 0.875rem;
    }
}

/* ===== PAGINATION ===== */
.pagination-wrapper {
    flex-wrap: wrap;
    justify-content: center;
}
.pagination {
    flex-wrap: wrap;
    gap: 0.25rem;
}

/* ===== RÉGIONS SHOW / SHOW-ALL ===== */
@media (max-width: 768px) {
    .region-articles-grid,
    .regions-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== PAGES STATIQUES (Contact, Privacy, Terms, About) ===== */
@media (max-width: 768px) {
    .pages-static .container,
    .contact-main-section .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    .pages-static h1 {
        font-size: 1.75rem;
    }
    .contact-directory-card,
    .contact-person-card {
        padding: 1rem;
    }
}

/* ===== PROFIL UTILISATEUR ===== */
@media (max-width: 991px) {
    .container.mt-4[style*="margin-top: 130px"] {
        margin-top: 1rem !important;
    }
}
@media (max-width: 768px) {
    .profile-sidebar {
        margin-bottom: 1rem;
    }
}

/* ===== UTILITIES GÉNÉRALES ===== */
@media (max-width: 576px) {
    .d-flex.gap-3 {
        gap: 0.75rem !important;
    }
    .py-5 {
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }
    .mt-5.pt-3 {
        margin-top: 1rem !important;
        padding-top: 0.75rem !important;
    }
}

.max-width-600 {
    max-width: 100%;
}
@media (min-width: 577px) {
    .max-width-600 {
        max-width: 600px;
    }
}

/* Images responsives partout */
img {
    max-width: 100%;
    height: auto;
}

/* Éviter les débordements de texte */
h1, h2, h3, h4, h5, h6 {
    word-wrap: break-word;
}
