/* Inventario Bomberos Granada — tema profesional sobre Bootstrap 5 */
:root {
  --bom-red: #c1121f;
  --bom-red-dark: #7f1d1d;
  --bom-ink: #0f172a;
  --bom-muted: #64748b;
  --bom-bg: #f1f5f9;
  --bom-card: #ffffff;
  --bom-line: #e2e8f0;
  --bom-amber: #f59e0b;
  --bom-radius: 16px;
  --bom-shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 8px 24px -12px rgba(15, 23, 42, .18);
}

html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bom-bg); color: var(--bom-ink);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ---------- Layout app: sidebar + contenido ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 264px; flex-shrink: 0;
  flex-direction: column;
  background: linear-gradient(180deg, #1c0a0a 0%, #450a0a 45%, #7f1d1d 100%);
  color: #fca5a5;
}
@media (min-width: 992px) {
  .sidebar { position: sticky; top: 0; height: 100vh; }
}
.sidebar-mobile {
  width: 280px;
  background: linear-gradient(180deg, #1c0a0a 0%, #450a0a 45%, #7f1d1d 100%);
  color: #fca5a5;
}
.sidebar-brand {
  display: flex; align-items: center; gap: .6rem;
  padding: 1.1rem 1.2rem; color: #fff; text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
}
.sidebar-brand:hover { color: #fff; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--bom-red), #ef4444);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; box-shadow: 0 4px 14px rgba(0, 0, 0, .4);
}
.brand-name { font-weight: 800; letter-spacing: -.01em; line-height: 1.1; }
.brand-sub { font-size: .72rem; color: #fca5a5; letter-spacing: .08em; text-transform: uppercase; }
.nav-section {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .1em;
  color: rgba(252, 165, 165, .7); padding: 1rem 1.2rem .3rem; margin: 0;
}
.sidebar .nav-link, .sidebar-mobile .nav-link {
  display: flex; align-items: center; gap: .7rem;
  margin: .1rem .7rem; padding: .6rem .8rem; border-radius: 10px;
  color: #fecaca; font-weight: 500;
}
.sidebar .nav-link i, .sidebar-mobile .nav-link i { font-size: 1.05rem; width: 1.4rem; text-align: center; }
.sidebar .nav-link:hover, .sidebar-mobile .nav-link:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.sidebar .nav-link.active, .sidebar-mobile .nav-link.active { background: #fff; color: var(--bom-red-dark); font-weight: 700; }
.sidebar-foot {
  margin-top: auto; padding: 1rem 1.2rem;
  border-top: 1px solid rgba(255, 255, 255, .12); font-size: .8rem;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ---------- Topbar ---------- */
.topbar {
  background: rgba(255, 255, 255, .9); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--bom-line);
  padding: .6rem 1.25rem;
  display: flex; align-items: center; gap: 1rem;
}
.topbar .breadcrumb { margin: 0; font-size: .9rem; }
.topbar-user {
  margin-left: auto; display: flex; align-items: center; gap: .6rem;
  white-space: nowrap;
}
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--bom-red), var(--bom-red-dark));
  color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center;
}

