/* ─── Variables ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blp-red:          #b91c1c;
  --blp-red-dark:     #991b1b;
  --blp-nav-bg:       #111111;
  --blp-title:        #111111;
  --blp-text:         #868990;
  --blp-text-dark:    #1f2937;
  --blp-border:       #e5e7eb;
  --blp-input-border: #d1d5db;
  --blp-green:        #046d01;
  --blp-bg:           #f9f9f9;
  --blp-surface:      #ffffff;

  --color-danger:   #dc2626;
  --color-success:  #16a34a;

  --nav-height:        52px;
  --blp-header-height: 30px;

  --font-sans: -apple-system, "system-ui", "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;

  --radius-sm:  4px;
  --radius-md:  10px;
  --radius-lg:  16px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.08);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.15);

  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
}

/* ─── Base ──────────────────────────────────────────────────────────────── */
html { font-size: 15px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  font-size: 15px;
  color: var(--blp-text);
  background: var(--blp-bg);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--blp-red); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }

/* ─── Layout ────────────────────────────────────────────────────────────── */
.app-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  padding: var(--spacing-lg);
  max-width: 1140px;
  width: 100%;
  margin: 0 auto;
}

/* ─── Site Header (sticky wrapper: blp-header + top-nav) ───────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
}

/* ─── BLP Header bar ────────────────────────────────────────────────────── */
.blp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #0d0d0d;
  height: var(--blp-header-height);
  padding: 0 var(--spacing-md);
  padding-top: env(safe-area-inset-top, 0);
  padding-left: max(var(--spacing-md), env(safe-area-inset-left, 0));
  padding-right: max(var(--spacing-md), env(safe-area-inset-right, 0));
  box-sizing: content-box;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.blp-header-club {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: rgba(255,255,255,.35);
}

.blp-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.blp-header-season {
  font-size: 11px;
  color: rgba(255,255,255,.4);
  padding: 2px 8px;
  background: rgba(255,255,255,.06);
  border-radius: 20px;
}

.blp-header-user {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,.7);
}

.blp-header-role {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.5);
}

.blp-header-role.is-director {
  background: rgba(185,28,28,.25);
  color: #f87171;
}

.blp-header-logout {
  font-size: 14px;
  color: rgba(255,255,255,.4);
  text-decoration: none;
  line-height: 1;
  transition: color .12s;
}

.blp-header-logout:hover {
  color: #f87171;
  text-decoration: none;
}

/* ─── Top Navigation ────────────────────────────────────────────────────── */
.top-nav {
  background: var(--blp-nav-bg);
  height: var(--nav-height);
}

.top-nav-inner {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 var(--spacing-md);
  gap: 2px;
}

/* Nav menu (desktop: fila horizontal) */
.nav-menu {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex: 1;
}

/* Logo */
.nav-logo {
  display: inline-flex;
  align-items: center;
  height: var(--nav-height);
  padding: 0 14px;
  text-decoration: none;
  flex-shrink: 0;
}

.nav-logo-text {
  font-size: 18px;
  font-weight: 900;
  color: #fff;
  letter-spacing: .04em;
}

/* Nav items */
.nav-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 13px 18px;
  color: #e2e8f0;
  font-size: 14px;
  font-weight: 600;
  background: none;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background .12s, color .12s;
  font-family: var(--font-sans);
  height: var(--nav-height);
}

.nav-item:hover {
  background: #000000;
  color: #ffffff;
  text-decoration: none;
}

.nav-item.active {
  background: var(--blp-red);
  color: #ffffff;
  text-decoration: none;
}

.nav-arrow { font-size: 0.6rem; opacity: .8; }


/* ─── Dropdown ──────────────────────────────────────────────────────────── */
.nav-dropdown { position: relative; }

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #1a1a1a;
  border: 1px solid rgba(255,255,255,.08);
  border-top: 2px solid var(--blp-red);
  border-radius: 0 0 10px 10px;
  box-shadow: var(--shadow-lg);
  padding: var(--spacing-md);
  gap: var(--spacing-lg);
  z-index: 300;
}

