/* =========================================================
   COMPONENTES: Botões, Dropdown, Selects, Modal, Carrossel
========================================================= */

/* ----------------------------------
   Botões do menu (Home / Biomapa)
------------------------------------- */
.nav-button,
.dropbtn {
    appearance: none;
    border: 0;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    font-weight: 700;
    width: var(--nav-w);
    height: var(--nav-h);
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
    transition: transform .15s, background .15s;
    backdrop-filter: blur(3px);
    font-size: 14px;
}
.nav-button:hover,
.dropbtn:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.26);
}

/* ----------------------------------
   Dropdown
------------------------------------- */
.header-left .dropdown {
    display: inline-block;
    position: relative;
}

.dropbtn {
    padding-right: 26px;
}

.dropbtn::after {
    content: "▾";
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    opacity: 0.9;
}

.dropdown-content {
    position: absolute;
    top: calc(100% + var(--dropdown-gap));
    left: 0;
    background: #0f4fa6;
    color: #fff;
    border-radius: 10px;
    width: max(var(--nav-w), 220px);
    padding: 8px;
    display: none;
    box-shadow: var(--shadow);
}

/* Ponte invisível: mantém :hover ao mover o mouse do botão até o menu */
.dropdown-content::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 100%;
    height: var(--dropdown-gap);
}

.dropdown:hover .dropdown-content {
    display: block;
}
.dropdown-content a {
    display: block;
    padding: 10px 12px;
    border-radius: 8px;
    color: #fff;
    text-decoration: none;
}
.dropdown-content a:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* ----------------------------------
   Selects
------------------------------------- */
select {
    height: 38px;
    padding: 8px 10px;
    border: 1px solid #d0d8e2;
    border-radius: 10px;
    background: #fff;
    font-size: 15px;
    color: #1f2937;
}

/* ----------------------------------
   Carrossel de etapas (home)
------------------------------------- */
.etapas-carousel {
    margin: 10px auto 28px;
    max-width: var(--site-max);
    padding-inline: var(--site-pad);
}

.etapas-carousel__shell {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: clamp(8px, 2vw, 16px);
}

.etapas-carousel__viewport {
    overflow: hidden;
    border-radius: var(--radius);
    outline: none;
}

.etapas-carousel__viewport:focus-visible {
    box-shadow: 0 0 0 3px rgba(46, 99, 214, 0.35);
}

.etapas-carousel__track {
    display: flex;
    transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
}

.etapas-carousel__slide {
    flex: 0 0 100%;
    min-width: 0;
    background: var(--card-bg);
    border: 1px solid rgba(46, 99, 214, 0.12);
    border-radius: var(--radius);
    box-shadow: var(--car-shadow);
    padding: clamp(18px, 3vw, 28px);
    min-height: 160px;
}

.etapas-carousel__slide h3 {
    margin: 0 0 12px;
    font-size: clamp(1.05rem, 2vw, 1.2rem);
    color: var(--brand-blue-600);
    line-height: 1.35;
}

.etapas-carousel__slide p {
    margin: 0 0 12px;
}

.etapas-carousel__slide .etapa-bullets {
    margin: 0;
    padding-left: 1.25rem;
}

.etapas-carousel__slide .etapa-bullets li + li {
    margin-top: 6px;
}

.etapas-carousel__nav {
    width: 46px;
    height: 46px;
    flex-shrink: 0;
    border: 1px solid #c9d6ef;
    border-radius: 999px;
    background: #ffffff;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.1);
    cursor: pointer;
    position: relative;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.etapas-carousel__nav:hover:not(:disabled) {
    transform: translateY(-1px);
    background: #f8fbff;
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.14);
}

.etapas-carousel__nav:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.etapas-carousel__nav::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    border-top: 2px solid var(--brand-blue-600);
    border-right: 2px solid var(--brand-blue-600);
}

