/* CSS Responsive pour le projet Assomption
   Amélioration de la responsivité sur tous les appareils */

/* Variables CSS pour la responsivité */
:root {
    --mobile-breakpoint: 576px;
    --tablet-breakpoint: 768px;
    --desktop-breakpoint: 992px;
    --large-desktop-breakpoint: 1200px;
    --container-padding-mobile: 1rem;
    --container-padding-tablet: 1.5rem;
    --container-padding-desktop: 2rem;
    --font-size-mobile: 0.9rem;
    --font-size-tablet: 1rem;
    --font-size-desktop: 1.1rem;
    
    /* Nouvelles variables pour meilleure adaptation */
    --base-font-size: 16px;
    --scale-factor-mobile: 0.9;
    --scale-factor-tablet: 0.95;
    --scale-factor-desktop: 1.0;
    --scale-factor-large: 1.05;
}

/* Reset et base responsive */
* {
    box-sizing: border-box;
}

html {
    font-size: var(--base-font-size);
    /* Amélioration de l'adaptation avec zoom à 80% */
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-size: var(--font-size-mobile);
    line-height: 1.6;
    overflow-x: hidden;
    /* Meilleure adaptation du texte */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    width: 100%;
}

/* Container responsive */
.container,
.container-fluid {
    padding-left: var(--container-padding-mobile);
    padding-right: var(--container-padding-mobile);
    width: 100%;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

/* Amélioration de l'adaptation des containers */
@media (min-width: 576px) {
    .container {
        max-width: 540px;
    }
}

@media (min-width: 768px) {
    .container {
        max-width: 720px;
    }
}

@media (min-width: 992px) {
    .container {
        max-width: 960px;
    }
}

@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
}

@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
}

/* Navigation responsive */
.navbar {
    padding: 0.5rem 1rem;
}

.navbar-brand {
    font-size: 1.25rem;
}

.navbar-nav .nav-link {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
}

.navbar-toggler {
    border: none;
    padding: 0.25rem 0.5rem;
}

.navbar-collapse {
    margin-top: 1rem;
}

/* Navigation mobile améliorée */
@media (max-width: 991.98px) {
    .navbar-nav {
        background: rgba(255, 255, 255, 0.95);
        border-radius: 0.5rem;
        padding: 1rem;
        margin-top: 0.5rem;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    }
    
    .navbar-nav .nav-link {
        color: #333 !important;
        padding: 0.75rem 1rem;
        border-radius: 0.25rem;
        margin: 0.25rem 0;
        transition: all 0.3s ease;
    }
    
    .navbar-nav .nav-link:hover {
        background-color: rgba(59, 130, 246, 0.1);
        color: #3b82f6 !important;
    }
    
    .navbar-nav .dropdown-menu {
        position: static !important;
        float: none;
        width: 100%;
        margin-top: 0.5rem;
        background-color: rgba(248, 249, 250, 0.95);
        border: none;
        box-shadow: none;
    }
}

/* Sidebar admin responsive */
@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: -250px;
        width: 250px;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s ease;
        background: var(--gradient-primary);
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    }
    
    .sidebar.show {
        left: 0;
    }
    
    .content-wrapper {
        margin-left: 0;
    }
    
    .main-header {
        margin-left: 0;
    }
    
    /* Overlay pour fermer la sidebar */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        display: none;
    }
    
    .sidebar-overlay.show {
        display: block;
    }
}

/* Grilles responsive */
.row {
    margin-left: -0.5rem;
    margin-right: -0.5rem;
}

