/* ============================================================
   Playzone Comisiones — mismos colores, fuentes y decoración
   que adventurepark.club (paleta y tipografía compartidas).
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@600;700;800&family=Nunito:wght@400;600;700;800&display=swap');

:root {
  --purple: #7C3AED;
  --purple-dark: #4A3574;
  --pink: #FF3D77;
  --pink-dark: #E01E5A;
  --blue: #2E9AFE;
  --blue-dark: #1C7FE0;
  --yellow: #FFB800;
  --green: #4CD964;
  --green-dark: #33B24B;
  --page-bg: #F4F3FF;
  --color-white: #ffffff;
  --texto: #2B2140;
  --texto-secundario: #756e8c;
  --borde: #E5E1F5;
  --exito: #1C9A5B;
  --error: #D6336C;
  --font-display: 'Baloo 2', system-ui, sans-serif;
  --font-body: 'Nunito', system-ui, sans-serif;
  --radius: 20px;
  --shadow: 0 12px 30px rgba(74, 53, 116, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--page-bg);
  color: var(--texto);
  line-height: 1.55;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--purple-dark);
  margin: 0 0 .5em;
  line-height: 1.15;
}

/* ---- Auth pages (login/registro) ---- */
body.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--purple), var(--purple-dark));
  padding: 24px;
  position: relative;
  overflow: hidden;
}
body.auth-page::before,
body.auth-page::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
body.auth-page::before {
  width: 340px; height: 340px;
  background: rgba(255,184,0,.16);
  top: -120px; left: -100px;
}
body.auth-page::after {
  width: 280px; height: 280px;
  background: rgba(255,61,119,.18);
  bottom: -100px; right: -80px;
}

.auth-card {
  background: var(--color-white);
  border-radius: 26px;
  max-width: 440px;
  width: 100%;
  padding: 40px 32px 32px;
  box-shadow: 0 24px 60px rgba(0,0,0,.28);
  position: relative;
  z-index: 1;
}
.auth-logo-wrap { display: flex; justify-content: center; margin-bottom: 6px; }
.auth-logo {
  height: 72px; width: auto;
  filter: drop-shadow(0 10px 16px rgba(74,53,116,.2));
}
.auth-titulo {
  font-size: 1.4rem;
  color: var(--purple-dark);
  margin: 4px 0 18px;
  text-align: center;
}
.auth-form label { display: block; font-size: 13px; font-weight: 700; margin: 14px 0 5px; color: var(--texto); }
.auth-form input, .auth-form select {
  width: 100%; padding: 11px 14px; border: 2px solid var(--borde); border-radius: 12px;
  font-size: 14px; font-family: var(--font-body); background: #fbfaff; transition: border-color .2s ease;
}
.auth-form input:focus, .auth-form select:focus { outline: none; border-color: var(--pink); }
.auth-footer { text-align: center; font-size: 13px; margin-top: 18px; color: var(--texto-secundario); }
.auth-footer a { color: var(--pink); font-weight: 700; text-decoration: none; }

