/* Botón volver arriba a la derecha */
.top-right-actions{position:absolute;right:12px;top:12px;display:flex;gap:8px}
.btn.volver{background:#0b1224;color:#e2e8f0;border:1px solid rgba(255,255,255,.15);padding:6px 12px;border-radius:8px;text-decoration:none;font-size:12px;line-height:1;display:inline-block}
.btn.volver:hover{filter:brightness(1.1)}
@media print{ .top-right-actions{ display:none !important; } }

.btn-gold{
  display:inline-block;
  padding:8px 18px;
  border-radius:14px;
  background:linear-gradient(180deg, #ffd86a 0%, #e8b127 100%);
  border:1px solid #8e6a12;
  color:#111;
  font-weight:800;
  letter-spacing:.5px;
  text-transform:uppercase;
  text-decoration:none;
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,.6),
    0 3px 8px rgba(0,0,0,.35);
  transition:filter .15s ease, transform .05s ease;
}

:root{
  --bg:#0f0f12; --text:#eaeaf0; --panel:#1f1f1f;
  --border:#262626; --border-2:#333;
  --input-bg:#14161c; --input-border:#2a2a2a;
  --gold:#ffd966; --gold-border:#b28900; --white:#ffffff;
}
*{box-sizing:border-box}
html,body{height:100%}
body{ margin:0; background:var(--bg); color:var(--text);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica, Arial;
  line-height:1.35; -webkit-font-smoothing:antialiased; -moz-osx-font-smoothing:grayscale; }
.wrap{max-width:1600px;margin:32px auto;padding:0 12px;}
.title-row{ display:flex; align-items:center; gap:16px; flex-wrap:wrap; padding:10px 2px 16px; margin-bottom:16px; border-bottom:1px solid var(--border-2); }
.title-row .h1{ font-size: clamp(20px, 4vw,30px); font-weight: 900; color: var(--gold); letter-spacing:.5px; margin:0 10px 0 0; text-transform: uppercase; }
.switches{ display:flex; gap:12px; flex-wrap:wrap; }
.sw{ appearance:none; border:2px solid var(--gold-border); background:transparent; color:var(--gold); border-radius:14px; padding:10px 16px; font-weight:800; cursor:pointer; opacity:.5; transition:opacity .15s ease, transform .02s ease; }
.sw:active{ transform:translateY(1px); } .sw.active{ opacity:1; }

/* Layout de dos columnas */
.grid-2{ display:grid; grid-template-columns: 1fr minmax(520px, 640px); gap:16px; align-items:start; }
@media (max-width: 1000px){ .grid-2{ grid-template-columns: 1fr; } }
.teams-admin-layout{ display:block; }

.card{ background:var(--panel); border:1px solid var(--border); border-radius:12px; overflow:hidden; }
.card-header{ padding:16px 18px; border-bottom:1px solid var(--border-2); }
.title{ margin:0; font-size:20px; font-weight:800; color:var(--gold); }
.table-wrap{ width:100%; overflow-x:auto; }
table{ width:100%; border-collapse:collapse; font-size:14px; }
thead th{ text-align:left; padding:12px 12px; border-bottom:1px solid var(--border-2); white-space:nowrap; background:rgba(0,0,0,.06); }
tbody td{ padding:10px 12px; border-bottom:1px solid var(--border); vertical-align:middle; }
tr:last-child td{ border-bottom:0; }
.col-idx{ width:48px; opacity:.8; }
.input{ width:100%; background:var(--input-bg); color:var(--white); border:1px solid var(--input-border); border-radius:10px; padding:8px 10px; outline:none; }
.input::placeholder{ color:#8a93a3; }
.sala{ max-width:320px; } .location{ max-width:420px; }
#teamsAdminView table{ min-width:1300px; }
#teamsAdminView thead th:nth-child(2), #teamsAdminView tbody td:nth-child(2){width:240px;}
#teamsAdminView thead th:nth-child(3), #teamsAdminView tbody td:nth-child(3){width:220px;}
#teamsAdminView thead th:nth-child(4), #teamsAdminView tbody td:nth-child(4){width:220px;}
#teamsAdminView thead th:nth-child(5), #teamsAdminView tbody td:nth-child(5){width:240px;}
#teamsAdminView thead th:nth-child(6), #teamsAdminView tbody td:nth-child(6){width:320px;}
#teamsAdminView thead th:nth-child(7), #teamsAdminView tbody td:nth-child(7){width:150px;}
.footer{ display:flex; justify-content:flex-end; gap:10px; padding:14px 16px 18px; border-top:1px solid var(--border-2); background:rgba(0,0,0,.06); }
.btn{ border:1px solid var(--gold-border); background:transparent; color:var(--gold); padding:9px 14px; border-radius:12px; font-weight:800; cursor:pointer; }

/* Panel derecho: Editor de plantel */
.panel{ padding:12px 14px 14px; }
.row{ margin-bottom:14px; }
.hint{ opacity:.8; font-size:12px; margin-top:6px; }
select{ width:100%; background:#0f1116; color:var(--white); border:1px solid var(--input-border);
        border-radius:10px; padding:10px 12px; font-weight:700; outline:none }
.players{ margin-top:6px; display:flex; flex-direction:column; gap:10px }
.player-row{ display:grid; grid-template-columns:42px minmax(160px,1fr) 100px 142px 96px; align-items:center; gap:10px }
.player-dni,
.player-birth{ min-width:0; }
.pill{ width:25px; height:25px; border-radius:5px; background:#fff; color:#000;
       display:grid; place-items:center; font-weight:900 }
.btn-del{ border:1px solid var(--border-2); background:#1a1a1a; color:#d6d6d6; border-radius:18px;
          padding:8px 10px; font-weight:700; cursor:pointer }
.btn-del:hover{ background:#202020 }
.btn-save{ border:1px solid var(--gold-border); background:linear-gradient(180deg,var(--gold),#e6a800);
           color:#1b1600; font-weight:900; border-radius:12px; padding:10px 16px; cursor:pointer }

.toast{position:fixed;left:50%;bottom:16px;transform:translateX(-50%);background:#111;color:#fff;border:1px solid rgba(255,255,255,.18);padding:10px 14px;border-radius:999px;display:none}
.toast.show{display:block}

.team-actions-cell{
  white-space:nowrap;
  width:190px;
}
.btn-reset-pass{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:34px;
  height:34px;
  margin-right:6px;
  border:1px solid var(--gold-border);
  background:#11161f;
  color:var(--gold);
  border-radius:10px;
  font-size:16px;
  line-height:1;
  cursor:pointer;
  vertical-align:middle;
}
.btn-reset-pass:hover:not(:disabled){
  background:#1b1e22;
  filter:brightness(1.08);
}
.btn-reset-pass:disabled{
  opacity:.35;
  cursor:not-allowed;
}
.btn-team-planilla,
.btn-team-cruces{
  border-color:rgba(255,255,255,.22);
  color:#fff;
}

/* ===== Header ===== */
header.site-header{
  display:flex; align-items:center; gap:12px;
  padding:5px 5px; border-bottom:1px solid #222; position:relative;
  background:#111114;
}
header.site-header img{ height:60px; }

 .btn{ border:1px solid #b28900; background:transparent; color:var(--gold); font-weight:800; padding:5px 5px; border-radius:10px; text-decoration:none; display:inline-flex; align-items:center; justify-content:center;
}
.btn:hover{ background:#1b1e22 }
.btn-gold{
  background:linear-gradient(180deg, var(--gold), #e6a800);
  color:#1b1600;
}
.btn-gold:hover{ filter:brightness(1.05); }

header.site-header{ flex-direction:column; align-items:flex-start; }
.admin-shortcuts{
  display:grid;
  grid-template-columns:repeat(4, minmax(160px, 1fr));
  gap:10px;
  margin:0 0 16px;
}
.admin-shortcuts .btn{
  min-height:42px;
  text-align:center;
  padding:8px 10px;
}

/* ====== Responsive Header Buttons – Admin ====== */
@media (max-width: 768px) {
  header .btn-group {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: nowrap;
  }
  .btn-volver {
    margin-left: auto;
  }
}

/* ====== Header admin – versión mobile en una sola línea ====== */
@media (max-width: 768px) {
  header.site-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    padding: 4px 6px;
  }

  header.site-header img {
    height: 32px;
    width: auto;
    flex-shrink: 0;
  }

  .top-right-actions {
    position: static;
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 4px;
  }

  .top-right-actions .btn {
    font-size: 0.65rem;
    padding: 3px 8px;
    height: 26px;
    border-radius: 10px;
    white-space: nowrap;
    min-width: auto;
  }
}

/* ====== Header admin – compresión extra en pantallas muy chicas ====== */
@media (max-width: 480px) {
  header.site-header {
    gap: 4px;
    padding: 4px 4px;
  }

  .top-right-actions .btn {
    font-size: 0.58rem;
    padding: 2px 6px;
    height: 24px;
  }

  .btn-reset-pass{
    width:30px;
    height:30px;
    margin-right:4px;
    font-size:14px;
  }

  #btnFecha {
    font-size: 0;
  }
  #btnFecha::after {
    content: "PLANILLAS";
    font-size: 0.58rem;
    line-height: 1;
  }

  #btnChangePassword {
    font-size: 0;
  }
  #btnChangePassword::after {
    content: "Cambiar Contraseña";
    font-size: 0.58rem;
    line-height: 1;
  }
}

@media (max-width: 900px){
  .admin-shortcuts{
    grid-template-columns:repeat(2, minmax(130px, 1fr));
  }
}

@media (max-width: 520px){
  .admin-shortcuts{
    grid-template-columns:1fr;
  }
}

/* === Estilos popup cambiar contraseña === */
dialog.modal { padding: 0; border: none; background: transparent; }
dialog.modal::backdrop { background: rgba(0,0,0,.55); }
.modal__panel{
  background:#0f1115;
  border:1px solid #ffffff22;
  border-radius:18px;
  min-width: min(92vw, 560px);
  color:#e9e9e9;
  box-shadow: 0 18px 40px rgba(0,0,0,.55);
  font-family: inherit;
}
.modal__header{ padding:18px 20px; border-bottom:1px solid #ffffff1a; }
.modal__header h3{ margin:0; color:#ffd24d; letter-spacing:.02em; }
.modal__body{ padding:18px 20px; }
.field__label{ display:block; color:#cfcfcf; font-weight:700; margin:10px 0 6px; }
.field__control{
  width:100%;
  background:#151821;
  border:1px solid #2a2f3a;
  color:#e9e9e9;
  padding:10px 12px;
  border-radius:12px;
  outline:none;
}
.field__control:focus{ border-color:#caa64d; box-shadow:0 0 0 3px rgba(202,166,77,.15); }
.modal__footer{ padding:16px 20px; border-top:1px solid #ffffff1a; display:flex; gap:10px; justify-content:flex-end; }
.btn{ font-weight:800; border-radius:14px; padding:10px 14px; cursor:pointer; }
.btn-ghost{ background:transparent; color:#e9e9e9; border:1px solid #3a3f49; }
.btn-ghost:hover{ background:#171a22; }
.btn-primary{ background:linear-gradient(180deg,#f1cc4d,#caa64d); border:1px solid #b28900; color:#111; }
.btn-primary:hover{ filter:brightness(0.95); }
.error{ color:#ff6b6b; margin-top:8px; }
.success{ color:#4cd964; margin-top:8px; }

.modal__panel--reset{
  min-width: min(92vw, 620px);
}
.reset-pass-text{
  margin:0 0 12px;
  color:#e9e9e9;
}
.reset-pass-box{
  display:grid;
  grid-template-columns: 1fr auto;
  gap:10px;
  align-items:center;
}
.reset-pass-input{
  font-size:18px;
  font-weight:800;
  letter-spacing:.04em;
}
.btn-copy-pass{
  min-width:110px;
}
.reset-pass-hint{
  margin:10px 0 0;
  color:#cfcfcf;
}
.reset-pass-hint.is-copied{
  color:#4cd964;
}

/* --- Botón centrado en el header --- */
.header-middle{
  flex: 1;
  display: flex;
  justify-content: center;
}
.btn-cruces{
  background: transparent;
  color: #ffd966;
  border: 1px solid rgba(255,255,255,.25);
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}
.btn-cruces:hover{ background: rgba(255,255,255,.08); }

.btn-cruces.is-disabled{ opacity:.5; pointer-events:none; filter:grayscale(0.2); }

.field__toggle input[type="checkbox"]{
  accent-color: #d4af37;
}

/* ===== Plantel: importar + borradores ===== */
.roster-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
}
.roster-tools{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.btn-small{
  padding:7px 10px;
  border-radius:10px;
  font-size:12px;
}
.btn:disabled{
  opacity:.45;
  cursor:not-allowed;
}
.import-box{
  margin-top:10px;
  padding:12px;
  border:1px solid var(--border-2);
  border-radius:12px;
  background:rgba(0,0,0,.12);
}
.import-textarea{
  min-height:130px;
  resize:vertical;
  margin-top:8px;
}
.import-actions{
  display:flex;
  gap:8px;
  justify-content:flex-end;
  margin-top:10px;
  flex-wrap:wrap;
}
.wrap{
  zoom: 0.75;
}

@media (max-width: 768px){
  .wrap{
    zoom: 1;
  }
  .reset-pass-box{
    grid-template-columns: 1fr;
  }
  .btn-copy-pass{
    width:100%;
  }
  .player-row{
    grid-template-columns:32px 1fr;
  }
  .player-row .player-name,
  .player-row .player-dni,
  .player-row .player-birth{
    grid-column:2;
  }
  .player-row .btn-del{
    grid-column:2;
    width:100%;
  }
}



/* ====== Admin: pestaña Salas ====== */
[hidden]{
  display:none !important;
}

.salas-admin-card{
  width:100%;
}

#tbodySalas .sala-name,
#tbodySalas .sala-address,
#tbodySalas .sala-location{
  max-width:none;
}

#salasAdminView thead th:nth-child(2),
#salasAdminView tbody td:nth-child(2){ width:300px; }
#salasAdminView thead th:nth-child(3),
#salasAdminView tbody td:nth-child(3){ width:360px; }
#salasAdminView thead th:nth-child(4),
#salasAdminView tbody td:nth-child(4){ width:460px; }
#salasAdminView thead th:nth-child(5),
#salasAdminView tbody td:nth-child(5){ width:120px; }

.btn-del-sala{
  border:1px solid var(--border-2);
  background:#1a1a1a;
  color:#d6d6d6;
  border-radius:18px;
  padding:8px 10px;
  font-weight:700;
  cursor:pointer;
}
.btn-del-sala:hover{
  background:#202020;
}

/* ====== Exportar / importar tablas ====== */
.table-tools{
  align-items:center;
  flex-wrap:wrap;
}
.table-tools .btn{
  min-width:96px;
}
.table-tools .btn:last-child{
  background:linear-gradient(180deg,var(--gold),#e6a800);
  color:#1b1600;
}
@media (max-width: 520px){
  .table-tools{
    justify-content:stretch;
  }
  .table-tools .btn{
    flex:1 1 100px;
  }
}


/* ===== Header admin: botón carga manual torneo ===== */
@media (max-width: 480px) {
  #btnCargaManualTorneo {
    font-size: 0;
  }
  #btnCargaManualTorneo::after {
    content: "TORNEO";
    font-size: 0.58rem;
    line-height: 1;
  }
}

/* Campo contacto de salas */
.sala-contact{min-width:260px;}
#salasAdminView table{min-width:1100px;}
#salasAdminView thead th:nth-child(2),#salasAdminView tbody td:nth-child(2){width:240px;}
#salasAdminView thead th:nth-child(3),#salasAdminView tbody td:nth-child(3){width:260px;}
#salasAdminView thead th:nth-child(4),#salasAdminView tbody td:nth-child(4){width:320px;}
#salasAdminView thead th:nth-child(5),#salasAdminView tbody td:nth-child(5){width:300px;}
#salasAdminView thead th:nth-child(6),#salasAdminView tbody td:nth-child(6){width:150px;}
