/* ================================
   WN — Fabrica · Tema Oscuro F9
   ================================ */

/* -------- Variables -------- */
:root{
  --bg:#0b0d0f;
  --panel:#14171a;
  --panel-2:#1a1f24;
  --border:#252a31;
  --text:#e6e9ef;
  --muted:#a7b0bb;
  --brand:#1bb8ff;
  --accent:#f2b233;       /* amarillo F9 */
  --danger:#3a1515;
  --danger-border:#5a2222;
}

/* -------- Base -------- */
*{ box-sizing:border-box }
html,body{ height:100% }
body.app{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font:14px/1.5 system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,"Apple Color Emoji","Segoe UI Emoji";
}

/* -------- Layouts -------- */
.container{
  width:100%;
  max-width:1200px;
  margin:0 auto;
  padding:24px;
}
.page-title{
  margin:0 0 16px;
  font-size:28px;
  font-weight:700;
  letter-spacing:.2px;
}

/* Pantallas “en blanco” (login, etc.) centradas */
.center-screen{
  min-height:calc(100vh - 160px);
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  padding:24px;
  gap:16px;
}

/* -------- Tarjetas / Formularios -------- */
.card{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:14px;
  padding:18px;
}
.card--login{ width:min(900px, 100%); }

.form{ display:grid; gap:16px }
.form__group{ display:grid; gap:8px }
.form__label{ color:var(--muted); font-size:12px }
.input{
  background:var(--panel-2);
  border:1px solid var(--border);
  color:var(--text);
  border-radius:10px;
  height:44px;
  padding:0 12px;
  width:100%;
}
.card--login .input:focus{
  outline:2px solid rgba(255,255,255,.12);
  outline-offset:0;
}
.form__actions{ display:flex; justify-content:flex-end }

/* -------- Botones -------- */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  height:36px;
  padding:0 14px;
  border-radius:10px;
  border:1px solid var(--border);
  background:var(--panel-2);
  color:var(--text);
  cursor:pointer;
  text-decoration:none;
}
.btn--primary{
  background:var(--accent);
  color:#111;
  border-color:transparent;
  font-weight:600;
}

/* -------- Footer -------- */
.footer{
  margin-top:40px;
  padding:24px;
  border-top:1px solid var(--border);
  display:flex;
  gap:10px;
  align-items:center;
  justify-content:center;
  color:var(--muted);
}
.footer__inner{ display:flex; align-items:center; gap:12px; opacity:.9 }
.footer__logo{ width:28px; height:28px; display:block; border-radius:8px }
.footer__text{ font-size:14px; color:rgba(255,255,255,.75); letter-spacing:.2px }

/* -------- Topbar / Nav (centrado y estable) -------- */
.topbar{
  position:sticky;
  top:0;
  z-index:100;
  display:flex;
  align-items:center;
  justify-content:space-between; /* izquierda | centro | derecha */
  flex-wrap:nowrap;              /* evita que el botón Salir baje */
  gap:16px;
  padding:12px 20px;
  background:rgba(11,13,15,.75);
  backdrop-filter:blur(8px);
  border-bottom:1px solid var(--border);
  min-height:56px;
}

/* Izquierda: logo + usuario */
.topbar__left{
  display:flex;
  align-items:center;
  gap:10px;
  flex:0 0 auto;
}
.topbar__left img{
  width:28px; height:28px; border-radius:8px; opacity:.9;
}
.topbar__user{
  color:var(--text);
  font-size:14px;
  font-weight:500;
  letter-spacing:.2px;
}

/* Centro: nav centrado, adaptativo */
.topbar__center{
  flex:1 1 auto;
  min-width:0;               /* permite que el nav reduzca sin empujar acciones */
  display:flex;
  justify-content:center;
}
.nav{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  justify-content:center;
  align-items:center;
}
.chip{
  display:inline-block;
  padding:8px 12px;
  border-radius:999px;
  background:var(--panel-2);
  border:1px solid var(--border);
  color:var(--text);
  text-decoration:none;
}
.chip--active{ outline:2px solid var(--accent) }

/* Derecha: acciones (Salir) */
.topbar__actions{
  display:flex;
  align-items:center;
  gap:10px;
  flex:0 0 auto;
}

/* -------- Modal (reutilizable, versión F9) -------- */
.modal{
  position:fixed;
  inset:0;
  display:none;
  z-index:1000;
}
.modal.is-open{
  display:flex;
  align-items:center;
  justify-content:center;
}
.modal__backdrop{
  position:absolute;
  inset:0;
  background:rgba(0,0,0,.6);
  backdrop-filter:blur(3px);
}
.modal__box{
  position:relative;
  width:min(480px, 90vw);
  background:var(--panel-2);
  border:1px solid var(--border);
  color:var(--text);
  border-radius:16px;
  padding:28px 24px 24px;
  box-shadow:0 12px 40px rgba(0,0,0,.6);
  display:flex;
  flex-direction:column;
  gap:16px;
  text-align:center;
  animation:modalFadeIn .2s ease-out;
}
.modal__title{
  font-size:18px;
  font-weight:700;
  color:var(--accent);
  margin-bottom:4px;
}
.modal__content{
  color:var(--text);
  font-size:15px;
  opacity:.9;
  line-height:1.6;
  margin-bottom:8px;
}
.modal__actions{
  display:flex;
  justify-content:center;
  margin-top:10px;
}
.modal__actions .btn{
  min-width:120px;
  height:42px;
  border-radius:10px;
  font-weight:600;
  font-size:14px;
  box-shadow:0 2px 6px rgba(0,0,0,.4);
  transition:transform .1s ease, box-shadow .1s ease;
}
.modal__actions .btn:hover{
  transform:translateY(-1px);
  box-shadow:0 4px 10px rgba(0,0,0,.45);
}
@keyframes modalFadeIn{
  from{ opacity:0; transform:translateY(-8px) }
  to{ opacity:1; transform:translateY(0) }
}

