/* ===== Biomedicore — Responsividade global ===== */

html {
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
}

body {
  overflow-x: clip;
  min-width: 0;
}

img,
video,
svg {
  max-width: 100%;
  height: auto;
}

/* Evita overflow em grids/flex */
.page-wrap,
.search-container,
.filters-container,
.news-toolbar,
.repository-search-inner,
.newsletter-form,
.home-news-grid {
  min-width: 0;
}

/* Inputs: tamanho mínimo 16px evita zoom no iOS ao focar */
input[type="text"],
input[type="search"],
input[type="email"],
input[type="url"],
input[type="date"],
input[type="number"],
select,
textarea,
.search-box input,
.news-search-box input,
.repository-search-input,
.filter-select,
.newsletter-form input {
  font-size: 16px;
  max-width: 100%;
  box-sizing: border-box;
}

input:focus,
select:focus,
textarea:focus,
.search-box:focus-within,
.news-search-box:focus-within,
.repository-search-inner:focus-within {
  outline: none;
}

.search-box:focus-within,
.news-search-box:focus-within,
.repository-search-input:focus,
.filter-select:focus {
  box-shadow: 0 0 0 2px rgba(46, 125, 50, 0.22);
}

/* Modal de pesquisa global */
.modal.active {
  padding: 16px;
  box-sizing: border-box;
}

.search-container {
  width: 100%;
  max-width: min(800px, 100%);
  padding: 0 12px;
  box-sizing: border-box;
}

