@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800;900&display=swap');

:root {
  --tm-blue:        #004165;
  --tm-blue-dark:   #002d47;
  --tm-blue-light:  #2d7aa8;
  --tm-maroon:      #772432;
  --tm-maroon-light:#a13a4a;
  --tm-maroon-dark: #591622;
  --tm-gold:        #F2DF74;
  --tm-gold-dark:   #c9a93c;
  --tm-gray:        #63666a;
  --bg:             #f5f7fb;
  --card:           #ffffff;
  --text:           #1f2933;
  --text-muted:     #6b7280;
  --border:         #e5e9ef;
  --radius:         16px;
  --radius-sm:      10px;
  --shadow:         0 2px 10px rgba(0,0,0,.06);
  --shadow-lg:      0 10px 30px rgba(0,0,0,.12);
  --nav-w:          250px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: 'Montserrat', 'Gotham', 'Myriad Pro', system-ui, -apple-system, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

/* ---------------------------------------------------------------- */
/* Layout applicatif : topbar fixe + menu hamburger déroulant        */
/* + menu bottom-nav — IDENTIQUE sur mobile et desktop, plus de       */
/* sidebar, plus de bascule par largeur d'écran.                     */
/* ---------------------------------------------------------------- */
.app-shell {
  min-height: 100vh;
}

.topbar-fixed {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  background: linear-gradient(120deg, var(--tm-blue) 0%, var(--tm-blue-dark) 100%);
  color: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,.12);
}
.topbar-brand { display: flex; align-items: center; gap: 10px; }
.topbar-brand .logo {
  width: 34px; height: 34px;
  background: #fff;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.topbar-brand .logo img { width: 100%; height: 100%; object-fit: contain; padding: 3px; }
.topbar-brand h1 { font-size: 16px; margin: 0; font-weight: 800; }

.hamburger-btn {
  width: 40px; height: 40px;
  border: none;
  background: rgba(255,255,255,.12);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-shrink: 0;
}
.hamburger-btn span {
  display: block;
  width: 18px; height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform .2s, opacity .2s;
}
.hamburger-btn.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.hamburger-btn.open span:nth-child(2) { opacity: 0; }
.hamburger-btn.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,20,35,.35);
  z-index: 45;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.menu-overlay.open { opacity: 1; pointer-events: auto; }

.dropdown-menu {
  position: fixed;
  top: 0;
  right: -280px;
  width: 260px;
  max-width: 80vw;
  height: 100%;
  background: linear-gradient(180deg, var(--tm-blue) 0%, var(--tm-blue-dark) 55%, var(--tm-maroon-dark) 100%);
  color: #fff;
  z-index: 50;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: right .25s ease;
  box-shadow: -6px 0 24px rgba(0,0,0,.25);
}
.dropdown-menu.open { right: 0; }
.dropdown-menu .dm-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 8px 16px 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,.15);
}
.dropdown-menu .dm-header strong { font-size: 15px; }
.dropdown-menu .dm-close {
  width: 30px; height: 30px;
  border: none; background: rgba(255,255,255,.12); border-radius: 8px;
  color: #fff; font-size: 15px; line-height: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.85);
  font-size: 14.5px;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-link .ic { font-size: 18px; width: 22px; text-align: center; }
.nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-link.active {
  background: rgba(255,255,255,.16);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--tm-gold);
}

.club-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  color: #fff;
}
.club-chip:nth-of-type(3n+1) { background: var(--tm-blue); }
.club-chip:nth-of-type(3n+2) { background: var(--tm-maroon); }
.club-chip:nth-of-type(3n+3) { background: var(--tm-gold-dark); }

.welcome-banner {
  background: linear-gradient(120deg, var(--tm-blue) 0%, var(--tm-maroon) 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-lg);
}
.welcome-banner .wb-title { font-size: 17px; font-weight: 800; margin: 0 0 6px 0; }
.welcome-banner .wb-text { font-size: 14px; opacity: .95; line-height: 1.6; margin: 0; }
.welcome-banner .wb-clubs { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }

.main-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 16px 100px 16px;
  width: 100%;
}
@media (min-width: 700px) {
  .main-content { padding: 28px 32px 110px 32px; }
}