.etapas-carousel__nav--prev::before {
    transform: translate(-35%, -50%) rotate(-135deg);
}

.etapas-carousel__nav--next::before {
    transform: translate(-65%, -50%) rotate(45deg);
}

.etapas-carousel__footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 20px;
    margin-top: 14px;
}

.etapas-carousel__progress {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--brand-blue-600);
    letter-spacing: 0.02em;
}

.etapas-carousel__dots {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.etapas-carousel__dot {
    width: 9px;
    height: 9px;
    padding: 0;
    border: 1px solid #95add9;
    border-radius: 999px;
    background: #ffffff;
    cursor: pointer;
    transition: width 0.25s ease, background 0.2s ease, border-color 0.2s ease;
}

.etapas-carousel__dot.is-active {
    width: 28px;
    background: var(--brand-blue);
    border-color: var(--brand-blue);
}

@media (prefers-reduced-motion: reduce) {
    .etapas-carousel__track {
        transition: none;
    }
}

@media (max-width: 640px) {
    .etapas-carousel__shell {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
    }

    .etapas-carousel__nav--prev {
        grid-row: 2;
        justify-self: start;
    }

    .etapas-carousel__viewport {
        grid-row: 1;
    }

    .etapas-carousel__nav--next {
        grid-row: 2;
        justify-self: end;
    }

    .etapas-carousel__footer {
        grid-column: 1 / -1;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .etapas-carousel__dots {
        margin-left: 0;
    }
}

/* ----------------------------------
   Modal
------------------------------------- */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.6);
    padding-top: 60px;
}
.modal-content {
    background: #fff;
    margin: 5% auto;
    padding: 30px;
    border: 1px solid #e5e7eb;
    width: 80%;
    max-width: 700px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: relative;
}
.close-button {
    position: absolute;
    top: 10px;
    right: 25px;
    font-size: 28px;
    cursor: pointer;
    color: #888;
}
.close-button:hover {
    color: #000;
}

/* =========================================================
   KPI BOX
========================================================= */
.kpi-box {
    margin-top: 10px;
    padding: 12px 16px;
    border-radius: 14px;
    background: #f3f4ff;
    border: 1px solid #e5e7ff;
    box-shadow: 0 4px 10px rgba(15,23,42,0.06);
}
.kpi-narrow {
    margin-bottom: 8px;
}
.kpi-title {
    font-size: 0.78rem;
    color: #4b5563;
    font-weight: 500;
    text-align: center;
}
.kpi-value {
    margin-top: 6px;
    font-size: 1.4rem;
    font-weight: 700;
    color: #111827;
    text-align: center;
}
.kpi-value::after {
    content: " t/ano";
    font-size: 0.8rem;
    margin-left: 4px;
    color: #4b5563;
}

/* Select com seta personalizada */
.filters-box .control {
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, #4b5563 50%),
        linear-gradient(135deg, #4b5563 50%, transparent 50%);
    background-position:
        calc(100% - 16px) calc(50% - 3px),
        calc(100% - 11px) calc(50% - 3px);
    background-size: 6px 6px;
    background-repeat: no-repeat;
    padding-right: 28px;
}
/* =====================================================
   Layout geral de Patentes
===================================================== */

.patentes-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: calc(100vh - 70px); /* altura do header */
}


/* Responsivo */
@media (max-width: 900px) {
  .patentes-layout {
    grid-template-columns: 1fr;
  }
}

.content-page h1,
.content-page p {
    text-align: center;
}


/* =====================================================
   Menu lateral – Lista de Espécies / Categorias
===================================================== */

.species-list {
  background: #2e63d6;
  padding: 20px 12px;
  height: 100%;
  border-radius: 0;
}

.species-list {
  box-shadow: 2px 0 8px rgba(0,0,0,0.08);
}


/* Título do menu (opcional, mas recomendado) */
.species-list-title {
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
  text-transform: uppercase;
  opacity: 0.9;
}

