/* ── BTG Pactual Research — Transportation & Capital Goods ─────────────── */

:root {
  /* Light BTG Theme — matching Oil & Gas dashboard */
  --bg:           #EBF0F8;
  --bg-white:     #FFFFFF;
  --header-bg:    #0D1F5C;
  --card:         #FFFFFF;
  --card-hover:   #F4F8FD;
  --border:       #D8E3F0;
  --border-light: #E8EFF8;

  --blue:         #1B56B8;
  --blue-light:   #2B6CD4;
  --blue-dark:    #0C1842;
  --blue-bg:      #EBF1FA;

  --text:         #1A2B4A;
  --text-muted:   #6B7FA0;
  --text-light:   #9AAAC2;

  --green:        #1DAB6A;
  --green-bg:     #EBF8F2;
  --red:          #E63946;
  --red-bg:       #FDEEF0;
  --red-text:     #C42B36;

  --shadow-sm:    0 1px 4px rgba(0,0,0,0.07);
  --shadow:       0 4px 16px rgba(0,0,0,0.09);
  --shadow-hover: 0 8px 28px rgba(0,0,0,0.13);

  --header-h:     86px;
  --radius:       12px;
  --radius-sm:    8px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
img { display: block; max-width: 100%; }

/* ── Header ─────────────────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  height: var(--header-h);
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
}
.header-inner {
  padding: 0 28px 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
}
.header-logo-link { flex-shrink: 0; }
.header-logo {
  height: 62px;
  width: auto;
  filter: brightness(0) invert(1);
  opacity: 0.96;
}
.header-divider { display: none; }
.header-title-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.header-title {
  font-size: 20px;
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.header-sub {
  font-size: 13px;
  color: #8BA8D4;
  font-weight: 400;
}
.header-nav {
  display: flex;
  gap: 2px;
}
.nav-link {
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,0.6);
  transition: color 0.15s, background 0.15s;
}
.nav-link:hover { color: #FFFFFF; background: rgba(255,255,255,0.08); }
.nav-link.active { color: #FFFFFF; background: rgba(255,255,255,0.14); }

/* ── Main ────────────────────────────────────────────────────────────────── */
.site-main {
  flex: 1;
  max-width: 1320px;
  margin: 0 auto;
  width: 100%;
  padding: 40px 36px 72px;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--bg-white);
  border-top: 1px solid var(--border);
  padding: 28px 36px 32px;
}
.footer-inner {
  max-width: 1320px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}
.footer-logo {
  height: 34px;
  width: auto;
  opacity: 0.85;
  margin-bottom: 2px;
}
.footer-names {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.footer-emails {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}
.footer-email {
  font-size: 13px;
  color: var(--blue-light);
  transition: opacity 0.15s;
}
.footer-email:hover { opacity: 0.7; }
.footer-sep { color: var(--text-light); font-size: 13px; }

/* ── Home Page ───────────────────────────────────────────────────────────── */
.home-hero {
  text-align: center;
  padding: 56px 0 52px;
}
.hero-title {
  font-size: clamp(22px, 2.8vw, 32px);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.03em;
  margin-bottom: 10px;
}
.hero-sub {
  font-size: 14px;
  color: var(--text-muted);
}

.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  max-width: 860px;
  margin: 0 auto 40px;
}

.module-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 28px 32px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  box-shadow: var(--shadow-sm);
  text-align: center;
}
.module-card:hover {
  border-color: var(--blue);
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px);
}
.module-card-icon {
  width: 88px;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--blue);
  margin-bottom: 20px;
}
.module-card-icon svg { width: 64px; height: 64px; }
.module-card-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}
.module-card-tag {
  margin-top: 16px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--blue-light);
  background: var(--blue-bg);
  border-radius: 20px;
  padding: 3px 12px;
}

.home-status {
  text-align: center;
  padding: 20px 0 8px;
}

/* ── Home credits (team block) ───────────────────────────────────────────── */
.home-credits {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 32px 0 8px;
  border-top: 1px solid var(--border);
  margin-top: 24px;
}
.credits-logo {
  height: 32px;
  width: auto;
  opacity: 0.82;
  margin-bottom: 2px;
}
.credits-names {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.credits-emails {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}
.credits-email {
  font-size: 13px;
  color: var(--blue-light);
  transition: opacity 0.15s;
}
.credits-email:hover { opacity: 0.7; }
.credits-sep { color: var(--text-light); font-size: 13px; }
.status-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-light);
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-light);
  transition: background 0.3s;
}
.status-dot.online { background: var(--green); }