/* -------- Utilidades -------- */
.text-center{ text-align:center }
.m-0{ margin:0 }
.mt-8{ margin-top:8px }
.mt-16{ margin-top:16px }
.mt-24{ margin-top:24px }

/* ===== Dashboard ===== */
.dashboard-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(220px,1fr));
  gap:20px;
  margin-top:24px;
}
.card--dashboard{
  text-align:center;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:12px;
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:14px;
  padding:28px 18px;
  min-height:160px;
}
.card-title{
  font-size:13px;
  color:var(--muted);
  letter-spacing:.5px;
}
.card-number{
  font-size:42px;
  font-weight:700;
  color:var(--text);
  margin:6px 0 8px;
}
.card--dashboard .btn{
  margin-top:auto;
  background:var(--panel-2);
  border:1px solid var(--border);
  color:var(--text);
  transition:all .2s ease;
}
.card--dashboard .btn:hover{
  background:var(--accent);
  color:#111;
  border-color:transparent;
}

/* (Soporte a otra variante estadística que ya tenías) */
.stats-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(240px,1fr));
  gap:20px;
}
.stat-card{
  display:flex;
  flex-direction:column;
  align-items:center;
  text-align:center;
  gap:12px;
  min-height:150px;
  justify-content:center;
}
.stat-card__title{
  color:var(--muted);
  font-size:12px;
  letter-spacing:.8px;
}
.stat-card__value{
  font-size:42px;
  font-weight:800;
  letter-spacing:.5px;
  line-height:1;
}
.stat-card__action{ margin-top:4px; }

/* ===== Tabla de usuarios ===== */
.user-table{
  width:100%;
  border-collapse:collapse;
  text-align:center;
  margin:0 auto;
  background:var(--panel-2);
  border:1px solid var(--border);
  border-radius:14px;
  overflow:hidden;
}
.user-table th, .user-table td{
  padding:10px 12px;
  border-bottom:1px solid var(--border);
}
.user-table th{
  color:var(--muted);
  text-transform:uppercase;
  font-size:12px;
  letter-spacing:.6px;
  background:var(--panel);
}
.user-table tr:last-child td{
  border-bottom:none;
}
.user-table input[type="checkbox"]{
  width:18px;
  height:18px;
  accent-color:var(--accent);
  cursor:pointer;
}
/* ===== Sección principal (bajo nav) ===== */
.section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 40px 24px;
  min-height: calc(100vh - 180px);
}

/* Tabla centrada y ajustada */
.table-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  width: min(1000px, 95%);
  margin-top: 20px;
  box-shadow: 0 10px 25px rgba(0,0,0,.25);
}

.table-card table {
  width: 100%;
  border-collapse: collapse;
  text-align: center;
}

.table-card th, .table-card td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

.table-card th {
  color: var(--muted);
  font-size: 13px;
  letter-spacing: .5px;
  text-transform: uppercase;
}

.table-card td {
  color: var(--text);
}

/* Centrado del botón "Nuevo usuario" */
.actions-top {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}

/* ===== Toast F9 ===== */
.toast-root{
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1500;
  display: grid;
  gap: 10px;
}
.toast{
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
  min-width: 260px;
  max-width: 420px;
  display: grid;
  gap: 6px;

  /* Estado inicial (oculto) + transición suave */
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .2s ease, transform .2s ease;
}
.toast.is-visible{
  opacity: 1;
  transform: translateY(0);
}
.toast__title{
  font-weight: 700;
  letter-spacing: .2px;
}
.toast__msg{
  opacity: .9;
}
.toast--success .toast__title{ color: var(--accent); } /* ámbar F9 */
.toast--error{
  border-color: var(--danger-border);
  background: var(--danger);
}

/* === Botones F9 estilo amarillo === */
.btn--f9 {
  background: #f0ad34;
  color: #000;
  font-weight: 600;
  border-radius: 8px;
  padding: 8px 18px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all .2s ease-in-out;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.btn--f9:hover {
  background: #ffbe47;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0,0,0,0.25);
}
.btn--f9:active {
  background: #d5952d;
  transform: translateY(0);
} 

/* ===== MODAL F9 ===== */
.f9-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
}
.f9-modal__box {
  background: #1d2025;
  border: 1px solid #2d3035;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.4);
  width: 420px;
  max-width: 90%;
  padding: 20px;
  color: #fff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.f9-modal__header {
  border-bottom: 1px solid #333;
  padding-bottom: 6px;
  margin-bottom: 10px;
}
.f9-modal__title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #f0ad34;
}
.f9-modal__body p {
  margin: 8px 0;
  font-size: 14px;
  color: #ddd;
}
.f9-modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

/* === Botones F9 === */
.f9-btn {
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s ease-in-out;
}
.f9-btn--main {
  background: #f0ad34;
  color: #000;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
.f9-btn--main:hover {
  background: #ffbe47;
  transform: translateY(-1px);
}
.f9-btn--ghost {
  background: #2a3037;
  color: #fff;
}
.f9-btn--ghost:hover {
  background: #343b44;
}

/* Ocultar modal en impresión */
@media print {
  .f9-modal { display: none !important; }
}
