/*
Theme Name: HermesData
Theme URI: https://hermesdata.com.br
Author: HermesData
Description: Tema profissional para plataforma IoT de telemetria industrial.
Version: 1.0
License: Proprietary
Text Domain: hermesdata-theme
*/

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&family=DM+Mono:wght@400;500&display=swap');

/* ── Variáveis ──────────────────────────────────────────────────────────────── */
:root {
  --bg:         #F5F6FA;
  --surface:    #FFFFFF;
  --surface2:   #F0F2F8;
  --border:     #E2E5EF;
  --text:       #1A1D2E;
  --text-muted: #7B82A0;
  --accent:     #1A6FFF;
  --accent-soft:#EEF4FF;
  --success:    #00C48C;
  --warning:    #FFB020;
  --danger:     #FF4D4F;
  --mono:       'DM Mono', monospace;
  --sans:       'DM Sans', sans-serif;
  --radius:     12px;
  --shadow:     0 2px 12px rgba(26,29,46,0.07);
  --shadow-lg:  0 8px 32px rgba(26,29,46,0.12);
}

/* ── Reset ───────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Layout ──────────────────────────────────────────────────────────────────── */
.hd-wrapper {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.hd-sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.hd-main {
  padding: 32px;
  overflow-x: hidden;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────────── */
.hd-logo {
  padding: 28px 24px 20px;
  border-bottom: 1px solid var(--border);
}

.hd-logo-text {
  font-family: var(--sans);
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.5px;
}

.hd-logo-text span { color: var(--accent); }

.hd-logo-sub {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-top: 3px;
}

.hd-client-info {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.hd-client-label {
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.hd-client-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.hd-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 20px;
  margin-top: 8px;
  font-weight: 500;
}

.hd-status-pill.online  { background: #E6FAF5; color: var(--success); }
.hd-status-pill.offline { background: #FFF0F0; color: var(--danger);  }
.hd-status-pill.waiting { background: #FFF8EC; color: var(--warning); }

.hd-status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.hd-status-pill.online .hd-status-dot {
  animation: blink 2s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

.hd-nav {
  padding: 16px 12px;
  flex: 1;
}

.hd-nav-label {
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 12px;
  margin-bottom: 8px;
}

.hd-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}

.hd-nav-item:hover  { background: var(--surface2); color: var(--text); }
.hd-nav-item.active { background: var(--accent-soft); color: var(--accent); }

.hd-nav-icon { font-size: 16px; width: 20px; text-align: center; }

.hd-equip-select {
  margin: 0 12px 12px;
}

.hd-equip-select select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--text);
  background: var(--surface2);
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237B82A0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.hd-sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Header ──────────────────────────────────────────────────────────────────── */
.hd-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
}

.hd-page-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.5px;
}

.hd-page-sub {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 3px;
}

.hd-last-update {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface2);
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

/* ── Cards de métricas ────────────────────────────────────────────────────────── */
.hd-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.hd-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.2s;
}

.hd-card:hover { box-shadow: var(--shadow-lg); }

.hd-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--card-accent, var(--accent));
  border-radius: var(--radius) var(--radius) 0 0;
}

.hd-card-label {
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.hd-card-value {
  font-family: var(--mono);
  font-size: 36px;
  font-weight: 500;
  color: var(--text);
  line-height: 1;
  transition: color 0.3s;
}

.hd-card-value.live { color: var(--card-accent, var(--accent)); }

.hd-card-unit {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 8px;
}

.hd-card-trend {
  position: absolute;
  bottom: 16px;
  right: 16px;
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--mono);
}

/* Card flash ao atualizar */
@keyframes cardFlash {
  0%   { background: var(--accent-soft); }
  100% { background: var(--surface); }
}
.hd-card.flash { animation: cardFlash 0.6s ease; }

/* ── Card de status ──────────────────────────────────────────────────────────── */
.hd-status-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.hd-status-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.hd-status-icon.online  { background: #E6FAF5; }
.hd-status-icon.offline { background: #FFF0F0; }
.hd-status-icon.waiting { background: #FFF8EC; }

.hd-status-info { flex: 1; }

.hd-status-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.hd-status-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.hd-ws-badge {
  font-family: var(--mono);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: all 0.3s;
}

.hd-ws-badge.connected {
  background: #E6FAF5;
  border-color: var(--success);
  color: var(--success);
}

/* ── Gráfico ──────────────────────────────────────────────────────────────────── */
.hd-chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.hd-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.hd-chart-header::-webkit-scrollbar { display: none; }

.hd-chart-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.hd-filter-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.hd-filter-row::-webkit-scrollbar { display: none; }

.hd-input {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--text);
  background: var(--surface2);
  outline: none;
  transition: border-color 0.2s;
}

.hd-input:focus { border-color: var(--accent); }

.hd-btn {
  padding: 7px 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s;
}

.hd-btn:hover { opacity: 0.85; }

.hd-btn-ghost {
  padding: 7px 16px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--sans);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.hd-btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ── Responsivo ──────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .hd-wrapper {
    grid-template-columns: 1fr;
  }
  .hd-sidebar {
    position: relative;
    height: auto;
  }
  .hd-main { padding: 16px; }
  .hd-card-value { font-size: 28px; }
}

/* ── Admin bar override ───────────────────────────────────────────────────────── */
#wpadminbar { display: none !important; }
html { margin-top: 0 !important; }

/* ── Mobile logo fix ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .hd-logo {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  .hd-logo img {
    margin: 0 auto;
    display: block;
  }
  .hd-logo-text, .hd-logo-sub {
    text-align: center;
  }
}

/* ── Botão Voltar — global ────────────────────────────────────────────────────── */
.hd-back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #F0F6FF;
  border: 1.5px solid #D0E4FF;
  color: #1A6FFF;
  text-decoration: none;
  flex-shrink: 0;
  transition: all 0.18s ease;
}
.hd-back-btn:hover {
  background: #1A6FFF;
  border-color: #1A6FFF;
  color: #fff;
  transform: translateX(-2px);
  box-shadow: 0 4px 12px rgba(26,111,255,0.25);
}
.hd-back-btn svg {
  display: block;
  flex-shrink: 0;
}

/* Variante admin (fundo claro da área admin) */
.ha-back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #F0F6FF;
  border: 1.5px solid #D0E4FF;
  color: #1A6FFF;
  text-decoration: none;
  flex-shrink: 0;
  transition: all 0.18s ease;
}
.ha-back-btn:hover {
  background: #1A6FFF;
  border-color: #1A6FFF;
  color: #fff;
  transform: translateX(-2px);
  box-shadow: 0 4px 12px rgba(26,111,255,0.25);
}
.ha-back-btn svg { display: block; }