.search-box {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.search-box input {
  min-width: 0;
  flex: 1 1 auto;
  width: 0;
}

.search-results {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.search-hint-global {
  max-width: 100%;
  padding: 0 4px;
}

/* Pesquisa do repositório (publicações) */
.repository-search-inner {
  width: 100%;
}

.repository-search-input {
  min-width: 0 !important;
  flex: 1 1 50px;
  width: 100%;
}

.repository-search-btn {
  flex-shrink: 0;
  white-space: nowrap;
}

.filters-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
}

/* Pesquisa de notícias */
.news-toolbar {
  width: 100%;
  box-sizing: border-box;
}

.news-search-box {
  min-width: 0 !important;
  max-width: 100% !important;
  width: 100%;
  flex: 1 1 100%;
  box-sizing: border-box;
}

.news-search-box input {
  min-width: 0;
  width: 100%;
  flex: 1 1 auto;
}

.news-filter-chips {
  flex: 1 1 100%;
  max-width: 100%;
  overflow-x: auto;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 4px;
}

.news-filter-chips::-webkit-scrollbar {
  display: none;
}

.news-chip {
  flex-shrink: 0;
}

/* Menu flutuante */
.floating-menu {
  min-width: 0 !important;
  width: min(500px, calc(100vw - 20px));
  left: 50%;
  right: auto;
  transform: translateX(-50%) translateY(20px);
  padding: 1rem 1.25rem;
  gap: 1rem;
}

.floating-menu.visible {
  transform: translateX(-50%) translateY(0);
}

.floating-menu .menu-item {
  font-size: 1.35rem;
}

/* Header páginas internas */
body.page-internal header {
  width: 100%;
  max-width: 100%;
  padding: 0 16px;
  box-sizing: border-box;
}

body.page-internal header nav {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 2px;
}

body.page-internal header a {
  font-size: clamp(0.72rem, 2.5vw, 0.88rem);
  padding: 6px 8px;
  white-space: nowrap;
}

/* Secção navegação Sobre */
.sobre-section-nav-inner {
  overflow-x: auto;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.sobre-section-nav-inner::-webkit-scrollbar {
  display: none;
}

.sobre-nav-link {
  flex-shrink: 0;
}

/* Notícias compactas — homepage */
.home-news-section {
  padding: 3rem 1rem;
}

.home-news-grid {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 16px;
}

.home-news-card {
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(44, 62, 80, 0.08);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.home-news-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(44, 62, 80, 0.12);
}

.home-news-card[hidden] {
  display: none !important;
}

.home-news-card-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.home-news-read-more {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(46, 125, 50, 0.1);
  color: #2e7d32;
  font-weight: 700;
  font-size: 0.85rem;
  text-decoration: none;
  width: fit-content;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.home-news-read-more:hover {
  background: #2e7d32;
  color: #fff;
  transform: translateX(2px);
}

.home-news-thumb {
  position: relative;
  height: 140px;
  overflow: hidden;
  flex-shrink: 0;
}

.home-news-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.home-news-cat {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(46, 125, 50, 0.92);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  max-width: calc(100% - 20px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-news-body {
  padding: 14px 16px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.home-news-body h3 {
  margin: 0 0 8px;
  font-size: 0.98rem;
  line-height: 1.35;
  color: #2c3e50;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.home-news-body p {
  margin: 0 0 10px;
  font-size: 0.85rem;
  line-height: 1.5;
  color: rgba(44, 62, 80, 0.85);
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.home-news-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  font-size: 0.78rem;
  color: rgba(44, 62, 80, 0.7);
}

.home-news-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.home-news-meta i {
  color: #2e7d32;
  flex-shrink: 0;
}

.home-news-footer {
  max-width: 1200px;
  margin: 1.5rem auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: center;
}

.home-news-count {
  font-size: 0.88rem;
  color: rgba(44, 62, 80, 0.75);
}

.home-news-pagination {
  margin-top: 0;
}

.home-news-pagination .pagination-button {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  font-size: 0.88rem;
}

/* Paginação geral */
.pagination {
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 8px;
  box-sizing: border-box;
}

.pagination-button {
  min-width: 36px;
  max-width: 100%;
}

/* Blog grid legado */
.blog-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 1.25rem;
}

/* Modais e overlays */
.team-profile-modal,
.modal-content,
.links-modal,
.modal-externo-content {
  max-width: min(560px, calc(100vw - 24px));
  box-sizing: border-box;
}

.team-profile-overlay,
.avatar-lightbox-overlay,
.modal,
.modal-externo-overlay {
  padding: 12px;
  box-sizing: border-box;
}

/* Newsletter */
.newsletter-form {
  width: 100%;
  max-width: 500px;
  box-sizing: border-box;
}

.newsletter-form input {
  min-width: 0;
  flex: 1 1 auto;
}

.blog-newsletter {
  padding: 2rem 1.25rem;
  margin-left: auto;
  margin-right: auto;
}

/* Slider — evita 100vw overflow */
.slider {
  width: 100%;
  max-width: 100%;
}

/* ===== Breakpoints ===== */

@media (max-width: 768px) {
  header {
    width: 100%;
    max-width: 100%;
    padding: 0 12px;
    box-sizing: border-box;
  }

  .page-hero {
    padding: 90px 16px 50px;
  }

  .page-section {
    padding: 40px 16px 56px;
  }

  .page-title {
    font-size: clamp(1.6rem, 6vw, 2.2rem);
  }

  .page-subtitle {
    font-size: 0.98rem;
  }

  .page-pill {
    font-size: 0.82rem;
    padding: 8px 12px;
  }

  .close-modal {
    top: 1rem;
    right: 1rem;
  }

  .search-box input {
    padding: 12px 14px;
  }

  .search-box button {
    padding: 0 14px;
    flex-shrink: 0;
  }

  .result-item {
    flex-direction: column;
  }

  .news-featured-image {
    min-height: 200px;
  }

  .news-featured-body {
    padding: 20px;
  }

  .news-featured-body h2 {
    font-size: 1.25rem;
  }

  .news-stats-bar {
    flex-direction: column;
  }

  .news-stat-pill {
    width: 100%;
    box-sizing: border-box;
  }

  .blog-header h2 {
    font-size: clamp(1.5rem, 5vw, 2rem);
  }

  .blog-subtitle {
    font-size: 1rem;
  }

  .home-news-thumb {
    height: 120px;
  }

  .separador h1 {
    font-size: clamp(1.2rem, 4.5vw, 1.8rem);
    padding: 0 12px;
  }

  .btn-whatsapp,
  .btn-voltar-topo {
    bottom: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
  }

  .footer-container {
    padding: 0 16px;
  }
}

@media (max-width: 480px) {
  .floating-menu {
    width: calc(100vw - 16px);
    gap: 0.75rem;
    padding: 0.75rem 0.5rem;
  }

  .floating-menu .menu-item {
    font-size: 1.2rem;
  }

  .repository-search-inner {
    flex-direction: column;
  }

  .repository-search-btn {
    width: 100%;
  }

  .news-toolbar {
    padding: 12px;
  }

  .pagination-button {
    padding: 0 8px;
    font-size: 0.82rem;
  }

  .home-news-pagination .pagination-button span.btn-label {
    display: none;
  }

  .sobre-founder-card {
    padding: 16px;
  }

  .team-profile-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}

@media (min-width: 769px) {
  .news-toolbar {
    flex-wrap: wrap;
  }

  .news-search-box {
    flex: 1 1 280px;
    max-width: 360px;
  }

  .news-filter-chips {
    flex: 1 1 auto;
    flex-wrap: wrap;
    overflow-x: visible;
  }
}