.nav-dropdown.open .nav-dropdown-menu { display: flex; }

.nav-dropdown-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 190px;
}

.nav-dropdown-heading {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.3);
  padding: 4px 10px 8px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  margin-bottom: 4px;
}

.nav-dropdown-item {
  display: block;
  padding: 7px 10px;
  color: rgba(255,255,255,.7);
  font-size: 13px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background .1s, color .1s;
}

.nav-dropdown-item:hover {
  background: var(--blp-red);
  color: #fff;
  text-decoration: none;
}

/* ─── Hamburger (móvil) ─────────────────────────────────────────────────── */
.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  margin-left: auto;
}

.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: rgba(255,255,255,.8);
  border-radius: 2px;
}

/* ─── Top bar (título de página) ────────────────────────────────────────── */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-lg);
}

.top-bar h1 {
  font-size: 22px;
  font-weight: 900;
  color: var(--blp-title);
}

/* ─── Cards ─────────────────────────────────────────────────────────────── */
.card {
  background: var(--blp-surface);
  border: 1px solid var(--blp-border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  color: var(--blp-text-dark);
}

.card + .card { margin-top: var(--spacing-md); }

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--blp-title);
  margin-bottom: var(--spacing-md);
}

/* ─── Botones ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: 11px var(--spacing-md);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: opacity .15s;
  white-space: nowrap;
  font-family: var(--font-sans);
}

.btn:hover { opacity: .85; text-decoration: none; }
.btn:active { opacity: .7; }

.btn-primary { background: var(--blp-red);  color: #fff; }
.btn-danger  { background: var(--color-danger); color: #fff; }
.btn-success { background: var(--color-success); color: #fff; }

.btn-outline {
  background: var(--blp-surface);
  border: 1px solid var(--blp-red);
  color: var(--blp-red);
  font-weight: 700;
}

.btn-outline-gray {
  background: var(--blp-surface);
  border: 1px solid var(--blp-border);
  color: var(--blp-text-dark);
}

.btn-export {
  background: var(--blp-surface);
  border: 1px solid var(--blp-red);
  color: var(--blp-red);
  font-size: 13px;
  font-weight: 700;
  padding: 7px 13px;
  border-radius: var(--radius-md);
}

.btn-sm   { padding: 6px 10px; font-size: 0.8rem; }
.btn-full { width: 100%; justify-content: center; }

/* ─── Formularios ───────────────────────────────────────────────────────── */
.form-group { margin-bottom: var(--spacing-md); }

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 4px;
  color: var(--blp-text-dark);
}

.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--blp-input-border);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: var(--font-sans);
  color: #111827;
  background: var(--blp-surface);
  transition: border-color .15s;
  -webkit-appearance: none;
}

.form-control:focus {
  outline: none;
  border-color: var(--blp-red);
  box-shadow: 0 0 0 3px rgba(185,28,28,.1);
}

.form-hint {
  display: block;
  font-size: 12px;
  color: var(--blp-text);
  margin-top: 4px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-md);
}

.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--spacing-md);
}

.form-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--spacing-md);
}

/* Título de sección dentro de una card */
.form-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--blp-text);
  margin-bottom: var(--spacing-md);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--blp-border);
}

/* Selector de días de entrenamiento */
.dias-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.dia-pill {
  cursor: pointer;
}

.dia-pill input[type="checkbox"] {
  display: none;
}

.dia-pill span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid var(--blp-border);
  font-size: 13px;
  font-weight: 700;
  color: var(--blp-text);
  background: var(--blp-surface);
  transition: background .12s, border-color .12s, color .12s;
  user-select: none;
}

.dia-pill input:checked + span {
  background: var(--blp-red);
  border-color: var(--blp-red);
  color: #fff;
}

.dia-pill:hover span {
  border-color: var(--blp-red);
  color: var(--blp-red);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--blp-text-dark);
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  accent-color: var(--blp-red);
  width: 16px;
  height: 16px;
}

