/* ==========================================================================
   Generador de torneos americanos y pozos de pádel - style.css
   Estilos canónicos para Fijate Tools (c) 2026
   ========================================================================== */

:root {
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Outfit', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Paleta cromática tema claro */
  --bg-app: #f4f6fa;
  --bg-card: #ffffff;
  --bg-card-alt: #f8fafc;
  --border-color: #e2e8f0;
  --border-focus: #2563eb;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-dim: #94a3b8;

  /* Acentos de pádel y tenis */
  --padel-blue: #0284c7;
  --padel-blue-light: #e0f2fe;
  --padel-court: #0369a1;
  --tennis-ball: #84cc16;
  --tennis-ball-bg: #ecfccb;
  --tennis-ball-text: #365314;
  --accent-gold: #d97706;
  --accent-silver: #64748b;
  --accent-bronze: #b45309;

  /* Estados */
  --state-success-bg: #dcfce7;
  --state-success-text: #15803d;
  --state-warn-bg: #fef3c7;
  --state-warn-text: #b45309;
  --state-danger-bg: #fee2e2;
  --state-danger-text: #b91c1c;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

[data-theme="dark"] {
  --bg-app: #0b0f17;
  --bg-card: #131b26;
  --bg-card-alt: #182232;
  --border-color: #243144;
  --border-focus: #38bdf8;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --padel-blue: #38bdf8;
  --padel-blue-light: rgba(56, 189, 248, 0.15);
  --padel-court: #0284c7;
  --tennis-ball: #a3e635;
  --tennis-ball-bg: rgba(163, 230, 53, 0.16);
  --tennis-ball-text: #bef264;

  --state-success-bg: rgba(34, 197, 94, 0.16);
  --state-success-text: #86efac;
  --state-warn-bg: rgba(245, 158, 11, 0.16);
  --state-warn-text: #fde68a;
  --state-danger-bg: rgba(239, 68, 68, 0.16);
  --state-danger-text: #fca5a5;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
}

/* Base */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-app);
  color: var(--text-main);
  margin: 0;
  padding: 0;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
}

h1, h2, h3, h4, h5, h6,
.brand-title,
.section-title,
.hero-title,
.court-name,
.timer-display {
  font-family: var(--font-heading);
}

.mono,
.timer-digits,
.score-number,
.stat-val {
  font-family: var(--font-mono);
}

/* Barra de suite unificada */
.suite-nav-bar {
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 0.65rem 1rem;
}

.suite-nav-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.suite-badge-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-muted);
}

.suite-badge-tag {
  background: var(--tennis-ball-bg);
  color: var(--tennis-ball-text);
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.suite-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.suite-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.825rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  background: var(--bg-card-alt);
  transition: all 0.15s ease;
}

.suite-link-btn:hover {
  color: var(--text-main);
  border-color: var(--padel-blue);
  background: var(--bg-card);
}

.suite-link-btn.is-active {
  background: var(--padel-blue);
  color: #ffffff;
  border-color: var(--padel-blue);
}

/* Layout */
.tool-layout {
  max-width: 1200px;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
  width: 100%;
}

.tool-with-sidebar {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.tool-main-content {
  flex: 1 1 0%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Barra superior de controles del torneo */
.tournament-control-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  box-shadow: var(--shadow-sm);
}

@media (min-width: 768px) {
  .tournament-control-bar {
    grid-template-columns: 1.4fr 1fr;
  }
}

.tournament-info-col {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tournament-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.tournament-title-edit {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-main);
}

.tournament-badges {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.chip-mode {
  background: var(--padel-blue-light);
  color: var(--padel-blue);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
}

.chip-status {
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
}

.chip-status.is-running {
  background: var(--state-success-bg);
  color: var(--state-success-text);
}

.chip-status.is-idle,
.chip-status.is-paused {
  background: var(--state-warn-bg);
  color: var(--state-warn-text);
}

.tournament-quick-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.tournament-quick-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* Cuadro de cronómetro */
.timer-card {
  background: linear-gradient(135deg, #090e17 0%, #152238 100%);
  border: 1px solid #1e293b;
  border-radius: var(--radius-md);
  padding: 1rem;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
}

.timer-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #38bdf8, #84cc16);
}

.timer-round-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  font-weight: 600;
}

.timer-digits {
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1;
  margin: 0.3rem 0;
  color: #a3e635;
  text-shadow: 0 0 12px rgba(163, 230, 53, 0.3);
  letter-spacing: 0.05em;
}

.timer-digits.is-warning {
  color: #f87171;
  text-shadow: 0 0 12px rgba(248, 113, 113, 0.4);
  animation: pulse-warn 1s infinite alternate ease-in-out;
}

@keyframes pulse-warn {
  0% { transform: scale(1); }
  100% { transform: scale(1.03); }
}

.timer-buttons-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  margin-top: 0.4rem;
}

.btn-timer-primary {
  flex: 1;
  background: #0284c7;
  color: #ffffff;
  border: none;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 40px;
  transition: all 0.15s ease;
}

.btn-timer-primary:hover {
  background: #0369a1;
}

.btn-timer-primary.is-active-pause {
  background: #d97706;
}

