/* ==========================================================================
   Frankton Hybrid 2026 — Styles custom (complément de Tailwind CDN)
   ========================================================================== */

/* -- Composants de base réutilisables ------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  border-radius: 0.75rem;
  font-weight: 600;
  font-size: 0.875rem;
  line-height: 1.25rem;
  transition: background-color 0.15s, transform 0.05s;
  cursor: pointer;
  user-select: none;
}
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: rgb(var(--ef-brand));
  color: white;
}
.btn-primary:hover { background: rgb(var(--ef-brand-hover)); }

.btn-secondary {
  background: rgb(var(--ef-surface-card));
  color: #e2e8f0;
  border: 1px solid rgb(var(--ef-surface-border));
}
.btn-secondary:hover { background: rgb(var(--ef-surface-hover)); }

.btn-danger {
  background: #dc2626;
  color: white;
}
.btn-danger:hover { background: #ef4444; }

.btn-ghost {
  background: transparent;
  color: #cbd5e1;
}
.btn-ghost:hover { background: rgb(var(--ef-surface-card)); color: white; }

/* -- Cards --------------------------------------------------------------- */
.card {
  background: rgb(var(--ef-surface-card));
  border: 1px solid rgb(var(--ef-surface-border));
  border-radius: 1rem;
  overflow: hidden;
}
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgb(var(--ef-surface-border));
  font-weight: 600;
  color: #f1f5f9;
}
.card-body { padding: 1.25rem; }