/* ── Page Header (inner pages) ────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 0 0 24px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.page-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 4px;
}
.page-sub {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Loading Spinner ─────────────────────────────────────────────────────── */
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px;
  gap: 16px;
  color: var(--text-muted);
  font-size: 13px;
}
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Cheat Sheet Controls ────────────────────────────────────────────────── */
.cs-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.cs-search {
  padding: 8px 13px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  width: 210px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.cs-search:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(27,86,184,0.12); }
.cs-search::placeholder { color: var(--text-light); }

.btn-refresh {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--blue);
  border: none;
  border-radius: var(--radius-sm);
  color: #FFFFFF;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-refresh:hover { background: var(--blue-light); }

.refresh-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px;
  font-variant-numeric: tabular-nums;
}

/* ── Sector Charts (after table) ─────────────────────────────────────────── */
.cs-charts-section {
  margin-top: 44px;
}
.cs-charts-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  padding-bottom: 12px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border);
}
.cs-sector-charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 18px;
}
.cs-sector-card {
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(12,24,66,0.07), 0 1px 3px rgba(12,24,66,0.04);
  transition: box-shadow 0.2s, transform 0.15s;
}
.cs-sector-card:hover {
  box-shadow: 0 6px 24px rgba(12,24,66,0.12), 0 2px 6px rgba(12,24,66,0.06);
  transform: translateY(-2px);
}
.cs-sector-card-header {
  display: flex;
  align-items: center;
  padding: 9px 16px;
  background: linear-gradient(135deg, #EBF0F8 0%, #F4F7FD 100%);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--blue-dark);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
.cs-sector-chart-wrap {
  position: relative;
  height: 200px;
  padding: 0 10px 10px;
}

/* ── Cheat Sheet Table ───────────────────────────────────────────────────── */
.cs-legend {
  display: flex;
  gap: 20px;
  font-size: 11px;
  color: var(--text-light);
  margin-bottom: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.legend-positive { color: var(--green); font-weight: 600; }
.legend-negative { color: var(--red-text); font-weight: 600; }

.cs-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}
.cs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.cs-table thead tr {
  background: #0C1842;
}
.cs-table th {
  padding: 13px 16px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #FFFFFF;
  text-align: left;
  white-space: nowrap;
  user-select: none;
  border-bottom: none;
}
.cs-table th.col-ret { text-align: right; }
.cs-table th.sortable { cursor: pointer; }
.cs-table th.sortable:hover { color: rgba(255,255,255,0.72); }
.cs-table th.sort-asc::after  { content: ' ↑'; color: rgba(255,255,255,0.72); }
.cs-table th.sort-desc::after { content: ' ↓'; color: rgba(255,255,255,0.72); }

.col-ticker { width: 200px; }
.col-ret    { text-align: right; width: 80px; }

.cs-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
.cs-table tr:last-child td { border-bottom: none; }
.cs-table tbody tr:hover { background: #F8FAFD; }

/* Sector header row */
.cs-table tr.sector-row td {
  background: #F0F5FC;
  border-top: 2px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 7px 16px;
}
.sector-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--blue);
  background: var(--blue-bg);
  border: 1px solid rgba(27,86,184,0.2);
  border-radius: 20px;
  padding: 2px 10px;
}

.ticker-name { font-weight: 600; color: var(--text); }
.ticker-yahoo { font-size: 10px; color: var(--text-light); margin-top: 1px; }

.ret-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  font-weight: 600;
  padding: 10px 16px;
}
.ret-pos  { color: var(--green); }
.ret-neg  { color: var(--red-text); }
.ret-zero { color: var(--text-muted); }
.ret-na   { color: var(--text-light); font-weight: 400; }

/* ── Car Rental ──────────────────────────────────────────────────────────── */
.cr-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cr-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.cr-toggles { display: flex; gap: 6px; }
.cr-toggle {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-white);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.cr-toggle.active {
  border-color: var(--blue);
  color: #FFFFFF;
  background: var(--blue);
}

