:root {
  color-scheme: dark;
  --bg: #09090b;
  --bg-elevated: #121217;
  --bg-card: #16161d;
  --bg-input: #0e0e13;
  --border: #27272f;
  --border-strong: #3a3a46;
  --text: #f4f4f5;
  --text-muted: #a1a1aa;
  --text-subtle: #71717a;

  --lime: #a3e635;
  --sky: #38bdf8;
  --orange: #fb923c;
  --purple: #c084fc;
  --danger: #f43f5e;
  --success: #22c55e;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);

  --scrollbar-track: #111116;
  --scrollbar-thumb: #3f3f4a;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
  accent-color: var(--lime);
}

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

html {
  scroll-behavior: smooth;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background-color: var(--bg);
  color: var(--text);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% -10%, rgba(163, 230, 53, 0.08), transparent 35%),
    radial-gradient(circle at 85% 10%, rgba(56, 189, 248, 0.07), transparent 35%),
    var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: "Outfit", "Inter", system-ui, sans-serif;
  margin: 0;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

p {
  margin: 0;
}

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

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

.container {
  width: min(1200px, calc(100% - 2rem));
  margin-inline: auto;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(9, 9, 11, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 68px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-family: "Outfit", sans-serif;
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--border-strong);
  display: block;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-links a {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.15s ease;
}

.nav-links a:hover {
  color: var(--text);
}

.auth-controls {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
}

.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--lime);
  color: #09090b;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 800;
}

.verified-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--sky);
  title: "Atleta verificado";
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.62rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--lime);
  color: #09090b;
}

.btn-primary:hover:not(:disabled) {
  background: #bef264;
}

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

.btn-secondary:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: #1d1d26;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.14);
  border-color: rgba(244, 63, 94, 0.35);
  color: #fda4af;
}

.btn-danger:hover:not(:disabled) {
  background: rgba(244, 63, 94, 0.24);
}

.btn-sm {
  padding: 0.42rem 0.78rem;
  font-size: 0.82rem;
}

/* Hero */
.hero {
  padding: 4.5rem 0 3.5rem;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 2.5rem;
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(163, 230, 53, 0.3);
  background: rgba(163, 230, 53, 0.08);
  color: var(--lime);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1.15rem;
}

.hero h1 {
  font-size: clamp(2.3rem, 5vw, 3.8rem);
  font-weight: 800;
  margin-bottom: 1.1rem;
}

