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

:root {
  --blue-700: #1a56db;
  --blue-600: #1c64f2;
  --blue-50:  #eff6ff;
  --green-600: #057a55;
  --green-50:  #f0fdf4;
  --yellow-400: #f9c74f;
  --gray-900: #111827;
  --gray-700: #374151;
  --gray-500: #6b7280;
  --gray-300: #d1d5db;
  --gray-100: #f3f4f6;
  --gray-50:  #f9fafb;
  --white:    #ffffff;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow:    0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
  --radius:    0.75rem;
  --radius-sm: 0.375rem;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--gray-900);
  background: var(--gray-50);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--blue-600); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Typography ───────────────────────────────────────────────────────────── */
h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); font-weight: 800; line-height: 1.2; }
h2 { font-size: 1.5rem; font-weight: 700; }
h3 { font-size: 1.1rem; font-weight: 600; }

/* ── Layout ───────────────────────────────────────────────────────────────── */
.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 1rem; }

/* ── Navbar ───────────────────────────────────────────────────────────────── */
.navbar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-300);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 3.5rem;
}
.navbar-brand {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--blue-700);
  display: flex;
  align-items: center;
  gap: .4rem;
}
.navbar-brand span { color: var(--gray-900); }
.navbar-links { display: flex; gap: 1.5rem; }
.navbar-links a { font-size: .875rem; color: var(--gray-700); font-weight: 500; }
.navbar-links a:hover { color: var(--blue-600); text-decoration: none; }

/* ── Hero ─────────────────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--blue-700) 0%, #0f3d91 100%);
  color: var(--white);
  padding: 4rem 1rem 3rem;
  text-align: center;
}
.hero h1 { color: var(--white); margin-bottom: .75rem; }
.hero p { font-size: 1.125rem; opacity: .88; max-width: 560px; margin: 0 auto 2rem; }

/* ── Ad slots ─────────────────────────────────────────────────────────────── */
.ad-leaderboard {
  background: var(--gray-100);
  border: 1px dashed var(--gray-300);
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-500);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin: 1rem 0;
}
.ad-rectangle {
  background: var(--gray-100);
  border: 1px dashed var(--gray-300);
  min-height: 250px;
  min-width: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-500);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ── Main content ─────────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  padding: 2rem 1rem;
}
.content-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2rem;
  align-items: start;
}
@media (max-width: 900px) {
  .content-grid { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}

/* ── Search Card ──────────────────────────────────────────────────────────── */
.search-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
}
.search-card h2 { margin-bottom: 1.25rem; font-size: 1.1rem; color: var(--gray-700); }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

.form-group { display: flex; flex-direction: column; gap: .35rem; }
.form-group label { font-size: .8rem; font-weight: 600; color: var(--gray-700); text-transform: uppercase; letter-spacing: .04em; }

select, input[type="number"] {
  width: 100%;
  padding: .6rem .85rem;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  color: var(--gray-900);
  background: var(--white);
  appearance: none;
  transition: border-color .15s;
}
select:focus, input[type="number"]:focus {
  outline: none;
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px rgba(28,100,242,.12);
}
select:disabled { background: var(--gray-100); cursor: not-allowed; }

.slider-row {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.slider-row input[type="range"] { flex: 1; margin-top: 0; }
.slider-row output {
  font-weight: 700;
  color: var(--blue-600);
  font-size: .9rem;
  background: var(--blue-50);
  padding: .1rem .45rem;
  border-radius: var(--radius-sm);
  min-width: 1.6rem;
  text-align: center;
}
input[type="range"] {
  width: 100%;
  height: 6px;
  appearance: none;
  background: var(--gray-300);
  border-radius: 99px;
  outline: none;
  cursor: pointer;
  padding: 0;
  border: none;
  margin-top: .45rem;
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--blue-600);
  border: 2px solid var(--white);
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
  transition: background .15s;
}
input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--blue-600);
  border: 2px solid var(--white);
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
  cursor: pointer;
}
input[type="range"]:focus::-webkit-slider-thumb { background: var(--blue-700); }
input[type="range"]:focus::-moz-range-thumb     { background: var(--blue-700); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .7rem 1.5rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .1s;
}
.btn:active { transform: scale(.98); }
.btn-primary {
  background: var(--blue-600);
  color: var(--white);
  width: 100%;
  margin-top: .5rem;
}
.btn-primary:hover { background: var(--blue-700); }
.btn-primary:disabled { background: var(--gray-300); cursor: not-allowed; transform: none; }

