/* ============================================================
   TT Clissonnais — Thème principal
   Variables CSS → composants de base → utilitaires
   ============================================================ */


/* ── Variables ───────────────────────────────────────────── */
:root {
  /* Couleurs principales */
  --ttc-black: #000000;
  --ttc-red: #990000;
  --ttc-red-dark: #660000;
  --ttc-red-light: #cc0000;
  --ttc-red-text: #ff4d4d;
  --ttc-grey-900: #111111;
  --ttc-grey-800: #1a1a1a;
  --ttc-grey-700: #2a2a2a;
  --ttc-grey-500: #555555;
  --ttc-grey-300: #999999;
  --ttc-grey-100: #e5e5e5;
  --ttc-white: #f5f5f5;
  --ttc-yellow: #fbbf24;
  --ttc-blue-500: #3b82f6;

  /* Dégradés */
  --ttc-gradient: linear-gradient(135deg, var(--ttc-black) 0%, var(--ttc-red-dark) 50%, var(--ttc-red) 100%);
  --ttc-gradient-subtle: linear-gradient(180deg, var(--ttc-grey-900) 0%, var(--ttc-black) 100%);
  --ttc-gradient-bar: linear-gradient(90deg, var(--ttc-red) 0%, var(--ttc-red-dark) 100%);

  /* Typographie */
  --font-display: 'Barlow Condensed', sans-serif;
  --font-body: 'Barlow', sans-serif;

  /* Espacements */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Rayons */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;

  /* Ombres */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.6);
  --shadow-red: 0 4px 20px rgba(153, 0, 0, 0.3);

  /* Transitions */
  --transition: 200ms ease;
  --transition-slow: 400ms ease;

  /* Hauteurs */
  --navbar-height: 64px;
  --bottom-nav-height: 60px;
}

/* ── Reset minimal ───────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

input, button, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--navbar-height);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ttc-white);
  background-color: var(--ttc-black);
  -webkit-font-smoothing: antialiased;
  padding-top: var(--navbar-height);
  padding-bottom: var(--bottom-nav-height);
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font: inherit;
}

/* ── Typographie ─────────────────────────────────────────── */
h1,
h2,
h3,
h4,
h5 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(2.5rem, 8vw, 5rem);
  font-weight: 800;
}

h2 {
  font-size: clamp(1.8rem, 5vw, 3rem);
}

h3 {
  font-size: clamp(1.2rem, 3vw, 1.8rem);
}

h4 {
  font-size: 1.1rem;
}

.section-title {
  position: relative;
  display: inline-block;
  margin-bottom: var(--space-8);
}

.section-title::after {
  content: '';
  display: block;
  height: 3px;
  width: 60%;
  margin-top: var(--space-2);
  background: var(--ttc-gradient-bar);
  border-radius: 2px;
}

/* ── Navbar ──────────────────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--navbar-height);
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--ttc-grey-800);
  display: flex;
  align-items: center;
  padding: 0 var(--space-6);
  gap: var(--space-4);
}

.navbar__logo {
  display: flex;
  align-items: center;
  flex: 1;
}

.navbar__logo-img {
  height: 48px;
  width: auto;
  object-fit: contain;
  display: block;
  transition: opacity var(--transition);
}

.navbar__logo:hover .navbar__logo-img {
  opacity: 0.85;
}

/* Desktop nav links — cachés sur mobile */
.navbar__links {
  display: none;
  gap: var(--space-1);
  align-items: center;
}

.navbar__link {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ttc-grey-300);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
}

.navbar__link:hover,
.navbar__link.active {
  color: var(--ttc-white);
  background: var(--ttc-grey-800);
}

.navbar__link.active {
  color: var(--ttc-red-text);
}

/* Bouton connexion */
.navbar__auth {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ttc-white);
  background: var(--ttc-red);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  white-space: nowrap;
}

.navbar__auth:hover {
  background: var(--ttc-red-light);
}

/* Hamburger — visible sur mobile uniquement */
.navbar__hamburger {
  width: 32px;
  height: 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 4px;
}

.navbar__hamburger span {
  display: block;
  height: 2px;
  background: var(--ttc-white);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

.navbar__hamburger.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.navbar__hamburger.open span:nth-child(2) {
  opacity: 0;
}

.navbar__hamburger.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Drawer mobile */
.nav-drawer {
  position: fixed;
  top: var(--navbar-height);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99;
  background: rgba(0, 0, 0, 0.98);
  padding: var(--space-8) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  transform: translateX(-100%);
  transition: transform var(--transition-slow);
  overflow-y: auto;
}

.nav-drawer.open {
  transform: translateX(0);
}

.nav-drawer__item {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ttc-grey-100);
  padding: var(--space-4) var(--space-2);
  border-bottom: 1px solid var(--ttc-grey-800);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  transition: color var(--transition);
}