.row > * {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

/* Cards responsive */
.card {
    margin-bottom: 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.card-body {
    padding: 1rem;
}

.card-header {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
}

/* Tables responsive */
.table-responsive {
    border-radius: 0.5rem;
    overflow: hidden;
}

.table {
    font-size: 0.9rem;
}

.table th,
.table td {
    padding: 0.5rem;
    vertical-align: middle;
}

/* Boutons responsive */
.btn {
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    transition: all 0.3s ease;
}

.btn-sm {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
}

.btn-lg {
    font-size: 1rem;
    padding: 0.75rem 1.5rem;
}

/* Formulaires responsive */
.form-control {
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
}

.form-label {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

/* Images responsive */
img {
    max-width: 100%;
    height: auto;
    display: block;
    visibility: visible !important;
}

.img-fluid {
    max-width: 100%;
    width: 100%;
    height: auto;
    display: block;
}

/* Images dans les cartes */
.card-img,
.card-img-top,
.card-img-bottom {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Images dans les galeries */
.gallery img,
.image-gallery img {
    max-width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

/* Thumbnails */
.thumbnail,
.img-thumbnail {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Hero sections responsive */
.hero-section {
    padding: 2rem 0;
    text-align: center;
}

.hero-section h1 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
}

.hero-section p {
    font-size: 1rem;
    margin-bottom: 1.5rem;
}

/* Sections responsive */
section {
    padding: 2rem 0;
}

.section-title {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    text-align: center;
}

/* Footer responsive */
.footer {
    padding: 2rem 0 1rem;
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

.footer h5 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

.footer p,
.footer li {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

/* Modales responsive */
.modal-dialog {
    margin: 1rem;
    max-width: calc(100% - 2rem);
}

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

.modal-header {
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
}

.modal-body {
    padding: 1rem;
}

.modal-footer {
    padding: 1rem;
    border-top: 1px solid #dee2e6;
}

/* Breakpoints spécifiques */

/* Mobile (jusqu'à 576px) */
@media (max-width: 575.98px) {
    :root {
        --container-padding-mobile: 0.75rem;
        --font-size-mobile: 0.9rem;
        --scale-factor-mobile: 0.9;
    }
    
    html {
        font-size: calc(var(--base-font-size) * var(--scale-factor-mobile));
    }
    
    .container,
    .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    body {
        font-size: 0.9rem;
    }
    
    h1, .h1 {
        font-size: 1.75rem;
        line-height: 1.3;
    }
    
    h2, .h2 {
        font-size: 1.5rem;
        line-height: 1.3;
    }
    
    h3, .h3 {
        font-size: 1.25rem;
        line-height: 1.4;
    }
    
    .hero-section h1 {
        font-size: 1.75rem !important;
        line-height: 1.2 !important;
    }
    
    .hero-section p {
        font-size: 0.95rem;
        line-height: 1.5;
    }
    
    .section-title {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .card-body {
        padding: 0.875rem;
    }
    
    .card-title {
        font-size: 1.1rem;
    }
    
    .card-text {
        font-size: 0.9rem;
        line-height: 1.5;
    }
    
    .btn {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
        min-height: 44px; /* Taille tactile optimale */
    }
    
    .btn-sm {
        font-size: 0.85rem;
        padding: 0.4rem 0.75rem;
        min-height: 36px;
    }
    
    .btn-lg {
        font-size: 1rem;
        padding: 0.75rem 1.5rem;
        min-height: 48px;
    }
    
    .navbar-brand {
        font-size: 1.15rem;
    }
    
    .navbar-nav .nav-link {
        font-size: 0.9rem;
        padding: 0.75rem 1rem;
    }
    
    .table {
        font-size: 0.85rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem 0.4rem;
    }
    
    /* Images sur mobile - taille adaptée mais visibles */
    img {
        max-width: 100%;
        height: auto;
        display: block !important;
        visibility: visible !important;
    }
    
    .card-img,
    .card-img-top {
        max-height: 250px;
        object-fit: cover;
        display: block !important;
    }
    
    /* Galeries sur mobile */
    .gallery img,
    .image-gallery img {
        max-height: 200px;
        object-fit: cover;
        margin-bottom: 0.5rem;
    }
    
    /* Hero images sur mobile */
    .hero-section img {
        max-height: 300px;
        width: 100%;
        object-fit: cover;
    }
    
    /* Amélioration des espacements */
    .py-5 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
    
    .py-4 {
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }
    
    .mb-5 {
        margin-bottom: 2rem !important;
    }
    
    .mb-4 {
        margin-bottom: 1.5rem !important;
    }
}

/* Tablet (576px à 767.98px) */
@media (min-width: 576px) and (max-width: 767.98px) {
    :root {
        --container-padding-tablet: 1.25rem;
        --font-size-tablet: 0.95rem;
        --scale-factor-tablet: 0.98;
    }
    
    html {
        font-size: calc(var(--base-font-size) * var(--scale-factor-tablet));
    }
    
    body {
        font-size: 0.95rem;
    }
    
    .container,
    .container-fluid {
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }
    
    h1, .h1 {
        font-size: 2.25rem;
    }
    
    h2, .h2 {
        font-size: 1.875rem;
    }
    
    h3, .h3 {
        font-size: 1.5rem;
    }
    
    .hero-section h1 {
        font-size: 2.25rem !important;
        line-height: 1.25 !important;
    }
    
    .hero-section p {
        font-size: 1.05rem;
    }
    
    .section-title {
        font-size: 1.875rem;
        margin-bottom: 1.25rem;
    }
    
    .card-body {
        padding: 1.25rem;
    }
    
    .card-title {
        font-size: 1.25rem;
    }
    
    .card-text {
        font-size: 0.95rem;
    }
    
    .btn {
        font-size: 0.95rem;
        padding: 0.55rem 1.1rem;
    }
    
    /* Images sur tablette */
    img {
        max-width: 100%;
        height: auto;
        display: block !important;
        visibility: visible !important;
    }
    
    .card-img,
    .card-img-top {
        max-height: 350px;
        object-fit: cover;
        display: block !important;
    }
    
    .gallery img,
    .image-gallery img {
        max-height: 300px;
        object-fit: cover;
    }
    
    .hero-section img {
        max-height: 400px;
        width: 100%;
        object-fit: cover;
    }
}

/* Desktop (768px à 991.98px) */
@media (min-width: 768px) and (max-width: 991.98px) {
    :root {
        --container-padding-desktop: 1.5rem;
        --font-size-desktop: 1rem;
        --scale-factor-desktop: 1.0;
    }
    
    html {
        font-size: calc(var(--base-font-size) * var(--scale-factor-desktop));
    }
    
    body {
        font-size: 1rem;
    }
    
    .container,
    .container-fluid {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
    
    h1, .h1 {
        font-size: 2.5rem;
    }
    
    h2, .h2 {
        font-size: 2rem;
    }
    
    h3, .h3 {
        font-size: 1.75rem;
    }
    
    .hero-section h1 {
        font-size: 2.5rem !important;
        line-height: 1.2 !important;
    }
    
    .hero-section p {
        font-size: 1.1rem;
    }
    
    .section-title {
        font-size: 2rem;
        margin-bottom: 1.5rem;
    }
    
    .card-body {
        padding: 1.5rem;
    }
    
    .card-title {
        font-size: 1.375rem;
    }
    
    .card-text {
        font-size: 1rem;
    }
    
    .btn {
        font-size: 1rem;
        padding: 0.6rem 1.2rem;
    }
    
    .navbar-nav .nav-link {
        font-size: 0.95rem;
    }
}

/* Large Desktop (992px et plus) */
@media (min-width: 992px) {
    :root {
        --scale-factor-desktop: 1.0;
    }
    
    html {
        font-size: calc(var(--base-font-size) * var(--scale-factor-desktop));
    }
    
    body {
        font-size: 1rem;
    }
    
    .container {
        max-width: 1140px;
    }
    
    h1, .h1 {
        font-size: 2.75rem;
    }
    
    h2, .h2 {
        font-size: 2.25rem;
    }
    
    h3, .h3 {
        font-size: 1.875rem;
    }
    
    .hero-section h1 {
        font-size: 3rem !important;
        line-height: 1.2 !important;
    }
    
    .hero-section p {
        font-size: 1.15rem;
    }
    
    .section-title {
        font-size: 2.25rem;
        margin-bottom: 1.75rem;
    }
    
    .card-body {
        padding: 2rem;
    }
    
    .card-title {
        font-size: 1.5rem;
    }
    
    .card-text {
        font-size: 1.05rem;
    }
    
    .btn {
        font-size: 1.05rem;
        padding: 0.7rem 1.5rem;
    }
    
    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }
}

/* Extra Large Desktop (1200px et plus) */
@media (min-width: 1200px) {
    :root {
        --scale-factor-large: 1.05;
    }
    
    html {
        font-size: calc(var(--base-font-size) * var(--scale-factor-large));
    }
    
    body {
        font-size: 1.05rem;
    }
    
    .container {
        max-width: 1320px;
    }
    
    h1, .h1 {
        font-size: 3.25rem;
    }
    
    h2, .h2 {
        font-size: 2.5rem;
    }
    
    h3, .h3 {
        font-size: 2rem;
    }
    
    .hero-section h1 {
        font-size: 3.5rem !important;
        line-height: 1.2 !important;
    }
    
    .hero-section p {
        font-size: 1.2rem;
    }
    
    .section-title {
        font-size: 2.5rem;
        margin-bottom: 2rem;
    }
    
    .card-body {
        padding: 2.25rem;
    }
    
    .card-title {
        font-size: 1.625rem;
    }
    
    .card-text {
        font-size: 1.1rem;
    }
    
    .btn {
        font-size: 1.1rem;
        padding: 0.75rem 1.75rem;
    }
}

/* Ultra Large Desktop (1400px et plus) */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
    
    .hero-section h1 {
        font-size: 4rem !important;
    }
    
    .section-title {
        font-size: 2.75rem;
    }
}

/* Améliorations spécifiques pour les composants */

/* Navigation sticky */
.navbar-sticky {
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
    background: rgba(59, 130, 246, 0.95);
}

/* Animations responsive */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Amélioration de l'accessibilité */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #1e40af;
        --secondary-color: #6b7280;
        --text-color: #111827;
        --border-color: #374151;
    }
    
    .btn-primary {
        background-color: var(--primary-color);
        border-color: var(--primary-color);
    }
    
    .card {
        border: 2px solid var(--border-color);
    }
}

/* Mode sombre */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #111827;
        --text-color: #f9fafb;
        --card-bg: #1f2937;
        --border-color: #374151;
    }
    
    body {
        background-color: var(--bg-color);
        color: var(--text-color);
    }
    
    .card {
        background-color: var(--card-bg);
        border-color: var(--border-color);
    }
    
    .navbar {
        background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
    }
}

/* Utilitaires responsive */
.d-mobile-none {
    display: none;
}

.d-mobile-block {
    display: block;
}

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

/* Espacement responsive */
.py-mobile-2 {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.py-mobile-3 {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.py-mobile-4 {
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
}

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

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

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

/* Grilles responsive améliorées */
.grid-responsive {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
}

@media (min-width: 576px) {
    .grid-responsive {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .grid-responsive {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 992px) {
    .grid-responsive {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Flexbox responsive */
.flex-responsive {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 768px) {
    .flex-responsive {
        flex-direction: row;
    }
}

/* Images responsive avec aspect ratio */
.img-responsive {
    width: 100%;
    height: auto;
    object-fit: cover;
}

.aspect-ratio-16-9 {
    aspect-ratio: 16 / 9;
}

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

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

/* Loading states responsive */
.loading-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Print styles */
@media print {
    .navbar,
    .footer,
    .btn,
    .sidebar {
        display: none !important;
    }
    
    .container {
        max-width: none !important;
        padding: 0 !important;
    }
    
    .card {
        border: 1px solid #000 !important;
        box-shadow: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
    
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
    }
    
    .page-break {
        page-break-before: always;
    }
}