/* ---------------------------------------------------------------- */
/* Bottom nav : toujours visible, sur mobile ET desktop              */
/* ---------------------------------------------------------------- */
.bottom-nav {
  display: flex;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: #fff;
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 18px rgba(0,0,0,.08);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom)) 4px;
  z-index: 30;
}
.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 2px;
  border-radius: 12px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  max-width: 120px;
  margin: 0 auto;
}
.bottom-nav a .ic { font-size: 21px; }
.bottom-nav a.active { color: var(--tm-blue); }
.bottom-nav a.active .ic {
  background: rgba(0,65,101,.1);
  border-radius: 10px;
  padding: 3px 10px;
}

/* ---------------------------------------------------------------- */
/* Composants génériques                                            */
/* ---------------------------------------------------------------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 4px 0;
}
.page-subtitle {
  color: var(--text-muted);
  margin: 0 0 22px 0;
  font-size: 14.5px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 12px;
  border: none;
  font-weight: 600;
  font-size: 14.5px;
  transition: transform .1s, box-shadow .15s, opacity .15s;
}
.btn-primary { background: linear-gradient(120deg, var(--tm-blue), var(--tm-blue-light)); color: #fff; }
.btn-primary:hover { box-shadow: 0 6px 16px rgba(0,65,101,.3); }
.btn-gold { background: var(--tm-gold); color: var(--tm-blue-dark); }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-block { width: 100%; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.input, select.input, textarea.input {
  width: 100%;
  padding: 13px 15px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  font-size: 14.5px;
  background: #fbfcfe;
  color: var(--text);
}
.input:focus, select.input:focus, textarea.input:focus {
  outline: none;
  border-color: var(--tm-blue);
  background: #fff;
}
label.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0 0 6px 2px;
}
.field { margin-bottom: 18px; }

.chip-select {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: #fff;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  user-select: none;
}
.chip input { display: none; }
.chip.checked {
  background: var(--tm-blue);
  border-color: var(--tm-blue);
  color: #fff;
}

/* --------------------- Ecran d'accueil / onboarding --------------- */
.onboard-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 15% 15%, rgba(242,223,116,.35) 0%, transparent 35%),
    radial-gradient(circle at 85% 80%, rgba(119,36,50,.55) 0%, transparent 45%),
    linear-gradient(135deg, var(--tm-blue-light) 0%, var(--tm-blue-dark) 55%, var(--tm-maroon-dark) 100%);
  padding: 20px;
}
.onboard-logo { width: 68px; height: 68px; margin: 0 auto 14px auto; border-radius: 16px; }
.onboard-card {
  background: #fff;
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  padding: 40px 32px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  animation: floatIn .5s ease;
}
@keyframes floatIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.onboard-emoji { font-size: 46px; margin-bottom: 6px; }
.onboard-card h2 { margin: 0 0 6px 0; font-size: 22px; }
.onboard-card p.lead { color: var(--text-muted); margin: 0 0 24px 0; font-size: 14.5px; }
#feedback-msg { margin-top: 14px; font-size: 13.5px; }
#feedback-msg.error { color: var(--tm-maroon); }
#feedback-msg.success { color: #157347; }