/* ── Loading ──────────────────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Error / Empty states ─────────────────────────────────────────────────── */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  margin-bottom: 1rem;
}
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.alert-info  { background: var(--blue-50); border: 1px solid #bfdbfe; color: #1e3a8a; }

/* ── Results ──────────────────────────────────────────────────────────────── */
#results { display: none; }
.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: .5rem;
}
.results-header h2 { font-size: 1.25rem; }
.results-meta { font-size: .8rem; color: var(--gray-500); }

/* Tabs de modalidade */
.tabs {
  display: flex;
  gap: .5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.tab-btn {
  padding: .45rem 1rem;
  border: 1.5px solid var(--gray-300);
  border-radius: 2rem;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--white);
  color: var(--gray-700);
  transition: all .15s;
}
.tab-btn:hover { border-color: var(--blue-600); color: var(--blue-600); }
.tab-btn.active {
  background: var(--blue-600);
  border-color: var(--blue-600);
  color: var(--white);
}

/* Opção card */
.option-card {
  background: var(--white);
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s;
}
.option-card:hover { box-shadow: var(--shadow); }
.option-card.best { border-color: var(--blue-600); border-width: 2px; }

.option-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: .5rem;
}
.option-badge {
  font-size: .7rem;
  font-weight: 700;
  padding: .25rem .65rem;
  border-radius: 2rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.badge-best { background: var(--blue-50); color: var(--blue-700); border: 1px solid #bfdbfe; }
.badge-alt  { background: var(--gray-100); color: var(--gray-600); }
.option-stats { display: flex; gap: 1rem; flex-wrap: wrap; }
.stat { font-size: .8rem; color: var(--gray-600); }
.stat strong { color: var(--gray-900); }

/* Períodos dentro de uma opção */
.periods-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}
.period-block {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 1rem;
}
.period-label { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--blue-700); margin-bottom: .5rem; }
.period-dates { font-size: .925rem; font-weight: 600; margin-bottom: .35rem; }
.period-block-total { font-size: .78rem; color: var(--gray-500); margin-bottom: .65rem; }
.period-block-total strong { color: var(--green-600); }