.btn-primary {
  width: 100%; margin-top: 22px; padding: 13px; border: none; border-radius: 999px;
  background: linear-gradient(135deg, var(--pink), #FF6B9D); color: #fff; font-weight: 800;
  font-family: var(--font-display); font-size: 15px; cursor: pointer; letter-spacing: .2px;
  box-shadow: 0 10px 22px rgba(255,61,119,.35);
  transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}
.btn-primary:hover { transform: translateY(-2px); filter: brightness(1.06); }

.btn-secundario {
  padding: 9px 16px; border: 2px solid var(--error); border-radius: 999px;
  background: #fff; color: var(--error); font-weight: 700; font-family: var(--font-display);
  font-size: 13px; cursor: pointer; transition: background .2s ease, color .2s ease;
}
.btn-secundario:hover { background: var(--error); color: #fff; }

.alert { padding: 13px 16px; border-radius: 12px; font-size: 14px; margin-bottom: 14px; font-weight: 600; border-left: 4px solid transparent; }
.alert-error   { background: #FDE8ED; color: var(--error); border-left-color: var(--error); }
.alert-success { background: #E6F6ED; color: var(--exito); border-left-color: var(--exito); }
.alert-info    { background: #EFEAFB; color: var(--purple-dark); border-left-color: var(--purple); }

/* ---- App layout (paneles logueados) ---- */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  background: linear-gradient(180deg, var(--purple), var(--purple-dark));
  color: #fff;
  padding: 24px 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  box-shadow: 6px 0 24px rgba(74,53,116,.18);
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-weight: 800; font-size: 15px;
  padding: 0 20px 20px;
  margin-bottom: 8px;
  border-bottom: 1px dashed rgba(255,255,255,.22);
}
.sidebar-logo-img { height: 34px; width: auto; border-radius: 8px; background: rgba(255,255,255,.9); padding: 3px; }

.sidebar-nav { display: flex; flex-direction: column; gap: 3px; padding: 0 12px; flex: 1; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  color: rgba(255,255,255,.88); text-decoration: none; padding: 11px 14px; font-size: 14px;
  font-weight: 700; border-radius: 12px; transition: background .2s ease, transform .2s ease;
}
.sidebar-nav a .ico { font-size: 15px; }
.sidebar-nav a:hover { background: rgba(255,255,255,.14); transform: translateX(3px); }
.sidebar-logout { margin-top: 14px !important; color: var(--yellow) !important; border-top: 1px dashed rgba(255,255,255,.22); padding-top: 16px !important; border-radius: 0 !important; }
.sidebar-logout:hover { background: rgba(255,184,0,.14) !important; }

.main-content { flex: 1; padding: 28px 36px 40px; }
.topbar { margin-bottom: 22px; }
.topbar h2 {
  margin: 0; color: var(--purple-dark); font-size: 1.7rem;
}
.topbar h2::after {
  content: "";
  display: block;
  width: 58px; height: 5px; margin-top: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--pink), var(--yellow));
}

.card {
  background: #fff; border-radius: var(--radius); padding: 22px; margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 18px; margin-bottom: 22px; }
.card-stat {
  position: relative;
  text-align: center;
  padding-top: 40px;
  overflow: visible;
  transition: transform .25s ease, box-shadow .25s ease;
}
.card-stat:hover { transform: translateY(-5px); box-shadow: 0 18px 36px rgba(74,53,116,.18); }
.card-stat::before {
  content: "★";
  position: absolute;
  top: -20px; left: 50%; transform: translateX(-50%);
  width: 50px; height: 50px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem; color: #fff;
  box-shadow: var(--shadow);
}
.card-stat:nth-child(5n+1)::before { content: "👥"; background: linear-gradient(135deg, var(--pink), #FF6B9D); }
.card-stat:nth-child(5n+2)::before { content: "🛒"; background: linear-gradient(135deg, var(--purple), #9B6BF0); }
.card-stat:nth-child(5n+3)::before { content: "💰"; background: linear-gradient(135deg, var(--yellow), #FFCF4D); color: var(--texto); }
.card-stat:nth-child(5n+4)::before { content: "💎"; background: linear-gradient(135deg, var(--green), #7BE28E); }
.card-stat:nth-child(5n+5)::before { content: "🔒"; background: linear-gradient(135deg, var(--blue), #63B4FF); }

.card-stat .label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--texto-secundario); margin-bottom: 6px; }
.card-stat .value { font-family: var(--font-display); font-size: 24px; font-weight: 800; color: var(--purple-dark); }

.tabla-datos { width: 100%; border-collapse: collapse; font-size: 13px; }
.tabla-datos th, .tabla-datos td { padding: 12px 18px; text-align: left; border-bottom: 1px solid var(--borde); }
.tabla-datos th { color: var(--texto-secundario); font-weight: 800; font-family: var(--font-display); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; background: var(--page-bg); }
.tabla-datos tbody tr { transition: background .15s ease; }
.tabla-datos tbody tr:hover { background: var(--page-bg); }

.badge { padding: 4px 12px; border-radius: 999px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .3px; }
.badge-disponible { background: #E6F6ED; color: var(--exito); }
.badge-escrow     { background: #FFF3D6; color: #B98900; }
.badge-retirado   { background: #E5E1F5; color: var(--purple-dark); }
.badge-anulado    { background: #FDE8ED; color: var(--error); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.form-grid label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 5px; }
.form-grid input, .form-grid select {
  width: 100%; padding: 11px 14px; border: 2px solid var(--borde); border-radius: 12px; font-size: 14px;
  font-family: var(--font-body); background: #fbfaff; transition: border-color .2s ease;
}
.form-grid input:focus, .form-grid select:focus { outline: none; border-color: var(--purple); }

.enlace-referido code {
  display: block; background: var(--page-bg); border: 2px dashed #d8cef7; padding: 12px 16px; border-radius: 12px; font-size: 13px; word-break: break-all;
}

/* ---- Árbol visual de "Mi Red" ---- */
.tree-scroll { overflow-x: auto; padding: 10px 10px 30px; }
.tree, .tree ul, .tree li { list-style: none; margin: 0; padding: 0; position: relative; }
.tree { display: flex; justify-content: center; min-width: max-content; }
.tree ul { display: flex; padding-top: 30px; }
.tree li { display: flex; flex-direction: column; align-items: center; padding: 30px 12px 0; }
.tree li::before, .tree li::after {
  content: ''; position: absolute; top: 0; right: 50%; width: 50%; height: 30px;
  border-top: 2px solid var(--borde);
}
.tree li::after { right: auto; left: 50%; border-left: 2px solid var(--borde); }
.tree li:only-child::before, .tree li:only-child::after { display: none; }
.tree li:only-child { padding-top: 0; }
.tree li:first-child::before, .tree li:last-child::after { border: 0 none; }
.tree li:last-child::before { border-right: 2px solid var(--borde); border-radius: 0 6px 0 0; }
.tree li:first-child::after { border-radius: 6px 0 0 0; }
.tree li > ul::before {
  content: ''; position: absolute; top: 0; left: 50%;
  border-left: 2px solid var(--borde); width: 0; height: 30px;
}

.tree-node {
  background: #fff; border: 2px solid var(--borde); border-radius: 14px;
  padding: 10px 14px; min-width: 150px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.tree-node.tree-node-root {
  border-color: var(--purple);
  background: linear-gradient(135deg, var(--purple), var(--purple-dark));
  color: #fff;
}
.tree-node.tree-node-root .tree-avatar { background: rgba(255,255,255,.22); color: #fff; }
.tree-node.tree-node-root .tree-code { color: #e6defc; }
.tree-node.is-active { border-color: var(--green); }
.tree-node.is-inactive { border-color: var(--borde); opacity: .8; }

.tree-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--pink), var(--purple));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 800; font-size: 13px;
}
.tree-name { font-weight: 800; font-size: 13px; text-align: center; max-width: 140px; }
.tree-code { font-size: 11px; color: var(--texto-secundario); }
.tree-expand {
  margin-top: 6px; width: 24px; height: 24px; border-radius: 50%; border: none;
  background: var(--purple); color: #fff; font-size: 14px; font-weight: 800; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .2s ease, transform .2s ease;
}
.tree-expand:hover { background: var(--pink); transform: scale(1.08); }
.tree-expand:disabled { opacity: .4; cursor: default; transform: none; }

@media (max-width: 860px) {
  .app-layout { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; overflow-x: auto; padding: 14px; }
  .sidebar-logo { display: none; }
  .sidebar-nav { flex-direction: row; }
  .main-content { padding: 20px; }
}