.btn-timer-icon {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  border-radius: var(--radius-sm);
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-timer-icon:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

/* Barra de pestañas */
.tourney-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0.25rem;
  overflow-x: auto;
}

.tab-tourney-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.tab-tourney-btn:hover {
  color: var(--text-main);
  background: var(--bg-card-alt);
}

.tab-tourney-btn.is-active {
  color: var(--padel-blue);
  background: var(--padel-blue-light);
  font-weight: 700;
}

/* Tarjetas de pista (Padel Courts) */
.courts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 840px) {
  .courts-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.court-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.court-card:hover {
  box-shadow: var(--shadow-md);
}

.court-card-header {
  background: var(--padel-court);
  color: #ffffff;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.court-title-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.court-icon-badge {
  background: rgba(255, 255, 255, 0.2);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 800;
}

.court-name {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  color: #ffffff;
}

.court-pozo-tag {
  font-size: 0.7rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  font-weight: 600;
  color: #bae6fd;
}

.court-match-area {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
}

/* Enfrentamiento */
.matchup-container {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem;
}

.match-team {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.match-team.team-a {
  text-align: left;
}

.match-team.team-b {
  text-align: right;
}

.team-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 700;
}

.team-players-names {
  font-size: 0.925rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.3;
}

.match-vs-divider {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.75rem;
  color: var(--text-dim);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
}

/* Marcador táctil interactivo */
.score-control-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  background: var(--bg-card);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
}

.score-stepper {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-score-step {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card-alt);
  color: var(--text-main);
  font-size: 1.25rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-score-step:hover {
  background: var(--padel-blue);
  color: #ffffff;
  border-color: var(--padel-blue);
}

.score-display-box {
  min-width: 44px;
  text-align: center;
}

.score-number {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-main);
}

.score-separator {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-dim);
}

/* Tabla de clasificación en vivo */
.standings-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.standings-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.standings-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.table-responsive-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.standings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  text-align: left;
}

.standings-table th {
  background: var(--bg-card-alt);
  color: var(--text-muted);
  font-weight: 600;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.standings-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  white-space: nowrap;
}

.standings-table tr:hover td {
  background: var(--bg-card-alt);
}

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

.pos-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.8rem;
}

.pos-1 {
  background: #fef3c7;
  color: #b45309;
}

.pos-2 {
  background: #f1f5f9;
  color: #475569;
}

.pos-3 {
  background: #ffedd5;
  color: #9a3412;
}

[data-theme="dark"] .pos-1 {
  background: rgba(245, 158, 11, 0.2);
  color: #fde68a;
}
[data-theme="dark"] .pos-2 {
  background: rgba(148, 163, 184, 0.2);
  color: #cbd5e1;
}
[data-theme="dark"] .pos-3 {
  background: rgba(180, 83, 9, 0.2);
  color: #fdba74;
}

.player-name-cell {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.diff-positive {
  color: var(--state-success-text);
  font-weight: 700;
}

.diff-negative {
  color: var(--state-danger-text);
  font-weight: 700;
}

/* Configuración del torneo */
.config-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.config-form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 768px) {
  .config-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-card-alt);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
  transition: border-color 0.15s ease;
}

.form-select {
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  padding-right: 40px;
  cursor: pointer;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
}

.form-help-text {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Acciones */
.btn-action-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.btn-primary {
  background: var(--padel-blue);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.65rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 40px;
  transition: all 0.15s ease;
}

.btn-primary:hover {
  background: #0369a1;
}

.btn-secondary {
  background: var(--bg-card-alt);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.65rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 40px;
  transition: all 0.15s ease;
}

.btn-secondary:hover {
  background: var(--bg-card);
  border-color: var(--padel-blue);
}

.btn-whatsapp {
  background: #25d366;
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.65rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 40px;
  transition: background 0.15s ease;
}

.btn-whatsapp:hover {
  background: #1eb857;
}

/* Modales canónicos sin alerts */
.tourney-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.tourney-modal-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.tourney-modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 540px;
  width: 100%;
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  transform: translateY(10px);
  transition: transform 0.2s ease;
}

.tourney-modal-overlay.is-open .tourney-modal-card {
  transform: translateY(0);
}

.tourney-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.tourney-modal-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0;
}

.btn-close-modal {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.btn-close-modal:hover {
  color: var(--text-main);
  background: var(--bg-card-alt);
}

/* Sección SEO */
.seo-guide-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-top: 2rem;
}

.seo-guide-section h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  color: var(--text-main);
}

.seo-guide-section h2:first-child {
  margin-top: 0;
}

.seo-guide-section p,
.seo-guide-section li {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.faq-item {
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 0;
}

.faq-item:last-child {
  border-bottom: none;
}

.faq-question {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.4rem;
}

/* Estilos de impresión */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  .app-header,
  .suite-nav-bar,
  .tools-ad-banner-section,
  .tool-ad-sidebar,
  .fijate-footer,
  .timer-card,
  .btn-action-row,
  .tourney-tabs,
  #tab-config,
  .seo-guide-section {
    display: none !important;
  }
  .tool-layout {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .court-card,
  .standings-card {
    border: 1px solid #ccc !important;
    box-shadow: none !important;
    break-inside: avoid;
  }
}