select.form-control { cursor: pointer; }

/* ─── Tablas ────────────────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }

th, td {
  padding: 10px var(--spacing-sm);
  text-align: left;
  border-bottom: 1px solid var(--blp-border);
}

th {
  font-weight: 700;
  color: var(--blp-text-dark);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  background: #f9f9f9;
}

tr:hover td { background: #fafafa; }

/* ─── Badges ────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 600;
}

.badge-green  { background: #dcfce7; color: #166534; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-yellow { background: #fef9c3; color: #92400e; }
.badge-blue   { background: #dbeafe; color: #1e40af; }
.badge-gray   { background: #f1f5f9; color: #475569; }

/* ─── Alertas ───────────────────────────────────────────────────────────── */
.alert {
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-md);
  font-size: 14px;
  margin-bottom: var(--spacing-md);
  font-weight: 500;
}

.alert-error   { background: #fee2e2; color: #991b1b; border-left: 3px solid var(--color-danger); }
.alert-success { background: #dcfce7; color: #166534; border-left: 3px solid var(--color-success); }
.alert-info    { background: #fff5f5; color: #991b1b; border-left: 3px solid var(--blp-red); }

/* ─── Listas ────────────────────────────────────────────────────────────── */
.item-list { list-style: none; }

.item-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-sm) 0;
  border-bottom: 1px solid var(--blp-border);
}

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

/* ─── Login ─────────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-md);
  background:
    linear-gradient(135deg, #0a0a0a 0%, #1a0404 40%, #7f1d1d 75%, #b91c1c 100%);
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(185,28,28,.35) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(185,28,28,.2)  0%, transparent 50%);
  pointer-events: none;
}

.login-box {
  position: relative;
  background: rgba(255,255,255,.97);
  border-radius: 20px;
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 25px 60px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.08);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.login-logo h2 {
  font-size: 1.2rem;
  font-weight: 800;
  color: #111;
  margin: 0;
  letter-spacing: -.3px;
}

.login-forgot {
  display: block;
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
  color: var(--blp-text);
}
.login-forgot:hover { color: var(--blp-red); }

/* ─── Stats grid (dashboard) ────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
}

.stat-card {
  background: var(--blp-surface);
  border: 1px solid var(--blp-border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-md) var(--spacing-lg);
  text-align: center;
  text-decoration: none;
  display: block;
  transition: box-shadow .15s;
}

.stat-card:hover { box-shadow: var(--shadow-md); text-decoration: none; }

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 900;
  color: var(--blp-red);
  line-height: 1;
}

.stat-card .stat-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--blp-text);
  margin-top: 4px;
}

/* ─── Accesos directos (dashboard) ─────────────────────────────────────── */
.quick-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
}

.quick-link {
  background: var(--blp-surface);
  border: 1px solid var(--blp-border);
  border-radius: var(--radius-lg);
  padding: 14px;
  text-align: center;
  text-decoration: none;
  color: var(--blp-text-dark);
  font-size: 13px;
  font-weight: 600;
  transition: border-color .15s, box-shadow .15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.quick-link:hover { border-color: var(--blp-red); box-shadow: var(--shadow-sm); text-decoration: none; color: var(--blp-red); }

.quick-link-icon { font-size: 20px; }

/* ─── Utilidades ────────────────────────────────────────────────────────── */
.text-muted   { color: var(--blp-text); }
.text-sm      { font-size: 13px; }
.text-center  { text-align: center; }
.font-bold    { font-weight: 700; }
.mt-sm  { margin-top: var(--spacing-sm); }
.mt-md  { margin-top: var(--spacing-md); }
.mt-lg  { margin-top: var(--spacing-lg); }
.mb-md  { margin-bottom: var(--spacing-md); }
.flex   { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.hidden { display: none; }
.flex-gap { display: flex; gap: var(--spacing-sm); flex-wrap: wrap; }

/* ─── Módulo Ajustes — panel con menú lateral ───────────────────────────── */
.cfg-layout {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: var(--spacing-lg);
  align-items: start;
}

/* Menú lateral */
.cfg-sidebar {
  background: var(--blp-surface);
  border: 1px solid var(--blp-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: sticky;
  top: calc(var(--blp-header-height) + var(--nav-height) + 16px);
}

.cfg-group {
  padding: 12px 0 4px;
  border-bottom: 1px solid var(--blp-border);
}

.cfg-group:last-child { border-bottom: none; padding-bottom: 8px; }

.cfg-group-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--blp-text);
  padding: 0 16px 6px;
}

.cfg-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--blp-text-dark);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background .1s, color .1s, border-color .1s;
}