/* ---------- Contenido ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin: 1.1rem 0 .9rem; flex-wrap: wrap; }
.page-head h2 { font-weight: 800; letter-spacing: -.02em; margin: 0; font-size: 1.65rem; }
.page-head h2 i { color: var(--bom-red); }
.page-head p { color: var(--bom-muted); margin: .15rem 0 0; font-size: .95rem; }

/* ---------- Tarjetas, botones, formularios ---------- */
.card { border-radius: var(--bom-radius); border: 1px solid var(--bom-line); box-shadow: var(--bom-shadow); }
.btn { border-radius: 10px; font-weight: 600; }
.btn-danger { background: linear-gradient(180deg, #d41f2c, var(--bom-red)); border-color: var(--bom-red-dark); }
.btn-danger:hover { background: var(--bom-red-dark); border-color: var(--bom-red-dark); }
.form-control, .form-select { border-radius: 10px; border-color: #cbd5e1; }
.form-control:focus, .form-select:focus { border-color: var(--bom-red); box-shadow: 0 0 0 .2rem rgba(193, 18, 31, .15); }
.form-label { font-weight: 600; font-size: .88rem; }
.input-group-text { background: #f8fafc; border-color: #cbd5e1; color: var(--bom-red); border-radius: 10px; }
.input-group .form-control, .input-group .form-select { border-left: 0; }
.input-group .form-control { border-radius: 0 10px 10px 0; }
.input-group .form-select { border-radius: 0 10px 10px 0; }

/* ---------- Tablas ---------- */
.table thead th {
  position: sticky; top: 0; z-index: 2;
  background: #f8fafc; color: #475569; border-bottom: 2px solid var(--bom-line);
  font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700;
}
.table td, .table th { vertical-align: middle; }
.table-sm td { padding-top: .6rem; padding-bottom: .6rem; }
.card h5 { font-weight: 700; margin-bottom: .8rem; }
.tabla-titulo { display: flex; align-items: center; gap: .5rem; }
.tabla-titulo .count {
  font-size: .75rem; font-weight: 700; background: #f1f5f9; color: #475569;
  border-radius: 999px; padding: .15rem .6rem;
}

/* Píldoras suaves de estado/rol */
.pill { display: inline-flex; align-items: center; gap: .35rem; font-weight: 600; font-size: .78rem; padding: .28rem .65rem; border-radius: 999px; white-space: nowrap; }
.pill .dot { width: .45rem; height: .45rem; border-radius: 50%; background: currentColor; }
.pill-verde { background: #dcfce7; color: #15803d; }
.pill-gris { background: #f1f5f9; color: #475569; }
.pill-rojo { background: #fee2e2; color: #b91c1c; }

/* Avatar con inicial */
.avatar-sm {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #64748b, #334155); color: #fff;
  font-weight: 700; font-size: .8rem;
  display: inline-flex; align-items: center; justify-content: center; margin-right: .45rem;
}

/* Acciones: botones icono sutiles */
.btn-ico { border-color: transparent; color: #64748b; }
.btn-ico:hover { background: #f1f5f9; color: var(--bom-ink); border-color: transparent; }
.btn-ico.btn-outline-danger { color: #b91c1c; }
.btn-ico.btn-outline-danger:hover { background: #fee2e2; color: #991b1b; }
.btn-ico.btn-outline-primary { color: #1d4ed8; }
.btn-ico.btn-outline-primary:hover { background: #dbeafe; color: #1e40af; }
.btn-ico.btn-outline-secondary:hover { background: #f1f5f9; color: var(--bom-ink); }
.table-hover tbody tr:hover { background: #fef2f2; }
.table { margin-bottom: 0; }

/* Nº de serie: chip monoespaciado con copiar al clic */
.badge-serie { font-family: ui-monospace, Consolas, monospace; font-size: .78rem; cursor: pointer; }
.badge-serie:hover { background: var(--bom-amber) !important; color: #000 !important; }

/* Grupos jerárquicos Parque → Ubicación */
.grupo-parque {
  font-weight: 800; letter-spacing: -.01em;
  border-left: 5px solid var(--bom-red);
  padding-left: .6rem; margin-top: 1.2rem;
}
.grupo-ubi { color: var(--bom-ink); }
.ubi-card { transition: transform .12s ease, box-shadow .12s ease; }
.ubi-card:hover { transform: translateY(-2px); }
.ubi-flex { flex: 1 1 260px; min-width: 0; }

/* Filtros fijos al hacer scroll */
.filtros-sticky { position: sticky; top: 64px; z-index: 5; }

/* KPIs del panel */
.stat { display: flex; gap: .9rem; align-items: center; }
.stat-ico {
  width: 52px; height: 52px; border-radius: 14px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; color: #fff;
}
.stat-rojo { background: linear-gradient(135deg, #ef4444, #991b1b); }
.stat-carbon { background: linear-gradient(135deg, #475569, #0f172a); }
.stat-ambar { background: linear-gradient(135deg, #f59e0b, #b45309); }
.stat-verde { background: linear-gradient(135deg, #22c55e, #15803d); }
.stat-num { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; line-height: 1; }
.stat-label { color: var(--bom-muted); font-size: .82rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }

/* ---------- Login pantalla dividida ---------- */
.login-split { min-height: 100vh; }
.login-brand {
  background: linear-gradient(160deg, #1c0a0a 0%, #7f1d1d 55%, #c1121f 100%);
  color: #fff; position: relative; overflow: hidden;
}
.login-brand::after {
  content: "🚒"; position: absolute; right: -30px; bottom: -50px;
  font-size: 12rem; opacity: .12;
}
.login-brand ul { list-style: none; padding: 0; }
.login-brand li { padding: .45rem 0; color: #fecaca; }
.login-brand li i { color: var(--bom-amber); margin-right: .5rem; }
.login-form-wrap { display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; background: var(--bom-bg); }
.login-form { width: 100%; max-width: 400px; }

/* Traslados: checklist táctil */
#listaSeries label {
  padding: .55rem .4rem; border-bottom: 1px solid #f1f5f9; font-size: 1.05rem; cursor: pointer;
}
#listaSeries label:hover { background: #fef2f2; }
#listaSeries input[type="checkbox"] { width: 1.3rem; height: 1.3rem; accent-color: var(--bom-red); }

/* Botones y controles táctiles en móvil */
@media (pointer: coarse) {
  .btn { min-height: 44px; }
  .form-control, .form-select { min-height: 44px; font-size: 1rem; }
}

/* Tablas → tarjetas en móvil */
@media (max-width: 767px) {
  table.table-stack thead { display: none; }
  table.table-stack, table.table-stack tbody, table.table-stack tr, table.table-stack td { display: block; width: 100%; }
  table.table-stack tr { border: 1px solid var(--bom-line); border-radius: 12px; margin-bottom: .7rem; background: #fff; padding: .4rem .6rem; }
  table.table-stack td { border: 0; padding: .25rem .2rem; }
  table.table-stack td::before {
    content: attr(data-label); display: block;
    font-size: .72rem; text-transform: uppercase; color: var(--bom-muted); font-weight: 600;
  }
  table.table-stack td.sin-etiqueta::before { content: none; }
  .filtros-sticky { top: 0; }
  .page-head h2 { font-size: 1.4rem; }
}

/* ---------- Impresión / PDF ---------- */
@media print {
  .sidebar, .sidebar-mobile, .topbar, footer, .no-print, .toast-container { display: none !important; }
  body { background: #fff; }
  .main, .app { display: block; }
  .container, .container-fluid { max-width: 100%; }
  .card { border: 1px solid #999; box-shadow: none !important; }
  .table thead th { position: static; }
  thead { display: table-header-group; }
  tr, .badge { break-inside: avoid; }
  .print-cabecera { display: block !important; }
  @page { margin: 12mm; @bottom-center { content: "Página " counter(page) " de " counter(pages); font-size: 9pt; } }
}
.print-cabecera { display: none; }
