/* ==========================================================================
   Nexus · tema Mikrobiomik
   Única fuente de verdad de la marca. Los colores salen de mikrobiomik.net
   (tema Salient: accent #ea5195, extra-color-1 #067078, -2 #46bcc9, -3 #f28c22).
   Nunca escribir hex en las plantillas: usar estos tokens.
   ========================================================================== */

/* --- Tipografías (servidas en local, sin CDN) --------------------------- */
@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 300 800;
  src: url("../fonts/open-sans-latin-wght-normal.dcf31ebe1074.woff2") format('woff2-variations');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 300 800;
  src: url("../fonts/open-sans-latin-ext-wght-normal.062c1f2aaf2d.woff2") format('woff2-variations');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: 'Arvo';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url("../fonts/arvo-latin-400-normal.0373e3f7dcf2.woff2") format('woff2');
}
@font-face {
  font-family: 'Arvo';
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url("../fonts/arvo-latin-700-normal.8e02198be3fd.woff2") format('woff2');
}

/* --- Tokens ------------------------------------------------------------- */
:root {
  /* Marca */
  --nexus-primary:        #067078;   /* teal del logotipo */
  --nexus-primary-dark:   #055a60;   /* hover */
  --nexus-primary-light:  #46bcc9;   /* acentos, foco */
  --nexus-primary-rgb:    6, 112, 120;

  --nexus-accent:         #ea5195;   /* rosa: detalles, nunca fondo de texto pequeño */
  --nexus-accent-dark:    #c2286b;   /* rosa apto para texto sobre blanco (AA) */
  --nexus-accent-warm:    #f28c22;   /* naranja de marca */
  --nexus-gradient:       linear-gradient(to right, #ea5195, #067078);

  /* Funcionales */
  --nexus-success: #28a745;
  --nexus-warning: #ffc107;          /* siempre con texto oscuro */
  --nexus-danger:  #dc3545;
  --nexus-info:    #17a2b8;

  /* Neutros */
  --nexus-bg:         #f6f8fa;
  --nexus-card:       #ffffff;
  --nexus-surface:    #e9ecef;
  --nexus-text:       #212529;
  --nexus-text-muted: #6c757d;
  --nexus-border:     #dee2e6;

  --nexus-font-body:    'Open Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --nexus-font-display: 'Arvo', Georgia, 'Times New Roman', serif;

  /* --- Bootstrap 5: que sus componentes usen la marca ------------------- */
  --bs-primary:              var(--nexus-primary);
  --bs-primary-rgb:          var(--nexus-primary-rgb);
  --bs-primary-text-emphasis:#03383c;
  --bs-primary-bg-subtle:    #dff0f1;
  --bs-primary-border-subtle:#a9d5d8;
  --bs-link-color:           var(--nexus-primary);
  --bs-link-color-rgb:       var(--nexus-primary-rgb);
  --bs-link-hover-color:     var(--nexus-primary-dark);
  --bs-link-hover-color-rgb: 5, 90, 96;
  --bs-body-font-family:     var(--nexus-font-body);
  --bs-body-font-size:       0.875rem;       /* 14px: alta densidad de datos */
  --bs-body-color:           var(--nexus-text);
  --bs-border-color:         var(--nexus-border);
  --bs-focus-ring-color:     rgba(var(--nexus-primary-rgb), .25);
}

/* `.btn-primary` no lee --bs-primary: Bootstrap compila sus colores dentro
   del propio botón, así que hay que sobreescribir sus variables. */
.btn-primary,
.btn-nx-primary {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--nexus-primary);
  --bs-btn-border-color: var(--nexus-primary);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--nexus-primary-dark);
  --bs-btn-hover-border-color: var(--nexus-primary-dark);
  --bs-btn-focus-shadow-rgb: var(--nexus-primary-rgb);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #04484d;
  --bs-btn-active-border-color: #04484d;
  --bs-btn-disabled-color: #fff;
  --bs-btn-disabled-bg: var(--nexus-primary);
  --bs-btn-disabled-border-color: var(--nexus-primary);
}
.btn-outline-primary {
  --bs-btn-color: var(--nexus-primary);
  --bs-btn-border-color: var(--nexus-primary);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--nexus-primary);
  --bs-btn-hover-border-color: var(--nexus-primary);
  --bs-btn-focus-shadow-rgb: var(--nexus-primary-rgb);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--nexus-primary-dark);
  --bs-btn-active-border-color: var(--nexus-primary-dark);
  --bs-btn-disabled-color: var(--nexus-primary);
  --bs-btn-disabled-border-color: var(--nexus-primary);
}
.btn-nx-secondary {
  --bs-btn-color: #495057;
  --bs-btn-bg: #fff;
  --bs-btn-border-color: var(--nexus-border);
  --bs-btn-hover-color: var(--nexus-text);
  --bs-btn-hover-bg: var(--nexus-bg);
  --bs-btn-hover-border-color: #ced4da;
  --bs-btn-focus-shadow-rgb: var(--nexus-primary-rgb);
  --bs-btn-active-color: var(--nexus-text);
  --bs-btn-active-bg: var(--nexus-surface);
  --bs-btn-active-border-color: #ced4da;
  --bs-btn-disabled-color: #495057;
  --bs-btn-disabled-bg: #fff;
  --bs-btn-disabled-border-color: var(--nexus-border);
}
.btn { --bs-btn-border-radius: 6px; --bs-btn-font-size: .875rem; }
.btn:disabled, .btn.disabled { cursor: not-allowed; pointer-events: auto; }