.species-item {
  display: block;
  padding: 10px 12px;
  margin-bottom: 6px;
  color: #ffffff;
  text-decoration: none;
  border-radius: 4px;
  font-weight: 500;
  transition: background 0.2s ease;
}

.species-item:last-child {
  margin-bottom: 0;
}

.species-item:hover {
  background: #2e63d6;
}

.species-item.active {
  background: #132dd2;
  font-weight: 600;
}

/* =====================================================
   LAYOUT – PATENTES
===================================================== */

.patentes-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: calc(100vh - 70px);
}

@media (max-width: 900px) {
  .patentes-layout {
    grid-template-columns: 1fr;
  }
}

.patentes-content {
  background: #ffffff;
  padding: 20px;
  border-radius: 6px;
  overflow-x: hidden;
}

/* =====================================================
   ACCORDION – ESPÉCIES
===================================================== */

.accordion {
  max-width: 1100px;
  margin: 0 auto;
}

.accordion-item {
  background: #ffffff;
  border-radius: 8px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  overflow: hidden;
}

.accordion-header {
  width: 100%;
  padding: 22px 28px;
  background: #2e63d6;
  color: #fff;
  border: none;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;

  display: flex;
  justify-content: space-between;
  align-items: center;
}

.accordion-header::after {
  content: "▾";
}

.accordion-header.active::after {
  content: "▴";
}

.accordion-content {
  display: none;
  padding: 20px;
}

/* =====================================================
   TABELA DE PATENTES — VERSÃO FINAL ESTÁVEL
===================================================== */

.table-wrapper {
  width: 100%;
  overflow-x: auto;
  margin-top: 12px;
  padding-bottom: 8px;
}

.table-wrapper::-webkit-scrollbar {
  height: 10px;
}

.table-wrapper::-webkit-scrollbar-thumb {
  background: #c1c7d0;
  border-radius: 6px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
  background: #9aa3af;
}

.patentes-table {
  width: 100%;
  min-width: 1200px;          /* garante espaço para todas as colunas */
  border-collapse: collapse;
  table-layout: fixed;        /* 🔑 essencial */
  font-size: 14px;
}

/* Header */
.patentes-table thead {
  background: #f2f2f2;
}

.patentes-table th {
  border: 1px solid #d0d0d0;
  padding: 10px 12px;
  font-weight: 600;
  color: #1b4332;
  white-space: nowrap;
  text-align: center;
}

/* Corpo */
.patentes-table td {
  border: 1px solid #d0d0d0;
  padding: 8px 12px;
  text-align: center;
}

.patentes-table tbody tr:nth-child(even) {
  background: #fafafa;
}

.patentes-table tbody tr:hover {
  background: #e9f3ee;
}

/* =====================================================
   COLUNA STICKY — MACROÁREA (CORREÇÃO DEFINITIVA)
===================================================== */

.patentes-table th:first-child {
  position: sticky;
  left: 0;
  z-index: 5;
  background: #f2f2f2;

  width: 260px;
  min-width: 260px;
  max-width: 260px;

  text-align: left;
}

.patentes-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 3;
  background: #ffffff;

  width: 260px;
  min-width: 260px;
  max-width: 260px;

  text-align: left;
}

/* ===============================
   COLUNA TRL LABORATORIAL (2ª)
=============================== */

.patentes-table th:nth-child(2),
.patentes-table td:nth-child(2) {
  min-width: 300px;   /* 🔑 ISSO é o que faz crescer */
  width: 300px;
  max-width: 300px;
}


/* =====================================================
   COLUNAS NUMÉRICAS (TRL + BRASILEIRAS)
===================================================== */

.patentes-table th:not(:first-child),
.patentes-table td:not(:first-child) {
  min-width: 160px;
}

/* =====================================================
   BOTÃO CSV
===================================================== */

.btn-download,
.btn-download-csv {
  margin: 12px 0;
}
