/* intranet.css - SOLO overrides (no tocar style.css) */

/* ==============================
   TARJETAS / FORMULARIOS
   ============================== */

.card { padding: 1.1rem; }

.form-grid{
  display:grid;
  grid-template-columns:repeat(2, 1fr);
  gap:1rem;
}
@media (max-width: 800px){
  .form-grid{grid-template-columns:1fr;}
}

.label{
  font-weight:600;
  font-size:.9rem;
  margin-bottom:.35rem;
  display:block;
}

.input, .select,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea{
  width:100%;
  padding:.65rem .75rem;
  border:1px solid var(--line);
  border-radius:8px;
  background:#fff;
  font-size:.9rem;
}

.actions{
  display:flex;
  gap:.6rem;
  flex-wrap:wrap;
  margin-top:1rem;
}

/* ==============================
   BOTONES
   ============================== */

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:.45rem .9rem !important;
  border-radius:8px !important;
  background:linear-gradient(135deg, #0B2F63, #00A6D6) !important;
  color:#ffffff !important;
  font-weight:600;
  font-size:.9rem;
  border:none;
  cursor:pointer;
  box-shadow:none !important;
  transition:all .2s ease-in-out;
}
.btn:hover{ background:linear-gradient(135deg, #09264f, #0092c0) !important; }
.btn:active{ transform:translateY(1px); }

.btn.danger,
.btn-danger{
  background:#ffffff !important;
  color:#b91c1c !important;
  border:1px solid #b91c1c !important;
}
.btn.danger:hover,
.btn-danger:hover{
  background:#fee2e2 !important;
  color:#991b1b !important;
  border-color:#991b1b !important;
}

td .btn{ margin-right:.35rem; }

/* ==============================
   TABLAS (1 sola definición)
   ============================== */

.table-wrap{
  width:100%;
  max-height:65vh;
  overflow:auto;
  -webkit-overflow-scrolling:touch;
  border-radius:16px;
  border:1px solid rgba(0,0,0,.06);
  background:#fff;
}

.table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  font-size:.95rem;
  background:#fff;
}

.table thead th{
  text-align:left;
  font-weight:800;
  padding:.85rem .9rem;
  background:#f7fafc;
  border-bottom:1px solid rgba(15, 23, 42, .10);
  white-space:nowrap;
  position:sticky;
  top:0;
  z-index:5;
}

.table td{
  padding:.85rem .9rem;
  border-bottom:1px solid rgba(15, 23, 42, .08);
  vertical-align:middle;
}

.table tbody tr:nth-child(even){ background:#fbfdff; }
.table tbody tr:hover{ background:#f2f8ff; }
.table tbody tr:last-child td{ border-bottom:none; }

.table th:last-child,
.table td:last-child{
  text-align:right;
  white-space:nowrap;
}

.table a{
  text-decoration:none;
  font-weight:600;
}

/* Badges */
.badge{
  display:inline-flex;
  align-items:center;
  padding:.25rem .55rem;
  border-radius:999px;
  font-size:.82rem;
  font-weight:700;
  border:1px solid rgba(15, 23, 42, .12);
}
.badge--ok{ background:#ecfdf5; color:#065f46; border-color:#a7f3d0; }
.badge--off{ background:#fef2f2; color:#991b1b; border-color:#fecaca; }

/* ==============================
   HR
   ============================== */

hr{
  border:0;
  border-top:1px solid var(--line);
}

/* ==============================
   HEADER COMPACTO (2 líneas)
   ============================== */

.site-header{ background:#fff; }

.topbar{
  padding:8px 0;
  border-bottom:1px solid rgba(0,0,0,.08);
}
.topbar__inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
}

/* Logo compacto (el “espacio” grande se reduce aquí) */
.brand{
  display:flex;
  align-items:center;
  min-height:44px;
}
.brand{
  min-height:auto;
  line-height:0;           /* mata espacio fantasma */
}

.brand img{
  height:80px;
  width:auto;
  display:block;
}

.topbar{
  padding:0;
}

.topmenu{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:8px;
  justify-content:flex-end;
  text-align:right;
}
.topmenu__sep{ opacity:.4; }
.topmenu__link{ text-decoration:none; }
.topmenu__link:hover{ text-decoration:underline; }

/* Línea 2: módulos */
.navrow{
  padding:8px 0;
  border-bottom:1px solid rgba(0,0,0,.08);
}
.mainnav{
  display:flex;
  flex-wrap:wrap;
  gap:10px 18px;
  align-items:center;
}
.mainnav__link{
  text-decoration:none;
  padding:6px 10px;
  border-radius:10px;
  white-space:nowrap;
}
.mainnav__link:hover{ background:rgba(0,0,0,.05); }

/* Si quieres que quede “pegado” al hacer scroll (opcional) */
.site-header{
  position:sticky;
  top:0;
  z-index:1000;
}

/* Evita que el header tape anclas o scroll hacia inputs */
.main{ padding:1.2rem 0 1.6rem; }

/* ====== UI forms (VIONEXA intranet) ====== */
.form-card h2 { margin: 0 0 10px 0; }

.form-grid {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px 14px;
  align-items: center;
}

.form-grid label {
  font-weight: 600;
  color: #111827;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
  max-width: 520px;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  outline: none;
}

.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus {
  border-color: #c7d2fe;
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}

.form-section {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}

.form-actions {
  margin-top: 14px;
  display: flex;
  gap: 10px;
}

/* Tabla asignación multiempresa */
.table-compact {
  width: 100%;
  border-collapse: collapse;
}

.table-compact th,
.table-compact td {
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
  vertical-align: middle;
}

.table-compact thead th {
  text-align: left;
  font-weight: 700;
  color: #111827;
}

/* Reset pass: grid cómodo */
.reset-grid {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 12px;
  align-items: end;
}

@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid input, .form-grid select, .form-grid textarea { max-width: 100%; }
  .reset-grid { grid-template-columns: 1fr; }
}

/* =========================
   TABLAS - ESTÁNDAR VIONEXA
   ========================= */

/* Contenedor opcional (si quieres el borde y redondeo como en la captura) */
.table-wrap {
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
}

/* La tabla como tal */
.table-ui,
.table-compact { /* <- si quieres que table-compact adopte este diseño */
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

/* Encabezado */
.table-ui thead th,
.table-compact thead th {
  background: #f3f4f6;          /* gris claro como la captura */
  color: #111827;
  font-weight: 800;
  text-align: left;
  padding: 16px 16px;
  border-bottom: 1px solid #e5e7eb;
}

/* Celdas */
.table-ui tbody td,
.table-compact tbody td {
  padding: 18px 16px;          /* alto de fila “elegante” */
  border-bottom: 1px solid #eef2f7;
  vertical-align: middle;
  color: #111827;
}

/* Zebra (filas alternadas) */
.table-ui tbody tr:nth-child(even),
.table-compact tbody tr:nth-child(even) {
  background: #f3f8ff;          /* azul suave como en tu captura */
}

/* Hover */
.table-ui tbody tr:hover,
.table-compact tbody tr:hover {
  filter: brightness(0.99);
}

/* Quitar borde de la última fila */
.table-ui tbody tr:last-child td,
.table-compact tbody tr:last-child td {
  border-bottom: none;
}

/* Acciones alineadas a la derecha */
.td-actions {
  text-align: right;
  white-space: nowrap;
}

/* Botones pequeños para acciones dentro de tablas */
.btn-sm {
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 800;
  border: 1px solid transparent;
  cursor: pointer;
}

/* Variante azul (Editar / Asignar) */
.btn-primary-sm {
  background: #0b3a63;
  color: #fff;
}
.btn-primary-sm:hover { filter: brightness(1.05); }

/* Variante roja outline (Eliminar) */
.btn-danger-outline-sm {
  background: #fff;
  color: #b91c1c;
  border-color: #ef4444;
}
.btn-danger-outline-sm:hover {
  background: rgba(239, 68, 68, 0.06);
}

/* Badge de estado (si lo usas) */
.badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}
.badge.ok { background: rgba(16,185,129,.14); color: #065f46; }
.badge.off { background: rgba(239,68,68,.12); color: #7f1d1d; }

/* =========================
   TOPBAR / HEADER DE LISTADOS
   ========================= */
.page-title {
  font-size: 44px;
  font-weight: 900;
  margin: 0 0 14px 0;
  letter-spacing: -0.02em;
}

.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin: 10px 0 18px 0;
}

.toolbar__left,
.toolbar__right {
  display: flex;
  gap: 12px;
  align-items: center;
}

.toolbar__right input,
.toolbar__right select {
  height: 44px;
  border-radius: 14px;
  border: 1px solid #e5e7eb;
  padding: 0 14px;
  background: #fff;
  min-width: 260px;
}

.toolbar__right select {
  min-width: 110px;
}

@media (max-width: 860px) {
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar__left, .toolbar__right { justify-content: flex-start; flex-wrap: wrap; }
  .toolbar__right input { min-width: 100%; }
}

/* =========================
   BOTONES CON GRADIENTE (estilo compras/POS)
   ========================= */


.btn-grad:hover { filter: brightness(1.06); }


.btn-grad-outline:hover { background: rgba(11,58,99,.04); }

.btn-danger-outline {
  height: 44px;
  padding: 0 18px;
  border-radius: 16px;
  font-weight: 900;
  cursor: pointer;
  background: #fff;
  color: #b91c1c;
  border: 1px solid #ef4444;
}

.btn-danger-outline:hover { background: rgba(239, 68, 68, 0.06); }

/* Botones pequeños dentro de tablas (para Editar) */

/* =========================
   BOTONES ESTÁNDAR VIONEXA
   ========================= */

.btn {
  background: linear-gradient(135deg, #1f4e79, #1aa3c8);
  color: #fff;
  border: none;
  border-radius: 16px;
  padding: 10px 22px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 2px solid #1f4e79;
  color: #1f4e79;
  border-radius: 16px;
  padding: 8px 20px;
  font-weight: 600;
  cursor: pointer;
}

.btn-sm {
  padding: 6px 14px;
  border-radius: 12px;
  font-size: 13px;
}

/* Autocomplete dropdown */
.ac__dropdown{
  position:absolute;
  left:0;
  right:0;
  top: calc(100% + 6px);
  background:#fff;
  border:1px solid rgba(0,0,0,.10);
  border-radius:12px;
  box-shadow:0 12px 30px rgba(0,0,0,.10);
  max-height:280px;
  overflow:auto;
  z-index: 50;
  padding:6px;
}

.ac__item{
  padding:10px 12px;
  border-radius:10px;
  cursor:pointer;
  user-select:none;
  font-weight:600;
  font-size:14px;
}

.ac__item:hover,
.ac__item--active{
  background: rgba(0,0,0,.05);
}

/* === FORM COMPACT MODE (clientes / proveedores / etc) === */

.input,
select.input,
textarea.input {
  padding: 8px 12px !important;
  font-size: 14px !important;
  min-height: 38px !important;
}

textarea.input {
  min-height: 80px !important;
}

label,
.form-label {
  font-size: 14px !important;
}

/* filas del formulario */
.form-row,
.form-row > div {
  margin-bottom: 10px !important;
}

/* titulo */
.page h1 {
  font-size: 2rem !important;
  margin-bottom: 12px !important;
}

/* card padding */
.card > div {
  padding: 16px !important;
}

/* botones */
.btn {
  padding: 6px 14px !important;
  font-size: 14px !important;
}
/* =========================
   MENÚ INFERIOR AGRUPADO
   (solo para .mainnav en header.php)
   ========================= */

.mainnav .nav__dropdown:hover .nav__menu,
.mainnav .nav__dropdown:focus-within .nav__menu{
  display:block;
}

/* Evita que el botón “mueva” altura o se vea como botón nativo */
.mainnav .nav__link--btn{
  padding:6px 10px;
}

/* ===== Login logo centrado ===== */
.login-topbar{
  justify-content:center !important;
}

.login-brand{
  display:flex;
  justify-content:center;
  width:100%;
}

.login-brand img{
  height:110px;
  width:auto;
}

/* ===== FIX VISUAL: inputs visibles aunque falten variables CSS ===== */

:root{
  --line: #d9dde3;  /* fallback */
}

/* Card visible */
.card{
  background:#fff;
  border:1px solid rgba(0,0,0,.08);
  border-radius:16px;
  box-shadow:0 8px 24px rgba(0,0,0,.06);
}

/* Borde con fallback + texto siempre visible */
.input, .select,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea{
  background:#fff !important;
  border:1px solid var(--line, #d9dde3) !important;
  color:#111 !important;
}

/* Asegurar separación */
.form-row{ margin-bottom: 12px !important; }


/* ==============================
   FIX DEFINITIVO: FORMS INVISIBLES EN .card
   (Empresas / Clientes / Proveedores)
   ============================== */

:root{ --line:#d9dde3; }

/* Asegura que la tarjeta no tape su contenido */
.card{
  position: relative !important;
  background:#fff !important;
  border:1px solid rgba(0,0,0,.08) !important;
  border-radius:16px !important;
  box-shadow:0 8px 24px rgba(0,0,0,.06) !important;
  overflow: visible !important;   /* evita “cortes” */
}

/* Si style.css usa overlays en .card */
.card::before,
.card::after{
  content: none !important;
  display: none !important;
}

/* Fuerza visibilidad del contenido */
.card,
.card *{
  visibility: visible !important;
  opacity: 1 !important;
}

/* Z-index de hijos por si hay overlay externo */
.card > *{
  position: relative !important;
  z-index: 2 !important;
}

/* Inputs visibles aunque falten variables */
.input, .select,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea{
  background:#fff !important;
  border:1px solid var(--line, #d9dde3) !important;
  color:#111 !important;
  -webkit-text-fill-color:#111 !important;
  caret-color:#111 !important;
}