.form-control, .form-select { font-size: .875rem; }
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  border-color: var(--nexus-primary-light);
  box-shadow: 0 0 0 .2rem rgba(var(--nexus-primary-rgb), .2);
}
.form-check-input:checked {
  background-color: var(--nexus-primary);
  border-color: var(--nexus-primary);
}
.dropdown-menu {
  --bs-dropdown-font-size: .875rem;
  --bs-dropdown-link-active-bg: var(--nexus-primary);
}
.pagination {
  --bs-pagination-color: var(--nexus-primary);
  --bs-pagination-hover-color: var(--nexus-primary-dark);
  --bs-pagination-active-bg: var(--nexus-primary);
  --bs-pagination-active-border-color: var(--nexus-primary);
}
.nav-pills { --bs-nav-pills-link-active-bg: var(--nexus-primary); }
.text-accent { color: var(--nexus-accent-dark) !important; }
.table { --bs-table-bg: transparent; }
.table > thead th { font-size: 13px; font-weight: 600; color: var(--nexus-text-muted); white-space: nowrap; }

/* --- Estructura --------------------------------------------------------- */
/* El fondo de la app va en <body>, no en --bs-body-bg: Bootstrap reutiliza esa
   variable para inputs, modales y desplegables, que deben seguir siendo blancos. */
html, body { height: 100%; }
body { display: flex; flex-direction: column; min-height: 100vh; background: var(--nexus-bg); }
.nx-main { flex: 1 0 auto; }

