/* ===========================================================================
   EL MISTI — Monitor de Paridade OTA vs Site
   Cores da marca + calendario visual responsivo
   =========================================================================== */

:root {
  --primary: #FD8000;
  --navy: #0A2540;
  --accent: #00B5B8;
  --accent-light: #D7F2F1;
  --bg: #F5F5F5;
  --text: #2C3E50;
  --text-light: #95A5A6;
  --white: #FFFFFF;
  --green: #27AE60;
  --green-bg: #D5F5E3;
  --green-border: #27AE60;
  --yellow: #F39C12;
  --yellow-bg: #FEF9E7;
  --yellow-border: #F39C12;
  --red: #E74C3C;
  --red-bg: #FDEDEC;
  --red-border: #E74C3C;
  --gray: #BDC3C7;
  --gray-bg: #F0F0F0;
  --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; }
.header-title {
  font-size: 16px;
  font-weight: 600;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}
.header-right { font-size: 11px; color: var(--accent-light); }

/* CONTROLS */
.controls {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  padding: 16px 24px;
  background: var(--white);
  border-bottom: 1px solid #E5E7EB;
  flex-wrap: wrap;
}
.control-group { display: flex; flex-direction: column; gap: 4px; }
.control-group label { font-size: 11px; font-weight: 600; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.5px; }
.control-group select {
  padding: 8px 12px;
  border: 1px solid #D1D5DB;
  border-radius: 8px;
  font-size: 14px;
  background: var(--white);
  min-width: 180px;
}
.month-nav { display: flex; align-items: center; gap: 12px; }
.btn-nav {
  width: 32px; height: 32px;
  border: 1px solid #D1D5DB;
  border-radius: 8px;
  background: var(--white);
  cursor: pointer;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.btn-nav:hover { background: var(--bg); border-color: var(--primary); }
#monthLabel { font-size: 15px; font-weight: 600; min-width: 120px; text-align: center; }
.btn-refresh {
  padding: 8px 20px;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
  margin-left: auto;
}
.btn-refresh:hover { opacity: 0.85; }

/* SUMMARY CARDS */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gap);
  padding: 16px 24px;
}
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
  border-left: 4px solid transparent;
}
.card-value { font-size: 36px; font-weight: 800; }
.card-label { font-size: 12px; font-weight: 700; letter-spacing: 1px; margin-top: 4px; }
.card-desc { font-size: 11px; color: var(--text-light); margin-top: 2px; }
.card-green { border-left-color: var(--green); }
.card-green .card-value { color: var(--green); }
.card-yellow { border-left-color: var(--yellow); }
.card-yellow .card-value { color: var(--yellow); }
.card-red { border-left-color: var(--red); }
.card-red .card-value { color: var(--red); }
.card-total { border-left-color: var(--navy); }
.card-total .card-value { color: var(--navy); }

/* Card clickable + selected */
.card { cursor: pointer; transition: all 0.2s; }
.card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.12); }
.card-selected { outline: 3px solid var(--primary); outline-offset: -1px; transform: translateY(-2px); }

/* LEGEND */
.legend {
  display: flex;
  gap: 20px;
  padding: 8px 24px 0;
  flex-wrap: wrap;
}
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-light); }
.dot { width: 12px; height: 12px; border-radius: 3px; }
.dot-green { background: var(--green); }
.dot-yellow { background: var(--yellow); }
.dot-red { background: var(--red); }
.dot-empty { background: var(--gray-bg); border: 1px dashed var(--gray); }

/* CALENDAR */
.calendar-container { padding: 16px 24px; }
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-header {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-light);
  padding: 8px 0;
  text-transform: uppercase;
}
.cal-day {
  aspect-ratio: 1;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  min-height: 60px;
  border: 2px solid transparent;
}
.cal-day:hover { transform: scale(1.05); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.cal-day-num { font-size: 18px; font-weight: 700; }
.cal-day-info { font-size: 10px; font-weight: 600; margin-top: 2px; }
.cal-day-diff { font-size: 9px; margin-top: 1px; }

.cal-day.green { background: var(--green-bg); border-color: var(--green-border); }
.cal-day.green .cal-day-num { color: var(--green); }
.cal-day.yellow { background: var(--yellow-bg); border-color: var(--yellow-border); }
.cal-day.yellow .cal-day-num { color: var(--yellow); }
.cal-day.red { background: var(--red-bg); border-color: var(--red-border); animation: pulse-red 2s infinite; }
.cal-day.red .cal-day-num { color: var(--red); }
.cal-day.empty { background: var(--gray-bg); cursor: default; opacity: 0.4; }
.cal-day.empty:hover { transform: none; box-shadow: none; }
.cal-day.no-data { background: var(--white); border: 1px dashed var(--gray); cursor: default; }
.cal-day.no-data:hover { transform: none; box-shadow: none; }
.cal-day.no-data .cal-day-num { color: var(--gray); }
.cal-day.dimmed { background: var(--gray-bg); opacity: 0.3; cursor: default; }
.cal-day.dimmed:hover { transform: none; box-shadow: none; }
.cal-day-otas { font-size: 9px; color: inherit; opacity: 0.7; margin-top: 1px; }

@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.3); }
  50% { box-shadow: 0 0 0 6px rgba(231, 76, 60, 0); }
}

