/* responsive.css - Styles responsives améliorés pour mobile et tablette */

/* Variables pour les breakpoints */
:root {
  --tablet-breakpoint: 992px;
  --mobile-breakpoint: 768px;
}

/* Styles par défaut (desktop) */
.mobile-menu-toggle {
  display: none;
}

.mobile-menu-overlay {
  display: none;
}

/* Style pour le menu hamburger */
.hamburger-icon {
  width: 30px;
  height: 20px;
  position: relative;
  transform: rotate(0deg);
  transition: .5s ease-in-out;
  cursor: pointer;
}

.hamburger-icon span {
  display: block;
  position: absolute;
  height: 3px;
  width: 100%;
  background: var(--text-light);
  border-radius: 9px;
  opacity: 1;
  left: 0;
  transform: rotate(0deg);
  transition: .25s ease-in-out;
}

.hamburger-icon span:nth-child(1) {
  top: 0px;
}

.hamburger-icon span:nth-child(2), .hamburger-icon span:nth-child(3) {
  top: 10px;
}

.hamburger-icon span:nth-child(4) {
  top: 20px;
}

.sidebar.expanded .hamburger-icon span:nth-child(1) {
  top: 10px;
  width: 0%;
  left: 50%;
}

.sidebar.expanded .hamburger-icon span:nth-child(2) {
  transform: rotate(45deg);
}

.sidebar.expanded .hamburger-icon span:nth-child(3) {
  transform: rotate(-45deg);
}

.sidebar.expanded .hamburger-icon span:nth-child(4) {
  top: 10px;
  width: 0%;
  left: 50%;
}

/* Styles pour tablette (≤ 992px) */
@media (max-width: 992px) {
  body {
    flex-direction: column;
  }
  
  /* ===== SIDEBAR MOBILE - STRUCTURE CORRIGÉE ===== */
  .sidebar {
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    padding: 0;
    display: flex;
    flex-direction: column; /* Disposition en colonne */
    height: auto;
    min-height: 60px;
    background-color: var(--sidebar-dark);
  }

  /* Header de la sidebar (logo + hamburger) */
  .sidebar > .logo,
  .sidebar > .mobile-menu-toggle {
    flex-shrink: 0;
  }

  /* Container du header sidebar */
  .sidebar::before {
    content: none;
  }

  /* Logo à gauche */
  .logo {
    position: absolute;
    top: 0;
    left: 0;
    padding: 0 15px;
    border-bottom: none;
    margin-bottom: 0;
    height: 60px;
    display: flex;
    align-items: center;
    z-index: 2;
  }
  
  .logo h1 {
    font-size: 1rem;
  }

  .logo img {
    max-width: 120px;
  }

  /* Bouton hamburger à droite */
  .mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0;
    right: 0;
    height: 60px;
    width: 60px;
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    z-index: 2;
  }

  /* Spacer pour le header */
  .sidebar {
    padding-top: 60px; /* Espace pour le header fixe */
  }

  /* Quand fermé, masquer la hauteur supplémentaire */
  .sidebar:not(.expanded) {
    height: 60px;
    overflow: hidden;
  }

  /* ===== NAVIGATION SECTIONS - EN DESSOUS DU HEADER ===== */
  .nav-sections-container {
    display: none;
    width: 100%;
    background-color: var(--sidebar-dark);
    border-top: 1px solid var(--border-color);
    padding: 15px 0;
    flex-direction: column;
  }
  
  .sidebar.expanded .nav-sections-container {
    display: flex;
  }

  /* Sections de navigation */
  .nav-section {
    padding: 10px 20px;
    margin-bottom: 0;
  }

  .nav-section h3 {
    font-size: 0.75rem;
    margin-bottom: 12px;
    color: var(--neon-blue);
  }

  .nav-link {
    padding: 12px 15px;
    margin-bottom: 5px;
    font-size: 0.95rem;
    border-radius: 8px;
  }

  .nav-link i {
    margin-right: 12px;
    font-size: 1rem;
    width: 20px;
    text-align: center;
  }

  .nav-link:hover {
    background-color: rgba(0, 240, 255, 0.15);
  }

  /* ===== CONTENU PRINCIPAL ===== */
  .content {
    width: 100%;
    margin-top: 60px;
    padding: 15px;
  }
  
  .modal-content {
    width: 95%;
    margin: 5% auto;
  }
  
  /* Ajustements pour les grilles de matchs */
  .matches-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }
  
  /* Ajustements pour les tableaux de résultats */
  table {
    font-size: 0.85rem;
  }
  
  th, td {
    padding: 8px 5px;
  }
  
  .sport-tabs {
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 5px;
    display: flex;
    align-items: center;
  }
  
  .sport-tab {
    display: inline-block;
    padding: 8px 15px;
  }
  
  /* Styles pour le bouton de basculement de vue sur desktop et tablette */
  .view-toggle-btn {
    display: flex;
    margin-left: auto;
    white-space: nowrap;
    font-size: 0.8rem;
    padding: 5px 10px;
  }
  
  /* Le bouton de vue mobile est masqué par défaut (dans la barre d'actions) */
  .mobile-view-toggle {
    display: none;
  }

  /* Overlay pour menu mobile */
  .mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 90;
    backdrop-filter: blur(3px);
  }
  
  .mobile-menu-overlay.visible {
    display: block;
  }
}