.cr-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 28px;
}
.cr-tab {
  padding: 10px 22px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.cr-tab:hover { color: var(--text); }
.cr-tab.active { color: var(--blue); border-bottom-color: var(--blue); }

.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(440px, 1fr));
  gap: 20px;
}
.chart-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.chart-card.chart-full { grid-column: 1 / -1; }
.chart-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.chart-card-header h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.chart-tooltip-hint { font-size: 11px; color: var(--text-light); }
.chart-container { position: relative; height: 260px; }
.chart-card.chart-full .chart-container { height: 220px; }

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .cs-charts-row { grid-template-columns: 1fr; }
  .charts-grid { grid-template-columns: 1fr; }
  .chart-card.chart-full { grid-column: 1; }
  .site-main { padding: 24px 20px 60px; }
  .header-inner { padding: 0 20px; }
}

/* ── Mobile (≤ 768px) ────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --header-h: auto; }

  /* Prevent any element from causing horizontal overflow */
  html, body { overflow-x: hidden; max-width: 100%; }
  * { max-width: 100%; box-sizing: border-box; }

  /* Header */
  .site-header { position: sticky; top: 0; }
  .header-inner {
    flex-wrap: wrap;
    padding: 12px 16px;
    gap: 8px;
    height: auto;
  }
  .header-logo { height: 40px; }
  .header-title { font-size: 14px; }
  .header-sub { font-size: 10.5px; }
  .header-title-block { gap: 2px; }
  .header-nav {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
    gap: 2px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-shrink: 0;
  }
  .header-nav::-webkit-scrollbar { display: none; }
  .nav-link { padding: 6px 11px; font-size: 11.5px; white-space: nowrap; flex-shrink: 0; }

  /* Main content */
  .site-main { padding: 18px 14px 56px; }

  /* Home hero */
  .home-hero { padding: 28px 0 24px; }
  .hero-title { font-size: 19px; }
  .hero-sub { font-size: 13px; }

  /* Module cards grid — força 1 coluna no mobile */
  .modules-grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
    max-width: 100%;
    width: 100%;
  }
  .module-card { padding: 26px 18px 20px; width: 100%; }
  .module-card-icon { width: 60px; height: 60px; margin-bottom: 12px; }
  .module-card-icon svg { width: 44px; height: 44px; }
  .module-card-title { font-size: 15px; }
  .module-card-sub { font-size: 12px; }

  /* Page header — stack title and controls */
  .page-header {
    flex-direction: column;
    gap: 12px;
    padding-bottom: 16px;
    margin-bottom: 18px;
  }
  .page-title { font-size: 17px; }
  .page-sub { font-size: 11px; }

  /* Cheat sheet controls — stack vertically */
  .cs-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    width: 100%;
  }
  .cs-search { width: 100%; box-sizing: border-box; }
  .btn-refresh { justify-content: center; }
  .refresh-badge { text-align: center; }

  /* Cheat sheet table — horizontal scroll container */
  .cs-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
  }
  .cs-table { font-size: 11.5px; min-width: 520px; }
  .cs-table th { padding: 9px 10px; font-size: 10px; }
  .cs-table td { padding: 8px 10px; }
  .cs-table tbody tr.sector-data td { padding: 10px 10px; font-size: 12px; }

  /* Sector charts grid */
  .cs-sector-charts-grid { grid-template-columns: 1fr; gap: 12px; }

  /* Car rental controls */
  .cr-controls { flex-wrap: wrap; gap: 8px; }
  .cr-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    width: 100%;
  }
  .cr-tabs::-webkit-scrollbar { display: none; }
  .cr-tab { padding: 8px 14px; font-size: 12px; white-space: nowrap; flex-shrink: 0; }

  /* Charts — full width, smaller height */
  .charts-grid { grid-template-columns: 1fr; gap: 14px; }
  .chart-card { padding: 14px; }
  .chart-container { height: 210px; }
  .chart-card.chart-full .chart-container { height: 175px; }

  /* Footer */
  .site-footer { padding: 20px 16px 24px; }
  .footer-emails { flex-direction: column; gap: 4px; align-items: center; }
  .footer-sep { display: none; }
  .footer-email { font-size: 12px; }
  .footer-names { font-size: 13px; }
}

/* ── Small phones (≤ 480px) ──────────────────────────────────────────────── */
@media (max-width: 480px) {
  .header-logo { height: 36px; }
  .header-title { font-size: 13px; }
  .header-sub { font-size: 10px; }
  .site-main { padding: 14px 12px 48px; }
  .chart-container { height: 185px; }
  .module-card { padding: 22px 14px 18px; }
  .cs-table { min-width: 480px; }
  .cs-table th { padding: 8px 8px; font-size: 9.5px; }
  .cs-table td { padding: 7px 8px; }
}
