/* =====================================================================
   RadioMonitor — estilo clásico de panel de administración (Bootstrap 3 / AdminLTE)
   ===================================================================== */
:root {
  --light-blue: #3c8dbc;
  --light-blue-dark: #367fa9;
  --sidebar: #222d32;
  --sidebar-hover: #1e282c;
  --content-bg: #ecf0f5;
  --text: #333;
  --muted: #777;
  --border: #f4f4f4;
  --aqua: #00c0ef;
  --green: #00a65a;
  --yellow: #f39c12;
  --red: #dd4b39;
  --gray: #d2d6de;
  --gray-dark: #999;
  --sidebar-w: 230px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 60px; }
body {
  margin: 0;
  background: var(--sidebar);
  color: var(--text);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.42857143;
}
a { color: var(--light-blue); text-decoration: none; }
a:hover { color: #72afd2; }
h1, h3, h4 { font-weight: 500; }
[hidden] { display: none !important; }
.text-right { text-align: right; }
.text-muted { color: var(--muted); }
.pull-right { float: right; }
code {
  padding: 2px 4px;
  font-size: 90%;
  color: #c7254e;
  background: #f9f2f4;
  border-radius: 4px;
  font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
}

/* ===== Cabecera ===== */
.main-header {
  position: fixed;
  inset: 0 0 auto 0;
  height: 50px;
  display: flex;
  z-index: 20;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .15);
}
.logo {
  width: var(--sidebar-w);
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--light-blue-dark);
  color: #fff;
  font-size: 20px;
  font-weight: 300;
}
.logo:hover { color: #fff; background: #357ca5; }
.logo b { font-weight: 700; }
.navbar {
  flex: 1;
  background: var(--light-blue);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 15px;
  min-width: 0;
}
.navbar-right { display: flex; align-items: center; gap: 18px; color: #fff; }
.nav-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  border-radius: 3px;
  background: rgba(0, 0, 0, .12);
  font-size: 13px;
  white-space: nowrap;
}
.nav-status .dot { width: 9px; height: 9px; border-radius: 50%; background: #bbb; flex: none; }
.nav-status--ok .dot { background: #4cd964; box-shadow: 0 0 0 2px rgba(255, 255, 255, .35); }
.nav-status--bad { background: var(--red); }
.nav-status--bad .dot { background: #fff; }
.nav-clock { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 700; }
.nav-clock svg { width: 15px; height: 15px; fill: currentColor; opacity: .85; }

/* ===== Menú lateral ===== */
.main-sidebar {
  position: fixed;
  top: 50px;
  bottom: 0;
  left: 0;
  width: var(--sidebar-w);
  background: var(--sidebar);
  z-index: 10;
}
.sidebar-menu { list-style: none; margin: 0; padding: 0; }
.sidebar-menu .header {
  color: #4b646f;
  background: #1a2226;
  padding: 10px 25px 10px 15px;
  font-size: 12px;
}
.sidebar-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 5px 12px 15px;
  color: #b8c7ce;
  border-left: 3px solid transparent;
}
.sidebar-menu svg { width: 15px; height: 15px; fill: currentColor; flex: none; }
.sidebar-menu li:hover > a { color: #fff; background: var(--sidebar-hover); border-left-color: var(--light-blue); }
.sidebar-menu li.active > a { color: #fff; background: var(--sidebar-hover); border-left-color: var(--light-blue); }

/* ===== Contenido ===== */
.content-wrapper {
  margin-left: var(--sidebar-w);
  padding-top: 50px;
  min-height: calc(100vh - 51px);
  background: var(--content-bg);
}
.content-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  padding: 15px 15px 0;
}
.content-header h1 { margin: 0; font-size: 24px; }
.content-header h1 small { font-size: 15px; color: var(--muted); font-weight: 300; padding-left: 4px; }
.breadcrumb { list-style: none; margin: 0; padding: 7px 5px; font-size: 12px; display: flex; }
.breadcrumb li + li::before { content: "›"; padding: 0 6px; color: #ccc; }
.breadcrumb .active { color: var(--muted); }
.content { padding: 15px; }

/* ===== Info boxes ===== */
.info-boxes { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 15px; margin-bottom: 20px; }
.info-box {
  display: flex;
  min-height: 90px;
  background: #fff;
  border-radius: 2px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .1);
  overflow: hidden;
  color: var(--text);
}
.info-box-icon {
  width: 90px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .2);
}
.info-box-icon svg { width: 44px; height: 44px; }
.info-box-content { padding: 6px 10px; min-width: 0; }
.info-box-text {
  display: block;
  font-size: 13px;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.info-box-number { display: block; font-size: 26px; font-weight: 700; line-height: 1.2; }
.info-box-more { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.info-box.filled { color: #fff; }
.info-box.filled .info-box-more { color: rgba(255, 255, 255, .9); }
.bg-aqua { background: var(--aqua) !important; }
.bg-green { background: var(--green) !important; }
.bg-yellow { background: var(--yellow) !important; }
.bg-red { background: var(--red) !important; }
.bg-gray { background: var(--gray-dark) !important; }
.bg-blue { background: var(--light-blue) !important; }

/* ===== Boxes ===== */
.box {
  position: relative;
  background: #fff;
  border-top: 3px solid var(--gray);
  border-radius: 3px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .1);
  margin-bottom: 20px;
  min-width: 0;
}
.box-primary { border-top-color: var(--light-blue); }
.box-success { border-top-color: var(--green); }
.box-info { border-top-color: var(--aqua); }
.box-default { border-top-color: var(--gray); }
.box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px;
  color: #444;
}
.box-header.with-border { border-bottom: 1px solid var(--border); }
.box-title { margin: 0; font-size: 18px; line-height: 1; display: flex; align-items: center; gap: 8px; }
.box-tools { font-size: 12px; color: var(--muted); }
.box-body { padding: 10px; }
.box-body.no-padding { padding: 0; }
.table-responsive { overflow-x: auto; }

.badge {
  display: inline-block;
  min-width: 10px;
  padding: 3px 7px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  text-align: center;
  white-space: nowrap;
  background: var(--light-blue);
  border-radius: 10px;
}

/* ===== Botones ===== */
.btn {
  display: inline-block;
  padding: 6px 12px;
  font: inherit;
  font-size: 14px;
  line-height: 1.42857143;
  border: 1px solid #ddd;
  border-radius: 3px;
  background: #f4f4f4;
  color: #444;
  cursor: pointer;
}
.btn:hover { background: #e7e7e7; }
.btn:focus-visible { outline: 2px solid var(--light-blue); outline-offset: 1px; }
.btn-xs { padding: 1px 7px; font-size: 12px; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: 3px 0 0 3px; }
.btn-group .btn:last-child { border-radius: 0 3px 3px 0; margin-left: -1px; }
.btn.active { background: #e7e7e7; box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125); }

/* ===== Etiquetas (labels) ===== */
.label {
  display: inline-block;
  padding: .25em .6em .3em;
  font-size: 75%;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  text-align: center;
  white-space: nowrap;
  vertical-align: baseline;
  border-radius: .25em;
}
.label-success { background: var(--green); }
.label-warning { background: var(--yellow); }
.label-danger { background: var(--red); }
.label-default { background: var(--gray-dark); }
.label-pending { margin-left: 6px; color: var(--muted); font-size: 12px; font-style: italic; }

/* ===== Tablas ===== */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 8px; vertical-align: middle; border-top: 1px solid var(--border); text-align: left; }
.table thead th { border-top: 0; border-bottom: 2px solid var(--border); white-space: nowrap; }
.table th.text-right, .table td.text-right { text-align: right; }
.table-condensed th, .table-condensed td { padding: 5px 8px; }
.table-striped tbody tr:nth-of-type(odd) { background: #f9f9f9; }
.table-hover tbody tr:hover { background: #f5f5f5; }
.units tbody tr { cursor: pointer; }
.units tbody tr:focus-visible { outline: 2px solid var(--light-blue); outline-offset: -2px; }
.units td { white-space: nowrap; }
.units .radio-name { font-weight: 700; color: #444; }
.units tr.row-warning td:first-child { box-shadow: inset 3px 0 0 var(--yellow); }
.units tr.row-danger td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.empty { text-align: center; color: var(--muted); padding: 18px !important; }
.log td { font-size: 13px; }
.log .when { white-space: nowrap; color: #555; }
.log .detail { color: var(--muted); }
.link-btn { all: unset; cursor: pointer; color: var(--light-blue); font-weight: 700; }
.link-btn:hover { color: #72afd2; text-decoration: underline; }
.link-btn:focus-visible { outline: 2px solid var(--light-blue); }
.arrow { color: var(--gray-dark); padding: 0 4px; }

/* ===== Barras de progreso ===== */
.progress {
  display: flex;
  height: 20px;
  overflow: hidden;
  background: #f5f5f5;
  border-radius: 4px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1);
}
.progress-bar {
  height: 100%;
  font-size: 12px;
  line-height: 20px;
  font-weight: 700;
  color: #fff;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .15);
  transition: width .6s ease;
}
.progress-bar-success { background-color: var(--green); }
.progress-bar-warning { background-color: var(--yellow); }
.progress-bar-danger { background-color: var(--red); }
.progress-bar-gray { background-color: var(--gray-dark); }
.progress-bar-empty { background-color: transparent; box-shadow: none; }
.progress-bar-aqua { background-color: var(--aqua); }
.progress-bar-striped {
  background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%,
    rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
  background-size: 40px 40px;
}
.progress.active .progress-bar-striped { animation: stripes 2s linear infinite; }
@keyframes stripes { from { background-position: 40px 0; } to { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { .progress.active .progress-bar-striped { animation: none; } }
.progress-xs { height: 9px; border-radius: 2px; width: 140px; }
.progress-xs .progress-bar { font-size: 0; }
.progress-sm { height: 14px; }

/* ===== Señales de distribución ===== */
.signal {
  all: unset;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: 220px minmax(200px, 1fr) 260px;
  gap: 6px 20px;
  align-items: center;
  width: 100%;
  padding: 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.signal:last-child { border-bottom: 0; }
.signal:hover { background: #f9f9f9; }
.signal:focus-visible { outline: 2px solid var(--light-blue); outline-offset: -2px; }
.signal-name { font-weight: 700; color: #444; font-size: 15px; }
.signal-name .label { margin-left: 6px; vertical-align: 2px; }
.signal-mount { margin-top: 3px; font-size: 12px; }
.signal-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.signal-head b { font-size: 14px; }
.signal-note { font-size: 13px; color: #555; }
.signal-note small { display: block; color: var(--muted); font-size: 12px; }

/* ===== Mapa ===== */
.row-main { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 0 20px; align-items: start; }
#map { display: block; width: 100%; height: auto; max-height: 78vh; }
.map-land { fill: #d2d6de; stroke: #b5bbc6; stroke-width: 1; stroke-linejoin: round; }
.map-leader { stroke: #b5bbc6; stroke-width: 1; fill: none; }
.map-dot { stroke: #fff; stroke-width: 2; }
.map-label { font: 12px "Helvetica Neue", Helvetica, Arial, sans-serif; fill: #444; }
.map-node { cursor: pointer; outline: none; }
.map-node:hover .map-label, .map-node:focus-visible .map-label { fill: var(--light-blue); font-weight: 700; }
.map-hit { fill: transparent; }
.dot--ok { fill: var(--green); }
.dot--warn { fill: var(--yellow); }
.dot--bad { fill: var(--red); }
.dot--unknown { fill: var(--gray-dark); }
.dot-ring { fill: none; stroke-width: 2; opacity: 0; }
.dot-ring--warn { stroke: var(--yellow); opacity: .5; }
.dot-ring--bad { stroke: var(--red); opacity: .5; }

/* ===== Pie ===== */
.main-footer {
  margin-left: var(--sidebar-w);
  padding: 15px;
  background: #fff;
  border-top: 1px solid #d2d6de;
  color: #444;
  font-size: 13px;
}

/* ===== Modal ===== */
dialog.modal {
  width: min(640px, calc(100vw - 20px));
  max-height: calc(100vh - 60px);
  margin: 30px auto auto;
  padding: 0;
  border: 1px solid rgba(0, 0, 0, .2);
  border-radius: 6px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, .5);
  color: var(--text);
  overflow: auto;
}
dialog.modal[open] { animation: drop .25s ease-out; }
@keyframes drop { from { transform: translateY(-25%); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { dialog.modal[open] { animation: none; } }
dialog::backdrop { background: rgba(0, 0, 0, .5); }
.modal-header { padding: 15px; border-bottom: 1px solid #e5e5e5; }
.modal-title { margin: 0; font-size: 20px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.modal-title .label { font-size: 12px; }
.modal-header .text-muted { font-size: 13px; margin-top: 4px; }
.close {
  float: right;
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  color: #000;
  opacity: .2;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0;
}
.close:hover { opacity: .5; }
.modal-body { padding: 15px; }
.modal-footer { padding: 12px 15px; text-align: right; border-top: 1px solid #e5e5e5; }
.modal h5 {
  margin: 18px 0 8px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  color: #555;
  border-bottom: 1px solid var(--border);
  padding-bottom: 5px;
}
.modal h5:first-child { margin-top: 0; }
.dl-horizontal { margin: 0; display: grid; grid-template-columns: 190px 1fr; gap: 5px 15px; }
.dl-horizontal dt { font-weight: 700; text-align: right; color: #555; }
.dl-horizontal dd { margin: 0; overflow-wrap: anywhere; }
.dl-horizontal .sub { color: var(--muted); font-size: 12px; }
.description-blocks { display: grid; grid-template-columns: repeat(3, 1fr); }
.description-block { text-align: center; padding: 5px; border-right: 1px solid var(--border); }
.description-block:last-child { border-right: 0; }
.description-header { margin: 0; font-size: 22px; font-weight: 700; }
.description-text { display: block; text-transform: uppercase; font-size: 12px; color: #555; }
.description-note { display: block; font-size: 12px; color: var(--muted); }
.axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; }
.help-block { font-size: 12px; color: #737373; margin: 8px 0 0; }

/* ===== KPI técnico ===== */
.box-warning { border-top-color: var(--yellow); }
.kpi-blocks { grid-template-columns: repeat(4, 1fr); }
.kpi-blocks .description-header { font-size: 26px; }
.kpi-blocks .of { font-size: 14px; color: var(--muted); font-weight: 400; }
.kpi-mini { display: inline-flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; justify-content: center; }
.score-cell { display: inline-flex; align-items: center; gap: 6px; }
.score-num { font-weight: 700; min-width: 26px; text-align: right; }
.stale { color: var(--yellow); font-weight: 700; cursor: help; }
.aire-tag { display: block; font-size: 11px; color: var(--red); font-weight: 700; margin-top: 2px; }
.callout {
  border-left: 5px solid #eee;
  padding: 10px 14px;
  margin: 8px 0;
  border-radius: 3px;
  color: #fff;
  font-size: 13px;
}
.callout-danger { background: var(--red); border-color: #c23321; }
.callout-warning { background: var(--yellow); border-color: #c87f0a; }
.callout-success { background: var(--green); border-color: #00733e; }
.callout-info { background: var(--aqua); border-color: #0097bc; }
.score-bars { display: grid; grid-template-columns: 110px 1fr 44px; gap: 6px 10px; align-items: center; font-size: 13px; }
.score-bars .progress { height: 12px; }
.score-bars .val { text-align: right; font-weight: 700; }
.tbl-mini td, .tbl-mini th { font-size: 12.5px; }

/* ===== Formularios ===== */
.modal .form-control { padding-right: 12px; height: 34px; }
.modal textarea.form-control { height: auto; min-height: 90px; resize: vertical; }
.modal select.form-control { padding-right: 8px; }
.control-label { display: block; font-weight: 700; margin-bottom: 5px; font-size: 13px; color: #444; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 15px; }
.form-group .help-block { margin: 4px 0 0; }
.has-error .form-control { border-color: var(--red); }
.has-error .control-label, .has-error .field-error { color: var(--red); }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.toolbar { margin: 0 0 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.btn-warning { background: var(--yellow); border-color: #e08e0b; color: #fff; }
.btn-warning:hover { background: #e08e0b; }
.btn-danger { background: var(--red); border-color: #d73925; color: #fff; }
.btn-danger:hover { background: #d73925; }
.btn:disabled { opacity: .65; cursor: default; }
.alert-success { background: var(--green); }
.origin { white-space: nowrap; font-size: 11.5px; }
.preview { color: #fff; }
@media (max-width: 480px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }

/* ===== Usuario / salir (cabecera) ===== */
.nav-user { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; }
.nav-user svg { width: 14px; height: 14px; fill: currentColor; }
.nav-user form { margin: 0; }
.btn-nav {
  all: unset;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 3px;
  background: rgba(0, 0, 0, .12);
  color: #fff;
  font-size: 13px;
}
.btn-nav:hover { background: rgba(0, 0, 0, .25); }
.btn-nav:focus-visible { outline: 2px solid #fff; }

/* ===== Login ===== */
.login-page { background: var(--gray); min-height: 100vh; display: flex; align-items: flex-start; justify-content: center; }
.login-box { width: 360px; max-width: calc(100% - 32px); margin: 9vh auto 0; }
.login-logo { font-size: 35px; text-align: center; margin-bottom: 25px; font-weight: 300; color: #444; }
.login-logo b { font-weight: 700; }
.login-box-body { background: #fff; padding: 20px; border-top: 3px solid var(--light-blue); box-shadow: 0 1px 1px rgba(0, 0, 0, .1); }
.login-box-msg { margin: 0 0 18px; text-align: center; color: #666; }
.login-foot { text-align: center; color: #666; font-size: 12px; margin-top: 14px; }
.form-group { margin-bottom: 15px; position: relative; }
.form-control {
  display: block;
  width: 100%;
  height: 34px;
  padding: 6px 34px 6px 12px;
  font: inherit;
  font-size: 14px;
  color: #555;
  background: #fff;
  border: 1px solid var(--gray);
  border-radius: 0;
  box-shadow: none;
}
.form-control:focus { border-color: var(--light-blue); outline: 0; }
.form-control-feedback { position: absolute; right: 10px; top: 10px; width: 14px; height: 14px; fill: #777; pointer-events: none; }
.btn-primary { background: var(--light-blue); border-color: var(--light-blue-dark); color: #fff; }
.btn-primary:hover { background: var(--light-blue-dark); }
.btn-block { display: block; width: 100%; }
.alert { padding: 10px 12px; margin-bottom: 15px; border-radius: 3px; color: #fff; font-size: 13px; }
.alert-danger { background: var(--red); }
.alert-info { background: var(--aqua); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ===== Responsive ===== */
@media (max-width: 1850px) {
  .info-boxes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1650px) {
  .row-main { grid-template-columns: minmax(0, 1fr); }
  #map { max-height: 60vh; }
}
@media (max-width: 1250px) {
  .c-bitrate, .c-region { display: none; }
  .kpi-blocks { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1000px) {
  .signal { grid-template-columns: minmax(0, 1fr); }
  .c-region, .c-avail { display: none; }
}
@media (max-width: 767px) {
  :root { --sidebar-w: 0px; }
  .main-sidebar { display: none; }
  .logo { width: auto; padding: 0 15px; font-size: 18px; flex: none; }
  .navbar { padding: 0 10px; }
  .navbar-right { gap: 10px; }
  #link-text, #nav-username, .nav-user > svg { display: none; }  /* en el celular basta el punto de color */
  .info-boxes { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .info-box-icon { width: 54px; }
  .info-box-icon svg { width: 28px; height: 28px; }
  .c-since, .c-strip { display: none; }
  .log .c-detail, .log td:nth-child(4) { display: none; }
  .dl-horizontal { grid-template-columns: 1fr; }
  .dl-horizontal dt { text-align: left; }
  .content, .content-header { padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 480px) {
  .nav-clock { display: none; }
  .info-boxes { grid-template-columns: minmax(0, 1fr); }
  .c-freq { display: none; }
  .description-blocks { grid-template-columns: 1fr; }
  .description-block { border-right: 0; border-bottom: 1px solid var(--border); }
}