/* Styles pour mobile (≤ 768px) */
@media (max-width: 768px) {
  .page-header {
    flex-direction: column;
    align-items: center;
  }
  
  .page-title {
    margin-bottom: 10px;
  }
  
  .page-actions {
    width: 100%;
    display: flex;
    justify-content: space-between;
  }
  
  .btn {
    padding: 8px 12px;
    font-size: 0.8rem;
  }
  
  .matches-grid {
    grid-template-columns: 1fr;
  }
  
  /* Pour s'assurer que les onglets s'affichent correctement */
  .sport-tabs {
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-around;
    align-items: center;
    padding-right: 10px;
  }
  
  /* Sur mobile, masquer le bouton de vue dans les onglets et afficher celui dans la barre d'actions */
  .view-toggle-btn {
    display: none;
  }
  
  .mobile-view-toggle {
    display: flex;
    font-size: 0.7rem;
    padding: 6px 8px;
    order: 1; /* Le placer avant le bouton de recherche */
  }
  
  /* Ajustement de la barre d'actions */
  .page-actions {
    gap: 5px;
  }
  
  .btn {
    padding: 6px 8px;
    font-size: 0.75rem;
  }
  
  /* Nouveau style pour les cards des résultats sur mobile */
  /* Masquer la table standard */
  .mobile-card-view table {
    border: none;
    background: transparent;
  }
  
  .mobile-card-view thead {
    display: none;
  }
  
  .mobile-card-view tbody {
    display: block;
    width: 100%;
  }
  
  .mobile-card-view tr {
    display: block;
    margin-bottom: 15px;
    background-color: var(--match-bg);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    overflow: hidden;
  }
  
  .mobile-card-view td {
    display: block;
    border: none;
    padding: 0;
  }
  
  /* Suppression des libellés des données */
  .mobile-card-view td::before {
    display: none;
  }
  
  /* Première ligne: date - logo/championnat - statut prédiction */
  .mobile-card-view tr {
    position: relative;
  }
  
  /* Container pour la première ligne */
  .mobile-card-view tr {
    position: relative;
    padding-top: 40px; /* Espace pour la date et le championnat */
  }
  
  /* Date (premier élément) */
  .mobile-card-view td:nth-child(1) {
    display: inline-block;
    font-weight: 500;
    font-size: 0.9rem;
    position: absolute;
    top: 10px;
    left: 15px;
  }
  
  /* Division avec son logo (deuxième élément) */
  .mobile-card-view td:nth-child(2) {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: transparent;
    text-align: center;
    width: auto;
    font-size: 0.9rem;
  }
  
  /* Résultat du pari (dernier élément, en haut à droite) */
  .mobile-card-view td:nth-child(8) {
    position: absolute;
    top: 6px;
    right: 15px;
    width: auto;
  }
  
  .mobile-card-view .result-cell span {
    padding: 3px 8px;
    font-size: 0.8rem;
    border-radius: 4px;
  }
  
  /* Deuxième ligne: équipe domicile - score - équipe extérieur */
  .mobile-card-view td:nth-child(3),
  .mobile-card-view td:nth-child(4),
  .mobile-card-view td:nth-child(5) {
    display: flex;
    align-items: center;
  }
  
  /* Container pour les équipes et le score */
  .mobile-card-view td:nth-child(3) {
    padding: 15px;
    justify-content: flex-end;
    width: 35%;
    float: left;
    text-align: right;
  }
  
  /* Score au centre */
  .mobile-card-view td:nth-child(4) {
    width: 30%;
    float: left;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
    padding: 15px 0;
  }
  
  /* Équipe extérieur */
  .mobile-card-view td:nth-child(5) {
    width: 35%;
    float: left;
    justify-content: flex-start;
    padding: 15px;
  }
  
  /* Ajustement des logos d'équipes */
  .mobile-card-view td:nth-child(3) img,
  .mobile-card-view td:nth-child(5) img {
    width: 22px;
    height: 22px;
  }
  
  /* Ligne de prédiction et cote */
  .mobile-card-view td:nth-child(6),
  .mobile-card-view td:nth-child(7) {
    clear: both;
    padding: 10px 15px;
    border-top: 1px solid var(--border-color);
    background-color: rgba(255, 255, 255, 0.03);
  }
  
  /* Container pour aligner prédiction et cote */
  .mobile-card-view td:nth-child(6) {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  
  /* Libellé "Prédiction" et valeur */
  .mobile-card-view td:nth-child(6) .prediction-content {
    display: flex;
    align-items: center;
  }
  
  .mobile-card-view td:nth-child(6) .prediction-content::before {
    content: "Prédiction: ";
    font-weight: 600;
    margin-right: 5px;
    color: var(--text-secondary);
  }
  
  /* Masquer la cellule de cote originale */
  .mobile-card-view td:nth-child(7) {
    display: none;
  }
  
  /* Affichage de la cote dans la cellule de prédiction */
  .mobile-card-view td:nth-child(6) .odds-display {
    background-color: var(--odds-bg);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: bold;
    margin-left: auto;
  }

  @media (max-width: 767px) { .odds-display { display: block; } }
  
  /* Nettoyage après float */
  .mobile-card-view tr::after {
    content: "";
    display: table;
    clear: both;
  }
  
  /* Spécifique au sport sélectionné */
  .mobile-card-view tr.football {
    border-left-color: var(--football-accent);
  }
  
  .mobile-card-view tr.nba {
    border-left-color: var(--nba-accent);
  }
  
  .mobile-card-view tr.tennis {
    border-left-color: var(--tennis-accent);
  }
  
  /* Ajustements pour les modales */
  .modal-content {
    width: 100%;
    margin: 0;
    border-radius: 0;
    height: 100%;
    max-height: 100vh;
    overflow-y: auto;
  }
  
  .filter-date, .filter-odds {
    flex-direction: column;
    gap: 10px;
  }
  
  .filter-checkboxes {
    flex-direction: row;
    align-items: flex-start;
    gap: 10px;
  }
  
  /* Optimisations pour les formulaires sur mobile */
  .filter-input, select {
    height: 40px; /* Plus grands pour une meilleure accessibilité tactile */
  }
  
  input[type="checkbox"] {
    width: 20px;
    height: 20px;
  }
  
  .search-input {
    padding: 12px;
  }
  
  /* Ajustements pour les cartes de match */
  .match-card {
    padding: 10px;
  }
  
  .match-card:not(.compact) .match-footer {
    flex-direction: column;
  }

  .match-card.compact .team-name {
    font-size: 0.9rem;
  }

  .match-card.compact .prediction-value {
    font-size: 0.9rem;
  }
  
  .match-info-row {
    flex-wrap: wrap;
    justify-content: space-around;
    gap: 15px;
  }
  
  /* Ajuster les barres de confiance pour être plus lisibles */
  .bars {
    height: 15px;
  }
  
  .bar {
    width: 8px;
  }
}

/* Améliorations d'accessibilité pour le tactile */
@media (hover: none) {
  .btn, .nav-link, .sport-link, .match-card {
    transition: none;
  }
  
  .nav-link, .sport-link {
    padding: 12px 15px;
  }
  
  .btn {
    padding: 12px 15px;
  }
  
  .close-modal, .close-predictions-modal, .close-search-modal, .close-preferences-modal {
    padding: 10px;
    font-size: 28px;
  }
  
  select, input[type="checkbox"], input[type="radio"] {
    transform: scale(1.2);
  }
}

#desktop-view-toggle-btn {
  display: none;
}
