/**
 * Estilos para Calculadora de ranking ELO deportivo amateur
 * fijate.com/tools/calculadora-ranking-elo-deportivo/
 */

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

  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-sub: #f1f5f9;
  --bg-input: #ffffff;
  --border-color: #e2e8f0;
  --border-focus: #3b82f6;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: #eff6ff;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px 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.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
}

html[data-theme="dark"] {
  --bg-page: #0b0f17;
  --bg-card: #131b26;
  --bg-card-sub: #1a2433;
  --bg-input: #172130;
  --border-color: #243144;
  --border-focus: #60a5fa;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-light: rgba(59, 130, 246, 0.12);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.6);
}

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

h1, h2, h3, h4, h5, h6,
.brand-title,
.section-title,
.card-title,
.faq-section-title {
  font-family: var(--font-heading);
  color: var(--text-main);
}

.mono, .font-mono, code {
  font-family: var(--font-mono);
}

/* Layout Canónico */
.main-wrapper.tool-layout {
  max-width: 1200px;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
  box-sizing: border-box;
  flex: 1 0 auto;
  width: 100%;
}

.tool-with-sidebar {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  width: 100%;
}

.tool-main-content {
  flex: 1 1 0%;
  min-width: 0;
  width: 100%;
}

/* Tarjetas Principales */
.card-main {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

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

.card-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.card-title-group h2 {
  font-size: 1.35rem;
  margin: 0;
  font-weight: 700;
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Barra de Ajustes Superiores */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
  background: var(--bg-card-sub);
  padding: 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

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

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

.form-control, .form-select {
  width: 100%;
  height: 42px;
  padding: 0 0.85rem;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 0.95rem;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-select {
  padding-right: 2.2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  appearance: none;
}

.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Duelo de Equipos (Equipos A y B) */
.clash-container {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1.5rem;
  align-items: stretch;
  margin-bottom: 2rem;
}

@media (max-width: 860px) {
  .clash-container {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
}

.team-box {
  background: var(--bg-card-sub);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.team-box.team-a {
  border-top: 4px solid var(--accent);
}

.team-box.team-b {
  border-top: 4px solid var(--success);
}

.team-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.team-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
}

.team-avg-badge {
  font-size: 0.85rem;
  padding: 0.2rem 0.55rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}

.player-row {
  display: grid;
  grid-template-columns: 1fr 100px;
  gap: 0.6rem;
  align-items: center;
}

.input-rating {
  text-align: right;
  font-weight: 700;
}

/* Barra de Probabilidades y Enfrentamiento */
.clash-vs-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.5rem;
}

.vs-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-card-sub);
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Barra de Probabilidad */
.probability-wrapper {
  background: var(--bg-card-sub);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 2rem;
}

.prob-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.prob-title {
  font-weight: 600;
  color: var(--text-muted);
}

.prob-meter-track {
  height: 22px;
  width: 100%;
  background: var(--border-color);
  border-radius: 9999px;
  overflow: hidden;
  display: flex;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.15);
}

.prob-bar {
  height: 100%;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.prob-bar-a {
  background: linear-gradient(90deg, #2563eb, #3b82f6);
}

.prob-bar-b {
  background: linear-gradient(90deg, #10b981, #059669);
}

.prob-stakes-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.85rem;
}

.stake-card {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.stake-card span:first-child {
  color: var(--text-muted);
}

/* Botones de Resultado y Acción */
.match-outcome-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.outcome-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  text-align: center;
}

.outcome-buttons {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.btn-outcome {
  min-height: 44px;
  padding: 0 1.25rem;
  border: 2px solid var(--border-color);
  background: var(--bg-card-sub);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.15s ease;
}

.btn-outcome:hover {
  border-color: var(--border-focus);
  background: var(--bg-card);
}

.btn-outcome.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.35);
}

.btn-primary-action {
  width: 100%;
  max-width: 380px;
  min-height: 48px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.btn-primary-action:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-primary-action:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Feedback de Partido */
.feedback-card {
  margin-top: 1.5rem;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.feedback-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.feedback-badge {
  font-size: 0.75rem;
  font-weight: 700;
  background: #10b981;
  color: #ffffff;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
}

.feedback-title {
  font-weight: 700;
  font-size: 1.05rem;
}

.feedback-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 600px) {
  .feedback-grid {
    grid-template-columns: 1fr;
  }
}

.feedback-team ul {
  list-style: none;
  padding: 0;
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
}

.feedback-team li {
  padding: 0.2rem 0;
}

.feedback-team li span {
  font-weight: 700;
  font-family: var(--font-mono);
}

/* Tabla de Clasificación / Ranking */
.ranking-section {
  margin-top: 2rem;
}

.ranking-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
}

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

.ranking-table th {
  background: var(--bg-card-sub);
  padding: 0.85rem 1rem;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}

.ranking-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

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

.col-pos {
  font-weight: 700;
  width: 40px;
  text-align: center;
}

.pos-gold { color: #eab308; }
.pos-silver { color: #94a3b8; }
.pos-bronze { color: #b45309; }

.badge-cat {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.btn-del-player {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.3rem;
  border-radius: 4px;
}

.btn-del-player:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

/* Historial de Partidos */
.history-section {
  margin-top: 2.5rem;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.85rem 1.1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
}

.history-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.history-sport-badge {
  padding: 0.15rem 0.45rem;
  background: var(--bg-card-sub);
  border-radius: 4px;
  font-weight: 600;
}

.history-clash {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.winner-bold {
  font-weight: 700;
  color: var(--text-main);
}

.vs-divider {
  font-size: 0.8rem;
}

/* Modales accesibles */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
}

.modal-overlay.is-active {
  display: flex;
}

.modal-content-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 440px;
  width: 100%;
  padding: 1.75rem;
  box-shadow: var(--shadow-lg);
  position: relative;
}

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

.modal-header h3 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
}

.modal-close-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.35rem;
  border-radius: 4px;
}

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

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.btn-secondary {
  min-height: 40px;
  padding: 0 1rem;
  background: var(--bg-card-sub);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
}

.btn-danger {
  min-height: 40px;
  padding: 0 1rem;
  background: var(--danger);
  border: none;
  color: #ffffff;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
}

/* Acordeón Didáctico y FAQ */
.faq-section {
  margin-top: 3rem;
  border-top: 1px solid var(--border-color);
  padding-top: 2rem;
}

.faq-section-title {
  font-size: 1.4rem;
  margin-bottom: 1.25rem;
  font-weight: 700;
}

.faq-accordion details {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
  padding: 0.85rem 1.15rem;
}

.faq-accordion summary {
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-accordion summary::-webkit-details-marker {
  display: none;
}

.faq-accordion summary::after {
  content: '+';
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-muted);
}

.faq-accordion details[open] summary::after {
  content: '−';
}

.faq-accordion p {
  margin: 0.85rem 0 0;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text-muted);
}