/* Barra superior */
.nx-navbar {
  background: var(--nexus-primary);
  min-height: 52px;
  padding-top: 0;
  padding-bottom: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
}
.nx-navbar .navbar-brand { display: flex; align-items: center; min-height: 52px; padding: 0; margin-right: 1.75rem; }
.nx-navbar .navbar-brand img { height: 20px; width: auto; filter: brightness(0) invert(1); } /* logotipo en blanco */
.nx-navbar .nav-link {
  color: rgba(255, 255, 255, .85);
  font-weight: 600;
  padding: .95rem .85rem;
  border-bottom: 3px solid transparent;
}
.nx-navbar .nav-link:hover,
.nx-navbar .nav-link:focus-visible { color: #fff; background: rgba(255, 255, 255, .08); }
.nx-navbar .nav-link.active { color: #fff; border-bottom-color: var(--nexus-accent); }
.nx-navbar .navbar-toggler { border-color: rgba(255, 255, 255, .4); color: #fff; padding: .25rem .5rem; }
.nx-navbar :focus-visible { outline: 2px solid #fff; outline-offset: 2px; box-shadow: none; }
.nx-user-btn {
  display: inline-flex; align-items: center; gap: .5rem;
  background: transparent; border: 0; color: #fff; font-weight: 600;
  padding: .4rem .5rem; border-radius: 6px;
}
.nx-user-btn:hover { background: rgba(255, 255, 255, .1); }
@media (max-width: 767.98px) {   /* menú desplegado en vertical: indicador a la izquierda */
  .nx-navbar .nav-link { padding: .6rem .85rem; border-bottom: 0; border-left: 3px solid transparent; }
  .nx-navbar .nav-link.active { border-left-color: var(--nexus-accent); }
}

/* Migas, cabecera de página */
.nx-breadcrumb { background: #f1f3f5; padding: .4rem 1rem; font-size: 13px; color: var(--nexus-text-muted); }
.nx-breadcrumb a { text-decoration: none; }
.nx-breadcrumb a:hover { text-decoration: underline; }
.nx-page-header {
  background: var(--nexus-card);
  border-bottom: 1px solid var(--nexus-border);
  padding: .75rem 1rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.nx-page-title { font-size: 20px; font-weight: 600; color: var(--nexus-text); margin: 0; }
.nx-page-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.nx-content { padding: 1.25rem 1rem; }

.nx-card {
  background: var(--nexus-card);
  border: 1px solid var(--nexus-border);
  border-radius: 8px;
}
.nx-empty { text-align: center; color: var(--nexus-text-muted); padding: 2.5rem 1rem; }
.nx-empty .bi { font-size: 2rem; display: block; margin-bottom: .5rem; color: var(--nexus-primary-light); }

/* Barra de filtros */
.nx-filter-bar { display: flex; align-items: center; flex-wrap: wrap; background: #fff; border-radius: 6px; padding: .25rem; }

/* Avatares */
.nx-avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  border-radius: 50%; color: #fff; background: var(--nexus-primary); font-weight: 700; line-height: 1;
}
.nx-avatar-xs { width: 24px; height: 24px; font-size: 9px; }
.nx-avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.nx-avatar-inverse { background: #fff; color: var(--nexus-primary); }
.nx-avatar-stack > .nx-avatar { margin-left: -8px; border: 2px solid #fff; }

/* Pie: crédito de la plataforma */
.nx-footer {
  flex: none;
  background: var(--nexus-card);
  border-top: 1px solid var(--nexus-border);
  color: var(--nexus-text-muted);
  font-size: 12px;
  text-align: center;
  padding: 1.1rem 1rem;
}

/* --- Inicio (hub de módulos) ------------------------------------------- */
.nx-display { font-family: var(--nexus-font-display); font-weight: 400; letter-spacing: -.01em; }
.nx-hub-greeting { font-size: 26px; margin: 0; color: var(--nexus-primary); }
.nx-module {
  display: flex; align-items: center; gap: .9rem; height: 100%;
  padding: 1rem; text-decoration: none; color: var(--nexus-text);
  background: var(--nexus-card); border: 1px solid var(--nexus-border); border-radius: 8px;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.nx-module:hover { border-color: var(--nexus-primary-light); box-shadow: 0 4px 14px rgba(var(--nexus-primary-rgb), .12); transform: translateY(-1px); color: var(--nexus-text); }
.nx-module:focus-visible { outline: 2px solid var(--nexus-primary-light); outline-offset: 2px; }
.nx-module-icon {
  width: 44px; height: 44px; flex: none; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.25rem; color: var(--nexus-primary); background: var(--bs-primary-bg-subtle);
}
.nx-module-title { font-weight: 700; font-size: 15px; }
.nx-module-text { color: var(--nexus-text-muted); font-size: 13px; }

/* --- Acceso (login, restablecer contraseña) ----------------------------- */
.nx-auth { display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; }
.nx-auth-card {
  position: relative; overflow: hidden;
  width: 100%; max-width: 400px;
  background: var(--nexus-card);
  border: 1px solid var(--nexus-border);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(var(--nexus-primary-rgb), .08);
  padding: 2.25rem 2rem 2rem;
}
.nx-auth-card::before {   /* franja con el degradado de la marca */
  content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--nexus-gradient);
}
.nx-auth-logo { display: block; width: 230px; max-width: 80%; height: auto; margin: 0 auto 1.75rem; }
.nx-auth-title { font-family: var(--nexus-font-display); font-size: 20px; font-weight: 400; text-align: center; margin: 0 0 .35rem; color: var(--nexus-text); }
.nx-auth-text { text-align: center; color: var(--nexus-text-muted); margin: 0 0 1.5rem; }
.nx-auth-card .form-label { font-size: 13px; font-weight: 600; margin-bottom: .3rem; }
.nx-auth-card .form-control { padding: .6rem .75rem; }
.nx-auth-card .btn { --bs-btn-border-radius: 200px; --bs-btn-padding-y: .6rem; font-weight: 600; } /* botón píldora, como la web */
.nx-auth-link { display: block; text-align: center; margin-top: 1.1rem; font-size: 13px; }
.nx-auth-icon { display: block; text-align: center; font-size: 2.25rem; color: var(--nexus-primary); margin-bottom: .75rem; }

/* --- CRUD inline (design_system.md §7) ---------------------------------- */
/* Campo editable: invisible hasta hover, PERO visible al foco (a11y). */
.edit-field { min-width: 110px; max-width: 180px; border: 1px solid transparent; background: transparent; }
.edit-field[type=email] { min-width: 200px; }  /* en pantallas estrechas la tabla hace scroll, no aplasta los campos */
.user-row:hover { background: var(--nexus-bg); }
.user-row:hover .edit-field,
.edit-field:focus { border-color: var(--nexus-border); background: #fff; }
.edit-field:focus { outline: 2px solid var(--nexus-primary-light); outline-offset: 1px; box-shadow: none; }
.edit-field.is-saving { border-color: var(--nexus-primary-light); background: #fff; }
.edit-field.is-saved { border-color: var(--nexus-success); background: #fff; }
.edit-field.is-error { border-color: var(--nexus-danger); background: #fff; }
.btn-action { padding: .2rem .5rem; font-size: .8rem; }
.password-input { max-width: 160px; font-size: .85rem; }

@media (prefers-reduced-motion: reduce) {
  .nx-module { transition: none; }
  .nx-module:hover { transform: none; }
}