/* --------------------- Répertoire (liste + cartes) ----------------- */
.grid-membres {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}
.membre-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform .12s, box-shadow .15s;
}
.membre-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.avatar {
  width: 54px; height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--tm-blue), var(--tm-maroon));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
}
.membre-card .name { font-weight: 700; font-size: 15px; }
.membre-card .club { color: var(--text-muted); font-size: 12.5px; }
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  background: #eef4f8;
  color: var(--tm-blue);
  font-size: 11px;
  font-weight: 700;
}
.role-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.role-tags .badge { color: #fff; font-weight: 700; }
.role-tags .badge:nth-of-type(3n+1) { background: var(--tm-blue); }
.role-tags .badge:nth-of-type(3n+2) { background: var(--tm-maroon); }
.role-tags .badge:nth-of-type(3n+3) { background: var(--tm-gold-dark); }

.search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.search-bar .input { flex: 1; min-width: 200px; }

/* --------------------- Détail membre -------------------------------- */
.profile-header {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 22px;
}
.profile-header .avatar { width: 76px; height: 76px; font-size: 26px; }
.profile-header h2 { margin: 0; font-size: 21px; }
.profile-header .sub { color: var(--text-muted); font-size: 13.5px; }

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}
.info-item .lbl { font-size: 12px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.info-item .val { font-size: 14.5px; margin-top: 3px; }

.stat-card { text-align: center; color: #fff; border: none; }
.stat-card .num { font-size: 28px; font-weight: 800; }
.stat-card .lbl2 { font-size: 12.5px; opacity: .92; margin-top: 4px; font-weight: 600; }
.stat-card.c1 { background: linear-gradient(135deg, var(--tm-blue), var(--tm-blue-light)); }
.stat-card.c2 { background: linear-gradient(135deg, var(--tm-maroon), var(--tm-maroon-light)); }
.stat-card.c3 { background: linear-gradient(135deg, var(--tm-gold-dark), var(--tm-maroon)); }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state .ic { font-size: 42px; margin-bottom: 10px; }

.toast {
  position: fixed;
  bottom: 90px; left: 50%; transform: translateX(-50%);
  background: var(--tm-blue-dark);
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-6px); }

/* ---------------------------------------------------------------- */
/* Chatbot IA (bouton flottant + panneau de discussion, avec voix)   */
/* ---------------------------------------------------------------- */
.chatbot-fab {
  position: fixed;
  right: 16px;
  bottom: 78px;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--tm-maroon), var(--tm-blue));
  color: #fff;
  border: none;
  font-size: 24px;
  box-shadow: 0 8px 20px rgba(0,0,0,.25);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s;
}
.chatbot-fab:active { transform: scale(.93); }
.chatbot-fab .fab-dot {
  position: absolute;
  top: 4px; right: 4px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--tm-gold);
  border: 2px solid #fff;
}

.chatbot-panel {
  position: fixed;
  right: 12px;
  bottom: 12px;
  left: 12px;
  top: 12px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  z-index: 70;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.chatbot-panel.open { display: flex; }
@media (min-width: 560px) {
  .chatbot-panel {
    left: auto; top: auto;
    width: 380px;
    height: 560px;
    bottom: 78px;
    right: 16px;
  }
}

.chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(120deg, var(--tm-blue), var(--tm-maroon));
  color: #fff;
  flex-shrink: 0;
}
.chatbot-header .ch-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14.5px; }
.chatbot-header button {
  width: 30px; height: 30px;
  border: none; background: rgba(255,255,255,.15); border-radius: 8px;
  color: #fff; font-size: 14px;
}

.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg);
}
.chat-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  white-space: pre-wrap;
}
.chat-bubble.bot {
  background: #fff;
  color: var(--text);
  align-self: flex-start;
  box-shadow: var(--shadow);
  border-bottom-left-radius: 4px;
}
.chat-bubble.user {
  background: var(--tm-blue);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.chat-bubble.typing { display: flex; gap: 4px; align-items: center; padding: 14px; }
.chat-bubble.typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-muted);
  animation: typingBounce 1.2s infinite ease-in-out;
}
.chat-bubble.typing span:nth-child(2) { animation-delay: .15s; }
.chat-bubble.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.chatbot-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--border);
  background: #fff;
  flex-shrink: 0;
}
.chatbot-input-row input {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 13.5px;
  font-family: inherit;
  background: #fbfcfe;
}
.chatbot-input-row input:focus { outline: none; border-color: var(--tm-blue); }
.chatbot-icon-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--bg);
  color: var(--tm-blue);
  font-size: 16px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.chatbot-icon-btn.primary { background: var(--tm-blue); color: #fff; }
.chatbot-icon-btn.listening {
  background: var(--tm-maroon);
  color: #fff;
  animation: pulseMic 1s infinite;
}
@keyframes pulseMic {
  0%, 100% { box-shadow: 0 0 0 0 rgba(119,36,50,.4); }
  50% { box-shadow: 0 0 0 8px rgba(119,36,50,0); }
}

.chatbot-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  text-align: center;
  padding: 4px 16px 10px 16px;
  background: #fff;
}