.holidays-list { display: flex; flex-direction: column; gap: .3rem; }
.holiday-item {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  font-size: .8rem;
}
.holiday-tag {
  font-size: .65rem;
  font-weight: 700;
  padding: .1rem .4rem;
  border-radius: 3px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 1px;
}
.tag-FED { background: #dbeafe; color: #1e40af; }
.tag-EST { background: #dcfce7; color: #166534; }
.tag-MUN { background: #fef9c3; color: #854d0e; }
.tag-FAC { background: #f3e8ff; color: #6b21a8; }

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar { display: flex; flex-direction: column; gap: 1.5rem; }
.sidebar-card {
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.sidebar-card h3 { font-size: .95rem; margin-bottom: .75rem; color: var(--gray-700); }
.clt-rule { font-size: .8rem; color: var(--gray-600); padding: .35rem 0; border-bottom: 1px solid var(--gray-100); display: flex; gap: .5rem; }
.clt-rule:last-child { border-bottom: none; }
.clt-rule::before { content: "✓"; color: var(--green-600); font-weight: 700; flex-shrink: 0; }

/* ── Footer ───────────────────────────────────────────────────────────────── */
footer {
  background: var(--gray-900);
  color: var(--gray-300);
  padding: 2rem 1rem;
  margin-top: auto;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 640px) { .footer-grid { grid-template-columns: 1fr; gap: 1rem; } }
.footer-brand { font-weight: 800; color: var(--white); font-size: 1rem; margin-bottom: .4rem; }
.footer-desc { font-size: .8rem; line-height: 1.5; }
.footer-title { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--gray-500); margin-bottom: .6rem; }
.footer-links { list-style: none; display: flex; flex-direction: column; gap: .35rem; }
.footer-links a { font-size: .8rem; color: var(--gray-300); }
.footer-links a:hover { color: var(--white); }
.footer-bottom { border-top: 1px solid #374151; padding-top: 1rem; font-size: .75rem; color: var(--gray-500); text-align: center; }

/* ── Motivo / Feriados adjacentes ─────────────────────────────────────────── */
.motivo-box {
  font-size: .78rem;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  padding: .45rem .65rem;
  margin-bottom: .65rem;
  line-height: 1.4;
}
.no-holidays-badge {
  font-size: .78rem;
  color: var(--green-600);
  font-weight: 600;
}
.adj-section { margin-bottom: .5rem; }
.adj-title {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--green-600);
  margin-bottom: .3rem;
}
.holidays-section-title {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--gray-500);
  margin: .4rem 0 .3rem;
}
.adj-pos {
  font-size: .62rem;
  font-weight: 700;
  padding: .1rem .35rem;
  border-radius: 2rem;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: auto;
  align-self: center;
}
.adj-pos-antes  { background: #dcfce7; color: #166534; }
.adj-pos-depois { background: #dbeafe; color: #1e40af; }

/* ── Index page misc ──────────────────────────────────────────────────────── */
.ad-rectangle-results { margin: 1.5rem 0; }
.legend-list { display: flex; flex-direction: column; gap: .5rem; font-size: .8rem; }
.legend-item { display: flex; align-items: center; gap: .5rem; }

/* ── Privacidade page ─────────────────────────────────────────────────────── */
.privacy-card {
  line-height: 1.75;
  font-size: .95rem;
  color: var(--gray-700);
}
.privacy-card h2 {
  font-size: 1.05rem;
  color: var(--gray-900);
  margin: 1.5rem 0 1rem;
}
.privacy-card h2:first-child { margin-top: 0; }
.privacy-card ul {
  padding-left: 1.25rem;
  margin: .75rem 0;
}
.privacy-card p + p { margin-top: .75rem; }

/* ── Sobre page ───────────────────────────────────────────────────────────── */
.sobre-container  { max-width: 720px; }
.search-card-title { margin-bottom: 1rem; }
.sobre-lead { font-size: .95rem; color: var(--gray-700); line-height: 1.7; }
.sobre-list { font-size: .9rem; color: var(--gray-700); line-height: 2; padding-left: 1.25rem; margin-top: .5rem; }
.sobre-body { font-size: .9rem; color: var(--gray-700); line-height: 1.7; margin-bottom: 1rem; }
.sobre-note { font-size: .9rem; color: var(--gray-500); margin-top: .75rem; }
.sobre-h3   { font-size: .95rem; margin-bottom: .5rem; color: var(--gray-900); }
.sobre-h3-gap { margin-top: 1.25rem; }
.info-box {
  background: var(--blue-50);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-top: 1rem;
  font-size: .85rem;
  color: #1e3a8a;
  line-height: 1.6;
}

/* ── Day Picker ───────────────────────────────────────────────────────────── */
.form-group-full { grid-column: 1 / -1; }

.day-picker {
  display: flex;
  gap: .375rem;
  flex-wrap: wrap;
  margin-top: .1rem;
}
.day-btn {
  padding: .4rem .7rem;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--white);
  color: var(--gray-600);
  transition: all .15s;
  min-width: 2.75rem;
  text-align: center;
  line-height: 1;
}
.day-btn:hover:not(.day-btn-locked) {
  border-color: var(--blue-600);
  color: var(--blue-600);
}
.day-btn.active {
  background: var(--blue-600);
  border-color: var(--blue-600);
  color: var(--white);
}
.day-btn.day-btn-locked {
  opacity: .45;
  cursor: not-allowed;
}
.day-picker-hint {
  display: block;
  font-size: .72rem;
  color: var(--gray-500);
  margin-top: .3rem;
}

/* ── Editorial Section ────────────────────────────────────────────────────── */
.editorial-section {
  background: var(--gray-50);
  border-top: 1px solid var(--gray-200);
  padding: 3rem 0;
  margin-top: 2rem;
}
.editorial-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 1.75rem;
  text-align: center;
}
.editorial-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
}
.editorial-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.editorial-icon {
  font-size: 1.75rem;
  margin-bottom: .75rem;
}
.editorial-card h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: .6rem;
}
.editorial-card p {
  font-size: .875rem;
  color: var(--gray-600);
  line-height: 1.6;
  margin-bottom: .5rem;
}
.editorial-card p:last-child { margin-bottom: 0; }
.editorial-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
  margin-top: .5rem;
}
.editorial-table th {
  background: var(--gray-100);
  color: var(--gray-700);
  font-weight: 600;
  padding: .4rem .6rem;
  text-align: left;
  border-bottom: 1px solid var(--gray-200);
}
.editorial-table td {
  padding: .35rem .6rem;
  color: var(--gray-600);
  border-bottom: 1px solid var(--gray-100);
}
.editorial-table tr:last-child td { border-bottom: none; }

/* ── Utilities ────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
