/* ===========================================================================
   EL MISTI — Dashboard Operacional
   Cores da marca + layout responsivo
   =========================================================================== */

:root {
  --primary: #FD8000;
  --navy: #0A2540;
  --accent: #00B5B8;
  --accent-light: #D7F2F1;
  --bg: #F5F5F5;
  --text: #2C3E50;
  --text-light: #95A5A6;
  --white: #FFFFFF;
  --green: #27AE60;
  --blue: #2980B9;
  --orange: #F39C12;
  --red: #E74C3C;
  --red-dark: #C0392B;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --radius: 12px;
  --gap: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* HEADER */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  background: var(--navy);
  color: var(--white);
}
.logo {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--white);
}
.header-title {
  font-size: 16px;
  font-weight: 600;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}
.header-right { font-size: 11px; color: var(--accent-light); }

/* TABS */
.tabs {
  display: flex;
  gap: 0;
  background: var(--white);
  border-bottom: 2px solid #E5E7EB;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex-shrink: 0;
  padding: 12px 20px;
  border: none;
  background: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-light);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.tab:hover { color: var(--text); background: var(--bg); }
.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 700;
}

/* ALERTAS */
.alerts { padding: 0 24px; }
.alert {
  padding: 12px 20px;
  margin-top: 8px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--white);
  animation: fadeIn 0.3s ease;
}
.alert-green { background: var(--green); }
.alert-red { background: var(--red); }

/* FILTROS */
.filter-bar { padding: 8px 24px; }
.filter-toggle {
  padding: 8px 16px;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  background: var(--white);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
}
.filter-toggle:hover { border-color: var(--accent); }
.filter-toggle.open { background: var(--accent-light); border-color: var(--accent); }
.filters {
  display: none;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  padding: 16px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  align-items: flex-end;
}
.filters.open { display: flex; }
.filter-group { display: flex; flex-direction: column; gap: 4px; min-width: 140px; }
.filter-group label { font-size: 11px; font-weight: 600; color: var(--text-light); text-transform: uppercase; }
.filter-group select, .filter-group input {
  padding: 8px 10px;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  font-size: 13px;
  background: var(--white);
  color: var(--text);
}
.filter-group select:focus, .filter-group input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,181,184,0.15);
}
.btn-clear {
  padding: 8px 16px;
  background: none;
  border: 1px solid var(--red);
  color: var(--red);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-clear:hover { background: var(--red); color: var(--white); }

/* CONTEUDO */
.content { padding: 16px 24px 40px; }
.page { display: block; }
.page.hidden { display: none; }

/* KPI CARDS */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--gap);
  margin-bottom: var(--gap);
}
.kpi-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  text-align: center;
  transition: transform 0.2s;
}
.kpi-card:hover { transform: translateY(-2px); }
.kpi-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.2;
}
.kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  margin-top: 4px;
  letter-spacing: 0.5px;
}
.kpi-value.green { color: var(--green); }
.kpi-value.red { color: var(--red); }
.kpi-value.muted { color: var(--text-light); font-size: 22px; }

/* Cards de controle (cancelamento, no-show) */
.kpi-separator {
  width: 2px;
  background: #E5E7EB;
  border-radius: 1px;
  min-height: 40px;
  align-self: center;
}
.kpi-control {
  border-left: 3px solid #E5E7EB;
  background: #FAFAFA;
}
.kpi-control .kpi-value { font-size: 20px; }
.kpi-control .kpi-label { font-size: 10px; }

/* CHARTS */
.charts-row {
  display: flex;
  gap: var(--gap);
  margin-bottom: var(--gap);
}
.chart-container {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  position: relative;
  min-height: 280px;
}
.chart-container h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}
.chart-container canvas { max-height: 300px; }
.wide { flex: 3; }
.narrow { flex: 2; }
.half { flex: 1; }

/* COMPARISON (Direto vs OTAs) */
.comparison {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: var(--gap);
  margin-bottom: var(--gap);
  align-items: start;
}
.comp-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.comp-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-left: 4px solid;
}
.comp-card .comp-label { font-size: 13px; color: var(--text-light); font-weight: 600; }
.comp-card .comp-value { font-size: 22px; font-weight: 800; color: var(--navy); }
.comp-card.direct { border-left-color: var(--green); }
.comp-card.ota { border-left-color: var(--blue); }
.comp-highlight {
  background: var(--green);
  color: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  box-shadow: var(--shadow);
  align-self: center;
}
.comp-highlight .big { font-size: 36px; font-weight: 800; }
.comp-highlight .label { font-size: 12px; margin-top: 4px; opacity: 0.9; }

/* TABELAS */
.table-container {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: var(--gap);
  overflow-x: auto;
}
.table-container h3 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
}
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 2px solid #E5E7EB;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-light);
}
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #F3F4F6;
}
.data-table tr:hover { background: #F9FAFB; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .bar {
  display: inline-block;
  height: 8px;
  border-radius: 4px;
  margin-right: 8px;
  vertical-align: middle;
}

/* LOADING SKELETON */
.skeleton {
  background: linear-gradient(90deg, #F0F0F0 25%, #E0E0E0 50%, #F0F0F0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}
.loading-text {
  color: var(--text-light);
  font-size: 13px;
  text-align: center;
  padding: 40px;
}
.error-box {
  color: var(--red);
  text-align: center;
  padding: 20px;
  font-size: 13px;
}
.error-box button {
  margin-top: 8px;
  padding: 6px 16px;
  border: 1px solid var(--red);
  border-radius: 6px;
  background: none;
  color: var(--red);
  cursor: pointer;
  font-size: 12px;
}

/* ANIMACOES */
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* RESPONSIVO — TABLET */
@media (max-width: 1200px) {
  .charts-row { flex-direction: column; }
  .wide, .narrow, .half { flex: 1; }
  .comparison { grid-template-columns: 1fr; }
  .comp-highlight { order: -1; }
}

/* RESPONSIVO — MOBILE */
@media (max-width: 768px) {
  .header { padding: 0 16px; height: 48px; }
  .header-title { font-size: 14px; }
  .logo { font-size: 16px; }
  .tabs { padding: 0 8px; }
  .tab { padding: 10px 14px; font-size: 12px; }
  .content { padding: 12px 16px; }
  .kpi-row { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
  .kpi-card { padding: 14px; }
  .kpi-value { font-size: 22px; }
  .filter-bar { padding: 8px 16px; }
  .filters { padding: 12px; }
  .filter-group { min-width: 100%; }
  .chart-container { min-height: 220px; padding: 14px; }
  .comp-card .comp-value { font-size: 18px; }
  .comp-highlight .big { font-size: 28px; }
}

/* RESPONSIVO — TV */
@media (min-width: 1920px) {
  .header { height: 64px; padding: 0 40px; }
  .logo { font-size: 24px; }
  .header-title { font-size: 20px; }
  .content { padding: 24px 40px; max-width: 1800px; margin: 0 auto; }
  .kpi-value { font-size: 36px; }
  .kpi-label { font-size: 13px; }
  .chart-container { min-height: 360px; }
}