.nav-drawer__item:hover {
  color: var(--ttc-red-text);
}

.nav-drawer__item .lock-badge {
  font-size: 0.7rem;
  background: var(--ttc-grey-700);
  color: var(--ttc-grey-300);
  padding: 2px 6px;
  border-radius: 100px;
  font-weight: 400;
  font-family: var(--font-body);
}

/* ── Bottom navigation (mobile) ──────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--bottom-nav-height);
  background: rgba(10, 10, 10, 0.98);
  border-top: 1px solid var(--ttc-grey-800);
  display: flex;
  align-items: stretch;
}

.bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--ttc-grey-500);
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: color var(--transition);
  padding: var(--space-1) 0;
}

.bottom-nav__item:hover,
.bottom-nav__item.active {
  color: var(--ttc-red-text);
}

.bottom-nav__icon {
  font-size: 1.2rem;
  line-height: 1;
}

/* ── Contenu principal ───────────────────────────────────── */
#app {
  min-height: calc(100vh - var(--navbar-height) - var(--bottom-nav-height));
}

.page-enter {
  animation: pageEnter 300ms ease forwards;
}

@keyframes pageEnter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* ── Section générique ───────────────────────────────────── */
.section {
  padding: var(--space-12) var(--space-6);
  max-width: 1200px;
  margin: 0 auto;
}

.section--full {
  max-width: none;
  padding-left: 0;
  padding-right: 0;
}

/* ── Page header ─────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
  flex-wrap: wrap;
}

.page-header .section-title { margin-bottom: 0; }

.btn--sm {
  padding: var(--space-1) var(--space-3);
  font-size: 0.8rem;
}

/* ── Boutons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-sm);
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn--primary {
  background: var(--ttc-red);
  color: var(--ttc-white);
  box-shadow: var(--shadow-red);
}

.btn--primary:hover {
  background: var(--ttc-red-light);
  box-shadow: 0 6px 24px rgba(153, 0, 0, 0.5);
}

.btn--outline {
  border: 2px solid var(--ttc-red);
  color: var(--ttc-white);
  background: transparent;
}

.btn--outline:hover {
  background: var(--ttc-red);
  color: var(--ttc-white);
  box-shadow: 0 4px 16px rgba(153, 0, 0, 0.4);
}

.btn--ghost {
  color: var(--ttc-grey-300);
  background: var(--ttc-grey-800);
}

.btn--ghost:hover {
  background: var(--ttc-grey-700);
  color: var(--ttc-white);
}

.text-link {
  color: var(--ttc-white);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--ttc-red);
  text-underline-offset: 4px;
  border-bottom: none;
  transition: color var(--transition), text-decoration-color var(--transition);
  cursor: pointer;
}

.text-link:hover {
  color: var(--ttc-white);
  text-decoration-color: var(--ttc-white);
}

/* ── Cards ───────────────────────────────────────────────── */
.card {
  position: relative;
  background: linear-gradient(145deg, var(--ttc-grey-800) 0%, var(--ttc-grey-900) 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Trait lumineux en haut */
.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--ttc-red) 40%, var(--ttc-red-light) 60%, transparent 100%);
  opacity: 0.7;
  transition: opacity var(--transition);
}

/* Lueur d'angle intérieure */
.card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle at top left, rgba(153, 0, 0, 0.12) 0%, transparent 70%);
  pointer-events: none;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(153, 0, 0, 0.3), 0 4px 24px rgba(153, 0, 0, 0.15);
}

.card:hover::before {
  opacity: 1;
}

.card--red {
  background: linear-gradient(145deg, rgba(153, 0, 0, 0.18) 0%, var(--ttc-grey-900) 60%);
  border-color: rgba(153, 0, 0, 0.25);
}

.card--red::before {
  opacity: 1;
  background: linear-gradient(90deg, var(--ttc-red-dark) 0%, var(--ttc-red-light) 50%, var(--ttc-red-dark) 100%);
}

/* ── Card link (hub admin, etc.) ────────────────────────── */
a.card--red {
  display: flex;
  text-decoration: none;
  color: inherit;
}

