/* reports.css — Painel de Relatórios dmsmart */

/* ── Wrap ─────────────────────────────────────── */
.rpt-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px 0 40px;
}

/* ── Toolbar ──────────────────────────────────── */
.rpt-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
}

.rpt-toolbar-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.rpt-toolbar-right {
  display: flex;
  gap: 8px;
}

.rpt-period-group {
  display: flex;
  gap: 2px;
  background: rgba(255,255,255,.06);
  border-radius: 8px;
  padding: 3px;
}

.rpt-period-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,.55);
  font-size: 12px;
  padding: 5px 11px;
  border-radius: 6px;
  transition: background .15s, color .15s;
}
.rpt-period-btn:hover { color: rgba(255,255,255,.85); background: rgba(255,255,255,.08); }
.rpt-period-btn.active { background: #1f6feb; color: #fff; }

.rpt-zone-select {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  color: rgba(255,255,255,.8);
  font-size: 12px;
  padding: 6px 10px;
  cursor: pointer;
  outline: none;
  min-width: 160px;
}
.rpt-zone-select:focus { border-color: #1f6feb; }

.rpt-export-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  color: rgba(255,255,255,.7);
  font-size: 12px;
  padding: 6px 12px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.rpt-export-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.rpt-export-btn:hover { background: rgba(255,255,255,.12); color: #fff; }

/* ── KPI row ──────────────────────────────────── */
.rpt-summary-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.rpt-kpi {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  padding: 14px 16px;
}

.rpt-kpi-val {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
  margin-bottom: 4px;
}
.rpt-kpi-val--sm { font-size: 15px; line-height: 1.3; }

.rpt-kpi-label {
  font-size: 11px;
  color: rgba(255,255,255,.45);
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* ── Loading / Empty ──────────────────────────── */
.rpt-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 60px 20px;
  color: rgba(255,255,255,.45);
  font-size: 14px;
}
.rpt-spinner {
  width: 28px; height: 28px;
  border: 2px solid rgba(255,255,255,.12);
  border-top-color: #1f6feb;
  border-radius: 50%;
  animation: rpt-spin .8s linear infinite;
}
@keyframes rpt-spin { to { transform: rotate(360deg); } }

.rpt-empty {
  text-align: center;
  padding: 60px 20px;
  color: rgba(255,255,255,.35);
  font-size: 14px;
}

/* ── Tabela ───────────────────────────────────── */
.rpt-table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.08);
}

.rpt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.rpt-table thead th {
  background: rgba(255,255,255,.05);
  color: rgba(255,255,255,.45);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 10px 14px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.rpt-table tbody tr {
  border-bottom: 1px solid rgba(255,255,255,.05);
  transition: background .1s;
}
.rpt-table tbody tr:last-child { border-bottom: none; }
.rpt-table tbody tr:hover { background: rgba(255,255,255,.03); }

.rpt-table tbody td {
  padding: 10px 14px;
  color: rgba(255,255,255,.8);
  vertical-align: middle;
}

/* Linha de cabeçalho de zona */
.rpt-zone-row td {
  background: rgba(31,111,235,.08);
  color: #60a5fa;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  padding: 6px 14px !important;
}

/* Colunas */
.rpt-col-name { min-width: 180px; }
.rpt-entity-id {
  display: block;
  font-size: 10px;
  color: rgba(255,255,255,.3);
  margin-top: 1px;
  font-family: monospace;
}
.rpt-col-on { color: #4ade80; white-space: nowrap; }
.rpt-col-off { color: rgba(255,255,255,.4); white-space: nowrap; }
.rpt-col-avail { min-width: 140px; }
.rpt-col-cycles { text-align: center; white-space: nowrap; }
.rpt-col-last { white-space: nowrap; font-size: 12px; color: rgba(255,255,255,.5); }

/* Barra de disponibilidade */
.rpt-avail-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.rpt-avail-bar-bg {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,.1);
  border-radius: 3px;
  overflow: hidden;
  min-width: 60px;
}
.rpt-avail-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .3s;
}
.rpt-avail-bar-fill.rpt-avail--high { background: #4ade80; }
.rpt-avail-bar-fill.rpt-avail--mid  { background: #facc15; }
.rpt-avail-bar-fill.rpt-avail--low  { background: #f87171; }

.rpt-avail-pct {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  min-width: 38px;
  text-align: right;
}
.rpt-avail-pct.rpt-avail--high { color: #4ade80; }
.rpt-avail-pct.rpt-avail--mid  { color: #facc15; }
.rpt-avail-pct.rpt-avail--low  { color: #f87171; }

/* ── Footer ───────────────────────────────────── */
.rpt-footer {
  font-size: 11px;
  color: rgba(255,255,255,.3);
  text-align: right;
}

/* ── Responsive ───────────────────────────────── */
@media (max-width: 700px) {
  .rpt-summary-row { grid-template-columns: repeat(2, 1fr); }
  .rpt-toolbar { flex-direction: column; align-items: stretch; }
  .rpt-toolbar-right { justify-content: flex-end; }
  .rpt-col-last, .rpt-col-cycles { display: none; }
}

@media (max-width: 420px) {
  .rpt-summary-row { grid-template-columns: 1fr 1fr; }
  .rpt-kpi--wide { grid-column: span 2; }
  .rpt-period-btn { padding: 5px 8px; font-size: 11px; }
}
