/* 
 * Styles personnalisés pour le Centre de Santé Chenevière
 * Optimisé pour la performance
 */

/* ================================================
   OPTIMISATIONS PERFORMANCE
   ================================================ */

/* Optimisation du rendu des images */
img {
    content-visibility: auto;
}

/* Réduire les reflows avec des dimensions explicites */
img[width][height] {
    aspect-ratio: attr(width) / attr(height);
}

/* Placeholder pour les images en lazy loading */
img[loading="lazy"] {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

img[loading="lazy"].loaded {
    animation: none;
    background: none;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* Améliorer les performances de scroll */
.animate-on-scroll {
    will-change: transform, opacity;
}

/* Réduire la consommation mémoire après animation */
.fade-in {
    will-change: auto;
}

/* ================================================
   ANIMATIONS ET TRANSITIONS
   ================================================ */

/* Animation pour les transitions */
.transition-all {
    transition: all 0.3s ease;
}

/* Style pour les cartes avec effet hover */
.card-hover {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

/* Style pour les images avec effet zoom */
.image-zoom {
    transition: transform 0.3s ease;
}

.image-zoom:hover {
    transform: scale(1.05);
}

/* Animation pour le menu mobile */
.mobile-menu-enter {
    opacity: 0;
    transform: translateY(-10px);
}

.mobile-menu-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Style pour les boutons avec effet de pulsation */
.btn-pulse:hover {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(59, 130, 246, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
    }
}

/* Style pour les liens actifs */
.nav-link-active {
    color: #2563eb;
    border-bottom: 2px solid #2563eb;
}

/* Amélioration de la lisibilité */
.text-shadow {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Style pour les sections hero */
.hero-overlay {
    background: linear-gradient(135deg, rgba(30, 64, 175, 0.8) 0%, rgba(59, 130, 246, 0.6) 100%);
}

/* Mobile : texte non agrandi par le navigateur, pas de reflet gris au toucher */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

a,
button,
summary,
label {
    -webkit-tap-highlight-color: transparent;
}

/* iPhone zoome sur les champs dont le texte fait moins de 16 px */
@media (max-width: 639px) {
    input:not([type="checkbox"]):not([type="radio"]),
    select,
    textarea {
        font-size: 16px;
    }
}

/* Responsive design amélioré */
@media (max-width: 640px) {
    .hero-title {
        font-size: 2rem;
        line-height: 1.2;
    }

    .hero-subtitle {
        font-size: 1.125rem;
    }
}

/* Style pour les formulaires */
.form-input {
    border: 2px solid #e5e7eb;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}

/* Amélioration des icônes */
.icon-container {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
}

/* Animation de chargement */
.loading-spinner {
    border: 4px solid #f3f4f6;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Style pour les alertes */
.alert {
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.alert-success {
    background-color: #dbeafe;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

.alert-error {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
}

.alert-info {
    background-color: #dbeafe;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
}

/* Amélioration de l'accessibilité */
.focus-visible:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Style pour les badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
}

.badge-primary {
    background-color: #dbeafe;
    color: #1d4ed8;
}

.badge-success {
    background-color: #dbeafe;
    color: #1e40af;
}

/* Amélioration des ombres */
.shadow-soft {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.shadow-medium {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Animation d'apparition */
.fade-in {
    animation: fadeIn 0.6s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Style pour les dividers */
.divider {
    height: 1px;
    background: linear-gradient(to right, transparent, #e5e7eb, transparent);
}

/* Amélioration des listes */
.list-styled li::before {
    color: #3b82f6;
}

/* Ellipsis intelligentes pour les titres */
.title-ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.title-ellipsis-large {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    /* Limite à 2 lignes */
    -webkit-box-orient: vertical;
    line-height: 1.4;
    max-height: 2.8em;
    /* 2 lignes × line-height */
}

.list-styled li::before {
    font-weight: bold;
    display: inline-block;
    width: 1em;
    margin-left: -1em;
}

/* Aspect ratio utilities pour format 16:9 */
.aspect-w-16 {
    position: relative;
    padding-bottom: 56.25%;
    /* 9/16 = 0.5625 = 56.25% */
}

.aspect-w-16>img,
.aspect-w-16>video {
    position: absolute;
    height: 100%;
    width: 100%;
    top: 0;
    left: 0;
    object-fit: cover;
}

/* .aspect-h-9 fonctionne avec aspect-w-16, pas besoin de styles supp */

/* Styles spécifiques pour les cartes d'actualités */
@media (min-width: 768px) {
    .news-article .md\\:h-80 {
        min-height: 20rem;
        /* 320px - hauteur suffisante pour le contenu */
    }

    /* Assure que l'image garde de bonnes proportions même en pleine hauteur */
    .news-article img {
        min-height: 180px;
        /* Hauteur minimum pour maintenir un bon ratio */
    }
}
/* Listes défilantes horizontales (filtres, métiers) sans barre de défilement visible */
.no-scrollbar {
    scrollbar-width: none;
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}