/* ── Tableaux ─────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--ttc-grey-800);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  border-spacing: 0;
}

.table tr {
  border-bottom: 1px solid var(--ttc-grey-800);
}

.table thead {
  background: var(--ttc-grey-900);
  position: sticky;
  top: 0;
}

.table th {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ttc-grey-300);
  padding: var(--space-3) var(--space-4);
  text-align: left;
  white-space: nowrap;
  vertical-align: middle;
}

.table th.sortable {
  cursor: pointer;
  user-select: none;
}

.table th.sortable:hover {
  color: var(--ttc-white);
}

.table td {
  padding: var(--space-3) var(--space-4);
  color: var(--ttc-grey-100);
  vertical-align: middle;
}

.table tr:last-child {
  border-bottom: none;
}

.table tbody tr:hover {
  background: var(--ttc-grey-900);
}

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-display);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.badge--up {
  background: rgba(0, 180, 0, 0.15);
  color: #4ade80;
}

.badge--draw {
  background: rgba(251, 191, 36, 0.15);
  color: var(--ttc-yellow);
}

.badge--down {
  background: rgba(220, 0, 0, 0.15);
  color: #f87171;
}

.badge--flat {
  background: var(--ttc-grey-800);
  color: var(--ttc-grey-300);
}

/* ── Modales (Générique) ─────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.modal {
  position: relative;
  z-index: 1001;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--ttc-grey-900);
  border: 1px solid var(--ttc-grey-700);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  box-shadow: var(--shadow-md);
}

/* ── Composants Partagés ──────────────────────────────────── */
.card-header-gradient {
  background: linear-gradient(90deg, var(--ttc-red-dark) 0%, var(--ttc-red) 100%);
  color: var(--ttc-white);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  box-shadow: 0 2px 12px rgba(153, 0, 0, 0.3);
}

.phase-selector {
  display: flex;
  background: var(--ttc-grey-900);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--ttc-grey-800);
  width: fit-content;
}

.phase-selector__btn {
  padding: 6px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--ttc-grey-500);
  transition: all var(--transition);
}

.phase-selector__btn.active {
  background: var(--ttc-red);
  color: var(--ttc-white);
  box-shadow: var(--shadow-sm);
}

/* ── Formulaires ─────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.form-label {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ttc-grey-300);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: var(--ttc-grey-900);
  border: 1px solid var(--ttc-grey-700);
  border-radius: var(--radius-sm);
  color: var(--ttc-white);
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-body);
  font-size: 1rem;
  transition: border-color var(--transition);
  appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--ttc-red);
  box-shadow: 0 0 0 3px rgba(153, 0, 0, 0.2);
}

.form-input::placeholder {
  color: var(--ttc-grey-500);
}

.form-error {
  font-size: 0.8rem;
  color: #f87171;
  margin-top: var(--space-1);
}

/* ── Toast notifications ─────────────────────────────────── */
.toast-container {
  position: fixed;
  top: calc(var(--navbar-height) + var(--space-4));
  right: var(--space-4);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  background: var(--ttc-grey-800);
  border-left: 3px solid var(--ttc-grey-500);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  max-width: 320px;
  box-shadow: var(--shadow-md);
  animation: toastIn 300ms ease forwards;
  pointer-events: all;
}

.toast--success {
  border-color: #4ade80;
}

.toast--error {
  border-color: var(--ttc-red-light);
}

.toast--info {
  border-color: #60a5fa;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ── Motif tennis de table (décoration) ──────────────────── */
.ttc-pattern {
  position: relative;
  overflow: hidden;
}

.ttc-pattern::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 2px 2px, rgba(153, 0, 0, 0.08) 1px, transparent 0);
  background-size: 32px 32px;
  pointer-events: none;
}

/* Ligne de table (décoration subtile) */
.ttc-net {
  height: 2px;
  background: var(--ttc-gradient-bar);
  margin: var(--space-8) 0;
  position: relative;
}

.ttc-net::before {
  content: '⬤';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: var(--ttc-red);
  font-size: 0.5rem;
  background: var(--ttc-black);
  padding: 0 var(--space-2);
}

/* ── Loader ───────────────────────────────────────────────── */
.loader {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-12);
  color: var(--ttc-grey-500);
  font-family: var(--font-display);
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  gap: var(--space-3);
}

.loader::before {
  content: '';
  width: 20px;
  height: 20px;
  border: 2px solid var(--ttc-grey-700);
  border-top-color: var(--ttc-red);
  border-radius: 50%;
  animation: spin 600ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Desktop overrides ───────────────────────────────────── */
@media (min-width: 768px) {
  .navbar__hamburger {
    display: none;
  }

  .navbar__links {
    display: flex;
  }

  .bottom-nav {
    display: none;
  }

  body {
    padding-bottom: 0;
  }

  .nav-drawer {
    display: none;
  }
}

/* ── Colonnes triables ───────────────────────────────────── */
.th-sortable,
.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.th-sortable:hover,
.sortable:hover {
  color: var(--ttc-red-light);
}

.th-sorted {
  color: var(--ttc-red-light);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.sort-icon {
  font-size: 0.75rem;
  opacity: 0.6;
  margin-left: 4px;
}