.cfg-link:hover {
  background: #f5f5f5;
  color: var(--blp-title);
  text-decoration: none;
}

.cfg-link--active {
  background: rgba(185,28,28,.06);
  color: var(--blp-red);
  border-left-color: var(--blp-red);
  font-weight: 600;
}

.cfg-link-icon { font-size: 15px; line-height: 1; }

/* Área de contenido */
.cfg-content {}

/* Títulos dentro del contenido */
.cfg-section-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--blp-title);
  margin-bottom: 6px;
}

.cfg-section-desc {
  font-size: 13px;
  color: var(--blp-text);
  line-height: 1.6;
  margin-bottom: 22px;
}

/* Caja informativa */
.cfg-info-box {
  background: #fff5f5;
  border: 1px solid #fecaca;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 13px;
  color: var(--blp-text-dark);
  line-height: 1.6;
}

/* Color picker */
.color-input-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
}

.color-picker {
  width: 44px;
  height: 40px;
  padding: 3px;
  border: 1px solid var(--blp-input-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  background: none;
  flex-shrink: 0;
}

.color-hex-input { flex: 1; }

/* Checklist de módulos */
.modules-checklist {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 8px;
}

.module-check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--blp-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 14px;
  color: var(--blp-text-dark);
  transition: background .1s, border-color .1s;
  user-select: none;
}

.module-check-item:hover { background: #f9fafb; }
.module-check-item input[type="checkbox"] { accent-color: var(--blp-red); flex-shrink: 0; }
.module-check-icon { font-size: 18px; }

/* ─── Tabla general ─────────────────────────────────────────────────────── */
.blp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.blp-table th {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--blp-text);
  padding: 8px 12px;
  text-align: left;
  border-bottom: 2px solid var(--blp-border);
}

.blp-table td {
  padding: 11px 12px;
  color: var(--blp-text-dark);
  border-bottom: 1px solid var(--blp-border);
  vertical-align: middle;
}

.blp-table tr:last-child td { border-bottom: none; }
.blp-table tr:hover td { background: #fafafa; }

/* ─── Móvil ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav-hamburger { display: flex; }

  .blp-header-club { display: none; }
  .blp-header-season { display: none; }

  .nav-menu {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    position: fixed;
    top: calc(var(--blp-header-height) + var(--nav-height));
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--blp-nav-bg);
    padding: var(--spacing-md);
    overflow-y: auto;
    z-index: 199;
    gap: 4px;
  }

  .nav-menu.open { display: flex; }

  .nav-item { width: 100%; height: auto; padding: 12px 14px; }

  .nav-dropdown { width: 100%; }

  .nav-dropdown-menu {
    position: static;
    box-shadow: none;
    border: none;
    border-top: none;
    border-radius: var(--radius-md);
    background: rgba(255,255,255,.05);
    flex-direction: column;
    margin-top: 4px;
  }

  .nav-dropdown.open .nav-dropdown-menu { display: flex; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .quick-links { grid-template-columns: repeat(2, 1fr); }

  .cfg-layout { grid-template-columns: 1fr; }
  .cfg-sidebar { position: static; }
  .form-grid-2, .form-grid-3, .form-grid-4 { grid-template-columns: 1fr; }

  .main-content { padding: var(--spacing-md); }
}

@media (min-width: 769px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
}
