/* ==========================================================================
   Media Sport 235 - Responsive CSS
   ========================================================================== */

/* Variables pour les points de rupture */
:root {
    --breakpoint-xs: 0;
    --breakpoint-sm: 576px;
    --breakpoint-md: 768px;
    --breakpoint-lg: 992px;
    --breakpoint-xl: 1200px;
    --breakpoint-xxl: 1400px;
    
    /* Variables pour les transitions et animations */
    --transition-speed: 0.3s;
    --transition-speed-slow: 0.5s;
    --transition-speed-fast: 0.15s;
  }
  
  /* ==========================================================================
     Utilitaires Responsives
     ========================================================================== */
  
  /* Animation de chargement de page */
  .page-transition {
    animation: fadeInPage 0.8s ease-in-out;
  }
  
  @keyframes fadeInPage {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
  }
  
  /* Effet de parallaxe pour la section héro */
  @media (min-width: 992px) {
    .hero-section {
      background-attachment: fixed;
    }
  }
  
  /* ==========================================================================
     Adaptations Globales
     ========================================================================== */
  
  /* Ajustements de base pour tous les appareils */
  html {
    scroll-behavior: smooth;
  }
  
  /* Scrollbar personnalisée */
  ::-webkit-scrollbar {
    width: 8px;
  }
  
  ::-webkit-scrollbar-track {
    background: var(--light-gray);
  }
  
  ::-webkit-scrollbar-thumb {
    background: var(--primary-blue);
    border-radius: 4px;
  }
  
  ::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-blue);
  }
  
  /* ==========================================================================
     Extra Large Screens (1400px et plus)
     ========================================================================== */
  @media (min-width: 1400px) {
    .container {
      max-width: 1320px;
    }
    
    .hero-section {
      height: 600px;
    }
    
    .hero-title {
      font-size: 4rem;
    }
    
    .hero-subtitle {
      font-size: 1.8rem;
    }
    
    /* Mise en page à 3 colonnes pour les actualités */
    .col-xxl-4 {
      width: 33.333333%;
    }
    
    /* Afficher plus d'éléments dans les grandes résolutions */
    .extra-content {
      display: block;
    }
  }
  
  /* ==========================================================================
     Large Screens (992px à 1399px)
     ========================================================================== */
  @media (min-width: 992px) and (max-width: 1399px) {
    .hero-section {
      height: 500px;
    }
    
    .hero-title {
      font-size: 3.5rem;
    }
    
    /* Ajustements du menu */
    .navbar .nav-link {
      padding: 0.8rem 0.9rem !important;
    }
    
    /* Animation du hover pour les cartes d'actualités */
    .news-card:hover {
      transform: translateY(-10px) scale(1.02);
      transition: transform var(--transition-speed) ease;
    }
    
    /* Afficher la mini-navigation sticky */
    .mini-nav {
      display: block;
    }
  }
  
  /* ==========================================================================
     Medium Screens - Tablettes (768px à 991px)
     ========================================================================== */
  @media (min-width: 768px) and (max-width: 991px) {
    .hero-section {
      height: 400px;
    }
    
    .hero-title {
      font-size: 2.8rem;
    }
    
    .hero-subtitle {
      font-size: 1.4rem;
    }
    
    /* Ajustements spécifiques pour les tablettes */
    .interview-card {
      flex-direction: row;
    }
    
    .interview-img {
      flex: 0 0 180px;
    }
    
    /* Adaptation des cartes pour tablettes */
    .news-card .card-title {
      font-size: 1.1rem;
    }
    
    /* Adaptations pour le ticker de nouvelles */
    .ticker-wrap {
      height: 1.8rem;
    }
    
    .breaking-news-label {
      font-size: 0.7rem;
    }
    
    /* Grille adaptative pour les actualités */
    .tablet-half {
      width: 50%;
    }
    
    /* Barre de navigation sticky réduite */
    .navbar.scrolled {
      padding: 0.3rem 1rem;
    }
    
    .navbar.scrolled .navbar-brand {
      font-size: 1.3rem;
    }
  }
  
  /* ==========================================================================
     Small Screens - Smartphones (576px à 767px)
     ========================================================================== */
  @media (min-width: 576px) and (max-width: 767px) {
    .hero-section {
      height: 350px;
    }
    
    .hero-title {
      font-size: 2.2rem;
    }
    
    .hero-subtitle {
      font-size: 1.1rem;
      margin-bottom: 1.5rem;
    }
    
    /* Adaptations pour mobiles */
    .news-card {
      margin-bottom: 20px;
    }
    
    .interview-card {
      flex-direction: column;
    }
    
    .interview-img {
      height: 200px;
      width: 100%;
    }
    
    /* Modification du menu pour mobiles */
    .navbar-collapse {
      background-color: var(--primary-blue);
      padding: 1rem;
      border-radius: 0 0 10px 10px;
      box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    }
    
    .dropdown-menu {
      border: none;
      background-color: rgba(255, 255, 255, 0.1);
      padding-left: 1rem;
    }
    
    .dropdown-item {
      color: white;
    }
    
    /* Gestionnaire de contenu optimisé pour mobile */
    .mobile-scroll-container {
      display: flex;
      overflow-x: auto;
      padding-bottom: 1rem;
      scroll-snap-type: x mandatory;
      -webkit-overflow-scrolling: touch;
    }
    
    .mobile-scroll-item {
      flex: 0 0 85%;
      scroll-snap-align: start;
      margin-right: 15px;
    }
    
    /* Cacher certains éléments sur mobile */
    .d-sm-none {
      display: none !important;
    }
  }
  
  /* ==========================================================================
     Extra Small Screens - Petits Smartphones (moins de 576px)
     ========================================================================== */
  @media (max-width: 575px) {
    .hero-section {
      height: 300px;
    }
    
    .hero-title {
      font-size: 1.8rem;
    }
    
    .hero-subtitle {
      font-size: 1rem;
      margin-bottom: 1.2rem;
    }
    
    /* Mini-ticker pour petit écran */
    .breaking-news {
      padding: 5px 0;
    }
    
    .breaking-news-label {
      font-size: 0.6rem;
      padding: 2px 6px;
      margin-right: 8px;
    }
    
    .ticker-wrap {
      height: 1.5rem;
    }
    
    .ticker-item {
      padding: 0 1rem;
      font-size: 0.8rem;
    }
    
    /* Adaptation extreme pour les petits écrans */
    .section-title {
      font-size: 1.5rem;
      margin-bottom: 1.5rem;
    }
    
    .news-card .card-body {
      padding: 1rem;
    }
    
    .news-card .card-title {
      font-size: 1rem;
    }
    
    .news-meta {
      font-size: 0.7rem;
    }
    
    /* Format compact pour les articles */
    .compact-news {
      display: flex;
      margin-bottom: 1rem;
      border-bottom: 1px solid #e9ecef;
      padding-bottom: 1rem;
    }
    
    .compact-news-img {
      width: 80px;
      height: 80px;
      object-fit: cover;
      margin-right: 10px;
      border-radius: 5px;
    }
    
    .compact-news-content h4 {
      font-size: 0.9rem;
      margin-bottom: 0.3rem;
    }
    
    .compact-news-content .news-meta {
      font-size: 0.65rem;
    }
    
    /* Affichage du footer en mode compacté */
    .footer {
      padding: 30px 0 10px;
    }
    
    .footer-title {
      font-size: 1.1rem;
      margin-bottom: 15px;
    }
    
    /* Menus hamburger améliorés */
    .navbar-toggler {
      border: none;
      padding: 0.5rem;
    }
    
    .navbar-toggler:focus {
      box-shadow: none;
    }
  }
  
  /* ==========================================================================
     Fonctionnalités avancées et innovantes
     ========================================================================== */
  
  /* Mode sombre / Mode clair */
  @media (prefers-color-scheme: dark) {
    .dark-mode-auto {
      --primary-blue: #1a56b0;
      --secondary-blue: #3373d9;
      --primary-red: #d93636;
      --dark-gray: #121212;
      --light-gray: #2a2a2a;
      
      background-color: #121212;
      color: #e0e0e0;
    }
    
    .dark-mode-auto .card,
    .dark-mode-auto .sidebar,
    .dark-mode-auto .navbar-collapse {
      background-color: #1e1e1e;
    }
    
    .dark-mode-auto .card-text,
    .dark-mode-auto p {
      color: #b0b0b0;
    }
  }
  
  /* Support pour les appareils à encoche ou poinçon */
  @supports (padding: max(0px)) {
    .hero-section,
    .navbar {
      padding-left: max(1rem, env(safe-area-inset-left));
      padding-right: max(1rem, env(safe-area-inset-right));
    }
    
    .navbar {
      padding-top: max(0.5rem, env(safe-area-inset-top));
    }
    
    .footer {
      padding-bottom: max(20px, env(safe-area-inset-bottom));
    }
  }
  
  /* Animations et transitions créatives */
  .animated-entrance {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
  }
  
  .animated-entrance.visible {
    opacity: 1;
    transform: translateY(0);
  }
  
  .stagger-item {
    opacity: 0;
    transform: translateY(15px);
    transition: all 0.5s ease;
  }
  
  .stagger-item.visible:nth-child(1) { transition-delay: 0.1s; }
  .stagger-item.visible:nth-child(2) { transition-delay: 0.2s; }
  .stagger-item.visible:nth-child(3) { transition-delay: 0.3s; }
  .stagger-item.visible:nth-child(4) { transition-delay: 0.4s; }
  
  .stagger-item.visible {
    opacity: 1;
    transform: translateY(0);
  }
  
  /* Effet de blur pour les cartes lors du défilement */
  @media (min-width: 992px) {
    .blur-scroll-effect {
      transition: filter 0.3s ease;
    }
    
    .blur-scroll-effect.scrolling {
      filter: blur(2px);
    }
  }
  
  /* Navigation sticky innovante */
  .mini-nav {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--primary-blue);
    border-radius: 50px;
    padding: 8px 20px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    display: none;
    transition: all 0.3s ease;
  }
  
  .mini-nav:hover {
    padding: 8px 30px;
  }
  
  .mini-nav ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
  }
  
  .mini-nav li {
    margin: 0 15px;
  }
  
  .mini-nav a {
    color: white;
    font-size: 1.2rem;
  }
  
  .mini-nav a:hover {
    color: var(--accent-yellow);
  }
  
  /* Animation du menu hamburger */
  .navbar-toggler-icon {
    transition: transform 0.3s ease;
  }
  
  .navbar-toggler[aria-expanded="true"] .navbar-toggler-icon {
    transform: rotate(90deg);
  }
  
  /* Overlay de recherche */
  .search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 61, 165, 0.95);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-in-out;
  }
  
  .search-container {
    width: 80%;
    max-width: 600px;
    position: relative;
  }
  
  .search-overlay .form-control {
    height: 60px;
    font-size: 1.2rem;
    border-radius: 30px;
    padding-left: 25px;
    padding-right: 70px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  }
  
  .search-overlay .btn {
    position: absolute;
    right: 8px;
    top: 8px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
  }
  
  #closeSearch {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
  }
  
  @keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
  }
  
  /* Barre de progression de lecture */
  .reading-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background-color: var(--accent-yellow);
    z-index: 9999;
    transition: width 0.1s ease;
  }
  
  /* Ajout d'un bouton retour en haut */
  .back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: var(--primary-blue);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 999;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  }
  
  .back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }
  
  .back-to-top:hover {
    background-color: var(--primary-red);
    transform: translateY(-5px);
  }
  
  /* Support pour les appareils pliables et à double écran */
  @media (screen-spanning: single-fold-vertical) {
    .fold-aware {
      display: grid;
      grid-template-columns: 1fr env(fold-width) 1fr;
    }
    
    .span-fold {
      grid-column: 1 / 4;
    }
    
    .before-fold {
      grid-column: 1;
    }
    
    .after-fold {
      grid-column: 3;
    }
  }
  
  /* Adaptation pour l'impression */
  @media print {
    .no-print {
      display: none !important;
    }
    
    body {
      background-color: white !important;
      color: black !important;
    }
    
    .container {
      width: 100% !important;
      max-width: 100% !important;
    }
    
    .news-card,
    .interview-card {
      break-inside: avoid;
      page-break-inside: avoid;
      box-shadow: none !important;
      border: 1px solid #ddd;
    }
    
    a {
      color: black !important;
      text-decoration: none !important;
    }
    
    img {
      max-width: 100% !important;
      height: auto !important;
    }
    
    .news-meta:after {
      content: " - Media Sport 235";
    }
  }
  
  /* Préchargement de contenu */
  .preload-trigger {
    position: relative;
  }
  
  .preload-content {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
  }
  
  /* Transitions de page */
  .page-transition-wrapper {
    position: relative;
    overflow: hidden;
  }
  
  .page-transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--primary-blue);
    z-index: 9999;
    transform: translateY(100%);
    transition: transform 0.5s ease-in-out;
  }
  
  .page-transition-overlay.active {
    transform: translateY(0);
  }
  
  /* Adaptations pour les écrans très larges et ultrawide */
  @media (min-width: 1920px) {
    .container {
      max-width: 1600px;
    }
    
    .ultrawide-content {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
      gap: 30px;
    }
    
    /* Contenu supplémentaire pour grands écrans */
    .xl-only {
      display: block;
    }
  }
  
  /* Support des actions tactiles avancées */
  @media (pointer: coarse) {
    .touch-slider {
      touch-action: pan-y;
    }
    
    .touch-feedback {
      transition: transform 0.1s ease;
    }
    
    .touch-feedback:active {
      transform: scale(0.98);
    }
  }
  
  /* Améliorations pour les notifications et alertes */
  .notification-badge {
    position: relative;
  }
  
  .notification-badge::after {
    content: attr(data-count);
    position: absolute;
    top: -8px;
    right: -8px;
    min-width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    border-radius: 10px;
    background-color: var(--primary-red);
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
  }
  
  /* Animation spéciale pour le logo */
  @media (min-width: 992px) {
    .navbar-brand {
      position: relative;
      z-index: 1;
    }
    
    .navbar-brand::before {
      content: '';
      position: absolute;
      bottom: -5px;
      left: 0;
      width: 0;
      height: 2px;
      background-color: var(--accent-yellow);
      transition: width 0.3s ease;
      z-index: -1;
    }
    
    .navbar-brand:hover::before {
      width: 100%;
    }
    
    .navbar-brand span {
      display: inline-block;
      transition: transform 0.3s ease;
    }
    
    .navbar-brand:hover span {
      transform: scale(1.1);
    }
  }