/* -- Formulaires --------------------------------------------------------- */
.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #cbd5e1;
  margin-bottom: 0.375rem;
}
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: rgb(var(--ef-surface));
  border: 1px solid rgb(var(--ef-surface-border));
  color: #e2e8f0;
  padding: 0.625rem 0.875rem;
  border-radius: 0.75rem;
  font-size: 1rem;      /* ≥ 16px pour éviter le zoom iOS */
  min-height: 48px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: rgb(var(--ef-brand));
  box-shadow: 0 0 0 3px rgb(var(--ef-brand) / 0.2);
}
.form-help  { font-size: 0.75rem; color: #94a3b8; margin-top: 0.25rem; }
.form-error { font-size: 0.75rem; color: #f87171; margin-top: 0.25rem; }

/* -- Leaderboard badges -------------------------------------------------- */
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  font-weight: 700;
  font-size: 0.875rem;
  background: rgb(var(--ef-surface-hover));
  color: #e2e8f0;
}
.rank-badge-1 { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #1f2937; }
.rank-badge-2 { background: linear-gradient(135deg, #cbd5e1, #94a3b8); color: #1f2937; }
.rank-badge-3 { background: linear-gradient(135deg, #cd7f32, #8b4513); color: white; }

.category-badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}
.category-HH { background: rgba(96, 165, 250, 0.15); color: #60a5fa; }
.category-HF { background: rgba(168, 85, 247, 0.15); color: #c084fc; }
.category-FF { background: rgba(236, 72, 153, 0.15); color: #f472b6; }

/* -- Score highlight on change ------------------------------------------- */
@keyframes scoreFlash {
  0%   { background: rgb(var(--ef-brand) / 0.4); }
  100% { background: transparent; }
}
.score-changed { animation: scoreFlash 1.5s ease-out; }

/* -- Gros pavé numérique VTT --------------------------------------------- */
.numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}
.numpad-key {
  font-size: 1.75rem;
  font-weight: 700;
  padding: 1rem 0;
  border-radius: 1rem;
  background: rgb(var(--ef-surface-card));
  border: 1px solid rgb(var(--ef-surface-border));
  color: white;
  text-align: center;
  transition: background 0.1s;
  user-select: none;
  min-height: 64px;
}
.numpad-key:active { background: rgb(var(--ef-brand)); }
.numpad-key-danger { background: #7f1d1d; border-color: #991b1b; }
.numpad-key-success { background: #065f46; border-color: #047857; }

/* -- Tables responsive --------------------------------------------------- */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 1rem;
  border: 1px solid rgb(var(--ef-surface-border));
}
.table-wrap table { width: 100%; border-collapse: collapse; }
.table-wrap thead {
  background: rgb(var(--ef-surface));
  color: #94a3b8;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.table-wrap th,
.table-wrap td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgb(var(--ef-surface-card));
}
.table-wrap tbody tr:hover { background: rgb(var(--ef-brand) / 0.08); }
.table-wrap tbody tr:last-child td { border-bottom: none; }

/* Pastilles catégorie dans le leaderboard */
tr.category-divider td {
  background: rgb(var(--ef-surface));
  color: #94a3b8;
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.5rem 1rem;
}

/* -- Spinner inline ------------------------------------------------------ */
.spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* -- PDF-friendly (print) ------------------------------------------------ */
@media print {
  body { background: white !important; color: black !important; }
  .no-print { display: none !important; }
  .card, .table-wrap { border-color: #cbd5e1 !important; }
}

/* -- Switch button (Uiverse.io by Admin12121) --------------------------- */
.switch-button {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  align-items: center;
  -webkit-box-pack: center;
  justify-content: center;
  margin: auto;
  height: 55px;
}

.switch-button .switch-outer {
  height: 100%;
  background: #252532;
  width: 115px;
  border-radius: 165px;
  -webkit-box-shadow: inset 0px 5px 10px 0px #16151c, 0px 3px 6px -2px #403f4e;
  box-shadow: inset 0px 5px 10px 0px #16151c, 0px 3px 6px -2px #403f4e;
  border: 1px solid #32303e;
  padding: 6px;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.switch-button .switch-outer input[type="checkbox"] {
  opacity: 0;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  position: absolute;
}

.switch-button .switch-outer .button-toggle {
  height: 42px;
  width: 42px;
  background: -webkit-gradient(
    linear,
    left top,
    left bottom,
    from(#3b3a4e),
    to(#272733)
  );
  background: -o-linear-gradient(#3b3a4e, #272733);
  background: linear-gradient(#3b3a4e, #272733);
  border-radius: 100%;
  -webkit-box-shadow: inset 0px 5px 4px 0px #424151, 0px 4px 15px 0px #0f0e17;
  box-shadow: inset 0px 5px 4px 0px #424151, 0px 4px 15px 0px #0f0e17;
  position: relative;
  z-index: 2;
  -webkit-transition: left 0.3s ease-in;
  -o-transition: left 0.3s ease-in;
  transition: left 0.3s ease-in;
  left: 0;
}

.switch-button
  .switch-outer
  input[type="checkbox"]:checked
  + .button
  .button-toggle {
  left: 58%;
}

.switch-button
  .switch-outer
  input[type="checkbox"]:checked
  + .button
  .button-indicator {
  -webkit-animation: indicator 1s forwards;
  animation: indicator 1s forwards;
}

.switch-button .switch-outer .button {
  width: 100%;
  height: 100%;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  position: relative;
  -webkit-box-pack: justify;
  justify-content: space-between;
}

.switch-button .switch-outer .button-indicator {
  height: 25px;
  width: 25px;
  top: 50%;
  -webkit-transform: translateY(-50%);
  transform: translateY(-50%);
  border-radius: 50%;
  border: 3px solid #ef565f;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  right: 10px;
  position: relative;
}

@-webkit-keyframes indicator {
  30% { opacity: 0; }
  0%  { opacity: 1; }
  100% {
    opacity: 1;
    border: 3px solid #60d480;
    left: -68%;
  }
}

@keyframes indicator {
  30% { opacity: 0; }
  0%  { opacity: 1; }
  100% {
    opacity: 1;
    border: 3px solid #60d480;
    left: -68%;
  }
}

/* Wrapper avec libellé à côté du toggle */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 4px;
}
.toggle-wrap .switch-button { margin: 0; flex-shrink: 0; }
.toggle-wrap .toggle-label {
  font-size: 0.875rem;
  color: #e2e8f0;
  user-select: none;
  cursor: pointer;
}
.toggle-wrap .toggle-help {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-top: 2px;
}
