/* ==========================================================================
   PÉTANQUE MASTER PRO - DESIGN SYSTEM & COMPOSANTS TERRAIN HAUTE LISIBILITÉ
   Optimisé pour écran tactile, plein soleil, tablette, mobile & vidéoprojecteur
   ========================================================================== */

:root {
  --bg-main: #0b0f19;
  --bg-card: #151d30;
  --bg-card-hover: #1c2742;
  --border-color: #2a3756;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-gold: #f59e0b;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --accent-blue: #3b82f6;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Mode Plein Soleil / Terrain (Contraste maximal en extérieur) */
body.sunlight-mode {
  --bg-main: #000000;
  --bg-card: #111111;
  --bg-card-hover: #222222;
  --border-color: #facc15;
  --text-main: #ffffff;
  --text-muted: #e2e8f0;
  --accent-gold: #fde047;
  --accent-green: #4ade80;
  --accent-red: #f87171;
}

body.sunlight-mode .card-sunlight-border {
  border-width: 2px !important;
  border-color: #facc15 !important;
}

body.sunlight-mode .text-sunlight-contrast {
  color: #ffffff !important;
  font-weight: 800 !important;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.4;
  overflow-x: hidden;
  user-select: none;
}

/* Utilitaires Tactiles Terrain */
.touch-target {
  min-height: 48px;
  min-width: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.touch-btn {
  min-height: 52px;
  padding: 0.65rem 1.25rem;
  font-size: 1.05rem;
  font-weight: 700;
  border-radius: 0.75rem;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  border: none;
}

.touch-btn:active {
  transform: scale(0.96);
}

.score-key {
  width: 60px;
  height: 60px;
  font-size: 1.35rem;
  font-weight: 800;
  border-radius: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s ease;
  cursor: pointer;
}

.score-key:active {
  transform: scale(0.92);
}

/* Badge de statut */
.badge {
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* Bracket de Tournoi Éliminatoire */
.bracket-container {
  display: flex;
  overflow-x: auto;
  gap: 2.5rem;
  padding: 1.5rem 0.5rem;
  min-width: 100%;
}

.bracket-round {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  min-width: 280px;
  gap: 1.5rem;
}

.bracket-match {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 0.85rem;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  position: relative;
  transition: border-color 0.2s;
}

.bracket-match:hover {
  border-color: var(--accent-gold);
}

.bracket-team-slot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  transition: background 0.15s;
}

.bracket-team-slot.winner {
  background: rgba(16, 185, 129, 0.15);
  font-weight: 800;
}

.bracket-team-slot.loser {
  opacity: 0.6;
}

/* Mode Projection plein écran TV / Vidéoprojecteur */
.projection-screen {
  background: #090d16;
  color: #fff;
  position: fixed;
  inset: 0;
  z-index: 9999;
  overflow-y: auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
}

.projection-header {
  border-bottom: 2px solid #3b82f6;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Animations */
@keyframes pulse-glow {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.75; transform: scale(1.04); }
}

.pulse-live {
  animation: pulse-glow 2s infinite ease-in-out;
}

/* ==========================================================================
   OPTIMISATION IMPRESSION (@media print)
   Génère des cartons de match détachables et tableaux officiels impeccables
   ========================================================================== */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 11pt;
  }

  .no-print, header, nav, .bottom-nav, button, .modal, .toast-container {
    display: none !important;
  }

  .print-only {
    display: block !important;
  }

  .print-page-break {
    page-break-before: always;
  }

  .print-card {
    border: 2px solid #000000 !important;
    border-radius: 8px !important;
    padding: 12px !important;
    margin-bottom: 14px !important;
    page-break-inside: avoid;
  }

  .print-table {
    width: 100% !important;
    border-collapse: collapse !important;
  }

  .print-table th, .print-table td {
    border: 1px solid #000000 !important;
    padding: 6px 8px !important;
    text-align: left !important;
  }

  .print-table th {
    background-color: #f1f5f9 !important;
    font-weight: bold !important;
  }
}

@media screen {
  .print-only {
    display: none !important;
  }
}