.hero h1 span {
  background: linear-gradient(90deg, var(--lime), var(--sky));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-lead {
  font-size: 1.08rem;
  color: var(--text-muted);
  max-width: 58ch;
  margin-bottom: 1.8rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.metric-card strong {
  display: block;
  font-family: "Outfit", sans-serif;
  font-size: 1.75rem;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.metric-card span {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Sections */
.section {
  padding: 4rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.section-header h2 {
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  font-weight: 800;
}

.section-subtitle {
  color: var(--text-muted);
  margin-top: 0.4rem;
  max-width: 60ch;
}

/* Cards & Panels */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.generator-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 1.5rem;
  align-items: start;
}

/* Forms */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

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

.form-control {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  transition: border-color 0.15s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--lime);
}

.form-control:user-invalid {
  border-color: var(--danger);
}

textarea.form-control {
  resize: vertical;
  min-height: 96px;
}

/* Discipline badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
}

.badge[data-discipline="calistenia"] {
  color: var(--lime);
  border-color: rgba(163, 230, 53, 0.35);
  background: rgba(163, 230, 53, 0.1);
}

.badge[data-discipline="sprint"] {
  color: var(--sky);
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.1);
}

.badge[data-discipline="explosividad"] {
  color: var(--orange);
  border-color: rgba(251, 146, 60, 0.35);
  background: rgba(251, 146, 60, 0.1);
}

.badge[data-discipline="hibrido"] {
  color: var(--purple);
  border-color: rgba(192, 132, 252, 0.35);
  background: rgba(192, 132, 252, 0.1);
}

.badge-featured {
  color: #fde047;
  border-color: rgba(250, 204, 21, 0.4);
  background: rgba(250, 204, 21, 0.12);
}

/* Generated Routine Table */
.routine-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0.75rem 0 1rem;
}

.phase-box {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.phase-box strong {
  color: var(--text);
}

.exercise-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin: 1rem 0 1.25rem;
}

.exercise-item {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 0.85rem;
  align-items: center;
  padding: 0.85rem 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.exercise-index {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(163, 230, 53, 0.12);
  color: var(--lime);
  display: grid;
  place-items: center;
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  font-size: 0.82rem;
}

.exercise-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.exercise-notes {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.exercise-stats {
  text-align: right;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.82rem;
  white-space: nowrap;
}

.exercise-rest {
  display: block;
  color: var(--sky);
  font-size: 0.76rem;
}

.routine-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.inline-email-form {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.85rem;
  width: 100%;
}

.inline-email-form input {
  flex: 1;
  min-width: 210px;
}

/* Filters & Grids */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.pill-btn {
  padding: 0.42rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pill-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.pill-btn.active {
  background: var(--lime);
  color: #09090b;
  border-color: var(--lime);
}

.filter-inputs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 1.25rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  transition: border-color 0.18s ease, transform 0.18s ease;
}

.card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.card-title {
  font-size: 1.12rem;
  font-weight: 700;
}

.card-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  margin-top: auto;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.author-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.like-btn.liked {
  border-color: rgba(244, 63, 94, 0.5);
  background: rgba(244, 63, 94, 0.12);
  color: #fb7185;
}

/* Contact & Newsletter */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 1.5rem;
}

/* Native <dialog> Modals (Modern Web Guidance compliant) */
dialog:modal {
  margin: auto;
  width: min(620px, calc(100% - 2rem));
  max-height: calc(100dvh - 2rem);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  color: var(--text);
  padding: 0;
  box-shadow: var(--shadow-lg);
  overscroll-behavior: contain;
}

dialog.dialog-wide:modal {
  width: min(920px, calc(100% - 2rem));
}

dialog::backdrop {
  background: rgba(5, 5, 8, 0.78);
  backdrop-filter: blur(6px);
  overflow: hidden;
  overscroll-behavior: contain;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem 1.4rem;
  border-bottom: 1px solid var(--border);
}

.dialog-header h1 {
  font-size: 1.25rem;
  font-weight: 700;
}

.dialog-body {
  padding: 1.4rem;
  overflow-y: auto;
  max-height: calc(100dvh - 10rem);
}

.tabs {
  display: flex;
  gap: 0.4rem;
  padding: 0.3rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 1.15rem;
}

.tab-btn {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
}

.tab-btn.active {
  background: var(--bg-card);
  color: var(--text);
}

.divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0;
  color: var(--text-subtle);
  font-size: 0.8rem;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Admin Tables */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.admin-stat-box {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
}

.admin-stat-box strong {
  display: block;
  font-size: 1.4rem;
  font-family: "Outfit", sans-serif;
  color: var(--lime);
}

.admin-stat-box span {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table th,
.data-table td {
  padding: 0.65rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  background: var(--bg-input);
  color: var(--text-muted);
  font-weight: 600;
}

/* Toasts */
.toast-container {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-width: 360px;
}

.toast {
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  font-size: 0.88rem;
  font-weight: 500;
}

.toast.success {
  border-color: rgba(34, 197, 94, 0.5);
  color: #bbf7d0;
}

.toast.error {
  border-color: rgba(244, 63, 94, 0.5);
  color: #fecdd3;
}

/* Footer */
.site-footer {
  padding: 2.5rem 0;
  border-top: 1px solid var(--border);
  color: var(--text-subtle);
  font-size: 0.86rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
}

.hidden {
  display: none !important;
}

@media (max-width: 900px) {
  .hero-grid,
  .generator-layout,
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .nav-links {
    display: none;
  }
}

