/* =========================================================
   TACTI COACH — APP SHELL (fichier partagé)
   =========================================================
   Contient TOUT ce qui était dupliqué à l'identique dans les
   13 fichiers CSS du site : reset, règles de base, topbar +
   burger, chrome de la sidebar (position/logo/liens/bouton
   déconnexion), bottom tab bar, et le mode "app mobile"
   (< 768px). Chargé sur CHAQUE page, avant le CSS propre à
   la page (qui ne garde que son contenu spécifique : formulaires,
   cartes, tableaux...).

   Pages avec sidebar : dashboard, team, players, trainings,
   matches, statistics, profile, add-team, add-player,
   add-training, add-match.
   Pages sans sidebar (login, register) : profitent quand même
   du reset, des règles de base et du focus visible.
   ========================================================= */

/* Police Oswald : chargée via <link rel="preconnect"> +
   <link rel="stylesheet"> dans le <head> de chaque page
   (plus rapide qu'un @import qui bloque le rendu). */

/* ---------------------------------------------------------
   1. Reset & base
   --------------------------------------------------------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: Arial, Helvetica, sans-serif;
}

html { color-scheme: dark; }

html, body {
  max-width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

img, svg { max-width: 100%; height: auto; }

h1, h2, .logo-box h2, .topbar-title, #logoutBtn,
button[type="submit"], .section-title, .page-header h1 {
  font-family: 'Oswald', Arial, Helvetica, sans-serif;
}

a, button {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid #2f8aff;
  outline-offset: 2px;
}

.hidden { display: none !important; }

/* Label accessible mais invisible visuellement — pour les
   formulaires qui n'affichent qu'un placeholder à l'écran. */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------------------------------------------------------
   2. TOPBAR (mobile / tablette)
   --------------------------------------------------------- */
.topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: calc(56px + env(safe-area-inset-top, 0px));
  padding: 0 12px;
  padding-top: env(safe-area-inset-top, 0px);
  background:
    linear-gradient(115deg, #ffffff 60%, #ffffff 60.5%),
    #ffffff;
  border-bottom: 2px solid #2f8aff;
  z-index: 700;
  overflow: hidden;
}

.topbar::before {
  content: "";
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 42%;
  background: repeating-linear-gradient(
    115deg,
    transparent, transparent 7px,
    rgba(47, 138, 255, 0.05) 7px, rgba(47, 138, 255, 0.05) 8px
  );
  pointer-events: none;
}

.burger-btn {
  width: 44px; height: 44px;
  min-width: 44px; min-height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
}

.burger-btn span,
.burger-btn span::before,
.burger-btn span::after {
  content: "";
  display: block;
  width: 22px; height: 2px;
  background: #0f1b3d;
  border-radius: 2px;
  position: relative;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.burger-btn span::before { position: absolute; top: -7px; }
.burger-btn span::after  { position: absolute; top: 7px; }

.burger-btn[aria-expanded="true"] span { background: transparent; }
.burger-btn[aria-expanded="true"] span::before { background: #2f8aff; transform: rotate(45deg) translate(5px, 5px); }
.burger-btn[aria-expanded="true"] span::after  { background: #2f8aff; transform: rotate(-45deg) translate(5px, -5px); }

.topbar-title {
  position: relative;
  color: #0f1b3d;
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.topbar-spacer { width: 44px; }

.nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 600;
}
.nav-backdrop.show { display: block; }

/* ---------------------------------------------------------
   3. SIDEBAR (chrome commun — logo, liens, déconnexion)
   --------------------------------------------------------- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 240px;
  height: 100vh;
  padding: 30px 20px;
  background: #ffffff;
  border-right: 2px solid #ffffff;
  z-index: 800;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.logo-box {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 50px;
}

.logo-box img {
  width: 45px;
  height: 45px;
  object-fit: contain;
  border-radius: 8px;
  border: 1.5px solid rgba(47, 138, 255, 0.45);
  background: #f5f6f8;
  padding: 3px;
}

.logo-box h2 {
  color: #2f8aff;
  font-size: 18px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* Scopé à .sidebar pour ne jamais fuiter vers .bottom-tabs
   (qui est aussi un <nav>). */
.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 9px;
  flex: 1;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: #6b7280;
  text-decoration: none;
  padding: 13px 14px;
  border-radius: 0;
  border-left: 3px solid transparent;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: background 0.2s, color 0.2s, transform 0.2s;
}

.icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.bottom-tabs .icon {
  width: 20px;
  height: 20px;
}

.sidebar nav a:hover {
  background: rgba(47, 138, 255, 0.07);
  border-left-color: rgba(47, 138, 255, 0.4);
  color: #0f1b3d;
}

.sidebar nav a.active {
  background: rgba(47, 138, 255, 0.08);
  border-left-color: #2f8aff;
  color: #2f8aff;
  font-weight: 700;
}

#logoutBtn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: auto;
  padding: 12px;
  min-height: 48px;
  border: none;
  border-radius: 0;
  clip-path: polygon(4% 0, 100% 0, 96% 100%, 0% 100%);
  background: #2f8aff;
  color: #0f1b3d;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

#logoutBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(47, 138, 255, 0.2);
}

/* ---------------------------------------------------------
   4. BOTTOM TAB BAR (mobile / tablette)
   --------------------------------------------------------- */
.bottom-tabs {
  display: none;
  flex-direction: row;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: #ffffff;
  border-top: 2px solid #2f8aff;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  z-index: 700;
}

.bottom-tabs a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 56px;
  color: #9ca3af;
  text-decoration: none;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tab-icon { font-size: 20px; line-height: 1; }

.bottom-tabs a.active { color: #2f8aff; position: relative; }

.bottom-tabs a.active::before {
  content: "";
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 28px; height: 3px;
  border-radius: 0 0 3px 3px;
  background: #2f8aff;
}

/* ---------------------------------------------------------
   5. MAIN — décalage commun pour la sidebar fixe
   (le padding interne reste dans le CSS de chaque page)
   --------------------------------------------------------- */
.main, .main-content {
  margin-left: 240px;
}

/* ---------------------------------------------------------
   6. TABLETTE (max 1024px)
   --------------------------------------------------------- */
@media (max-width: 1024px) {
  .sidebar { width: 200px; padding: 25px 15px; }
  .main, .main-content { margin-left: 200px; }
}

/* ---------------------------------------------------------
   7. MODE APP MOBILE (< 768px)
   Sidebar → panneau overlay ouvert par le burger.
   --------------------------------------------------------- */
@media (max-width: 767px) {
  .topbar { display: flex; }
  .bottom-tabs { display: flex; }

  .sidebar {
    left: -100%;
    top: 0;
    width: 82%;
    max-width: 300px;
    height: 100vh;
    height: 100dvh;
    padding-top: max(24px, env(safe-area-inset-top, 0px));
    padding-bottom: max(90px, env(safe-area-inset-bottom, 0px) + 70px);
    transition: left 0.25s ease;
  }

  .sidebar.nav-open { left: 0; }

  body.nav-locked { overflow: hidden; }

  #logoutBtn { margin-top: 20px; }

  .main, .main-content {
    margin-left: 0;
    padding-top: calc(56px + env(safe-area-inset-top, 0px) + 16px);
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }
}

/* ---------------------------------------------------------
   8. Reduced motion
   --------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}