/* DETAIL OVERLAY */
.detail-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  justify-content: center;
  align-items: center;
}
.detail-overlay.visible { display: flex; }
.detail-panel {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 480px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.detail-close {
  position: absolute;
  top: 12px; right: 16px;
  background: none; border: none;
  font-size: 24px; cursor: pointer;
  color: var(--text-light);
}
.detail-panel h3 { font-size: 18px; margin-bottom: 16px; color: var(--navy); }
.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #F0F0F0;
}
.detail-row:last-child { border-bottom: none; }
.detail-label { font-size: 13px; color: var(--text-light); }
.detail-value { font-size: 14px; font-weight: 700; }
.detail-value.green { color: var(--green); }
.detail-value.yellow { color: var(--yellow); }
.detail-value.red { color: var(--red); }
.detail-ota-name { font-size: 14px; font-weight: 600; margin-top: 12px; margin-bottom: 4px; color: var(--navy); }

/* SECTION / TABLE */
.section { padding: 16px 24px; }
.section-title { font-size: 16px; font-weight: 700; margin-bottom: 12px; color: var(--navy); }
.table-container { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow); }
.data-table { width: 100%; border-collapse: collapse; background: var(--white); font-size: 13px; }
.data-table th {
  background: var(--navy);
  color: var(--white);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.data-table td { padding: 10px 14px; border-bottom: 1px solid #F0F0F0; }
.data-table tr:hover { background: #FAFAFA; }
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow); }
.badge-red { background: var(--red-bg); color: var(--red); }

/* Table row status colors */
.row-red { background: var(--red-bg); }
.row-yellow { background: var(--yellow-bg); }
.diff-green { color: var(--green); font-weight: 600; }
.diff-yellow { color: var(--yellow); font-weight: 600; }
.diff-red { color: var(--red); font-weight: 700; }

/* Table date header rows */
.date-header-row { background: var(--navy) !important; }
.date-header-row:hover { background: var(--navy) !important; }
.date-header { color: var(--white); font-weight: 700; font-size: 13px; padding: 8px 14px !important; }

/* Detail popup extras */
.detail-summary { font-size: 13px; color: var(--text-light); margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid #F0F0F0; }
.detail-ota-section { margin-bottom: 16px; padding: 12px; border-radius: 8px; background: #FAFAFA; }
.detail-category { font-size: 12px; font-weight: 600; color: var(--accent); margin: 8px 0 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.detail-footer { font-size: 11px; color: var(--text-light); margin-top: 16px; padding-top: 12px; border-top: 1px solid #F0F0F0; text-align: center; }

/* FOOTER */
.footer {
  text-align: center;
  padding: 20px;
  font-size: 11px;
  color: var(--text-light);
}

/* LOADING */
.loading { text-align: center; padding: 40px; color: var(--text-light); font-size: 14px; }

/* RESPONSIVE */
@media (max-width: 768px) {
  .summary-cards { grid-template-columns: repeat(2, 1fr); }
  .calendar-grid { gap: 2px; }
  .cal-day { min-height: 44px; }
  .cal-day-num { font-size: 14px; }
  .cal-day-info { display: none; }
  .controls { gap: 12px; }
  .control-group select { min-width: 140px; }
  .header-title { font-size: 13px; }
}
@media (max-width: 480px) {
  .summary-cards { grid-template-columns: 1fr 1fr; gap: 8px; }
  .card { padding: 12px; }
  .card-value { font-size: 28px; }
  .legend { gap: 10px; }
}
