/* Estilos complementares ao Tailwind CSS */

html {
  scroll-behavior: smooth;
}

body {
  overflow-x: hidden;
}

/* Header muda de sombra ao rolar a página (classe aplicada via JS) */
#site-header.is-scrolled {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

/* Fade-in suave para seções ao entrarem na viewport */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Quem pede menos animação no sistema vê o conteúdo já revelado. Serve
   também de rede de segurança: o efeito nunca pode esconder a página. */
@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* Botão "voltar ao topo" */
#back-to-top {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  transform: translateY(10px);
}

#back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  display: flex;
}

/* Link de telefone dentro de cards/rodapé — mantém a cor do texto ao redor */
.contact-link {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s ease;
}

.contact-link:hover {
  color: #0091da;
  text-decoration: underline;
}

/* Scrollbar mais discreta (opcional, apenas navegadores baseados em WebKit) */
::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: #f1f1f1;
}
::-webkit-scrollbar-thumb {
  background: #00338d;
  border-radius: 6px;
}

/* =====================================================================
   LOJA (loja.html) — montra de produtos vinda da API do Fatura+.

   Escrito em CSS simples de propósito: o css/tailwind.css deste site é
   um build purgado, gerado a partir das páginas que já existiam, e o
   projecto não traz toolchain de build. Classes Tailwind novas não
   apareceriam no ficheiro compilado; estas aparecem sempre.
   ===================================================================== */

/* ---------- Barra de pesquisa e filtros ---------- */
.shop-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

.shop-toolbar__search,
.shop-toolbar__select {
  /* O min-width:0 é o que faz a diferença no telemóvel: sem ele, a largura
     mínima de um item de flex é o seu min-content, e o min-content de um
     <select> é a largura da opção mais comprida ("Todas as categorias", ou
     o maior nome de categoria que vier do Fatura+). O campo recusava-se a
     encolher e passava para fora do ecrã. */
  min-width: 0;
  max-width: 100%;
  padding: 12px 16px;
  border: 1px solid #d7dbe3;
  border-radius: 2px;
  /* 16px de propósito: abaixo disto o Safari do iPhone dá zoom à página
     inteira quando se toca no campo, e o site fica cortado ao lado. */
  font-size: 16px;
  line-height: 1.3;
  color: #1f2937;
  background: #fff;
}

/* Telemóvel: cada controlo na sua linha, a toda a largura disponível. */
.shop-toolbar__search {
  flex: 1 1 100%;
}

.shop-toolbar__select {
  flex: 1 1 100%;
  width: 100%;
  /* Nome de categoria que não caiba fica com reticências em vez de esticar
     o campo — a lista aberta continua a mostrar o nome completo. */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.shop-count {
  flex: 1 1 100%;
  font-size: 13px;
  color: #6b7280;
}

/* Sem resultados escritos, o contador não ocupa uma linha vazia. */
.shop-count:empty {
  display: none;
}

/* A partir de tablet cabem os três na mesma linha, como antes. */
@media (min-width: 640px) {
  .shop-toolbar__search {
    flex: 1 1 260px;
  }

  .shop-toolbar__select {
    flex: 0 1 auto;
    width: auto;
    max-width: 280px;
    font-size: 15px;
  }

  .shop-count {
    flex: 0 0 auto;
    margin-left: auto;
  }
}

.shop-toolbar__search:focus,
.shop-toolbar__select:focus {
  outline: 2px solid #0091da;
  outline-offset: 1px;
  border-color: #0091da;
}

/* ---------- Grelha ---------- */
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 24px;
}

/* ---------- Cartão de produto ---------- */
.prod-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #e8eaee;
  border-radius: 2px;
  overflow: hidden;
  transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.prod-card:hover {
  box-shadow: 0 10px 28px rgba(0, 26, 92, 0.10);
  border-color: #cfd6e4;
  transform: translateY(-2px);
}

.prod-card__media {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 4 / 3;
  padding: 0;
  border: 0;
  background: #f4f6f9;
  cursor: pointer;
  overflow: hidden;
}

.prod-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.prod-card:hover .prod-card__img {
  transform: scale(1.04);
}

.prod-card__noimg {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9aa3b2;
}

.prod-card__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 16px 18px 18px;
}

.prod-card__cat {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #0091da;
  margin-bottom: 6px;
}

.prod-card__name {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
  color: #111827;
  margin-bottom: 4px;
}

.prod-card__name button {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.prod-card__name button:hover {
  color: #00338d;
}

.prod-card__ref {
  font-size: 12px;
  color: #9aa3b2;
  margin-bottom: 8px;
}

.prod-card__desc {
  font-size: 14px;
  line-height: 1.5;
  color: #6b7280;
  margin-bottom: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Sem preço no cartão: o rodapé leva só o botão de cotação, a toda a largura. */
.prod-card__foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid #f0f2f5;
}

.prod-card__foot .btn-quote {
  display: block;
  width: 100%;
  text-align: center;
}

/* ---------- Botão de cotação ---------- */
.btn-quote {
  display: inline-block;
  padding: 9px 16px;
  border: 0;
  border-radius: 2px;
  background: #00338d;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.btn-quote:hover {
  background: #001a5c;
  color: #fff;
}

.btn-quote--lg {
  padding: 14px 28px;
  font-size: 15px;
}

/* ---------- Estados: vazio, erro ---------- */
.shop-state {
  padding: 64px 24px;
  text-align: center;
}

.shop-state__msg {
  font-size: 15px;
  color: #6b7280;
  margin-bottom: 16px;
}

/* ---------- Esqueletos de carregamento ---------- */
.prod-card--skeleton {
  pointer-events: none;
}

.prod-card--skeleton .prod-card__media {
  background: #eef1f5;
}

.skel {
  display: block;
  height: 12px;
  border-radius: 3px;
  margin-bottom: 10px;
  background: linear-gradient(90deg, #eef1f5 25%, #e2e7ee 37%, #eef1f5 63%);
  background-size: 400% 100%;
  animation: shop-shimmer 1.3s ease-in-out infinite;
}

.skel--sm { width: 40%; }
.skel--md { width: 55%; }
.skel--lg { width: 85%; height: 16px; }

@keyframes shop-shimmer {
  0%   { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

@media (prefers-reduced-motion: reduce) {
  .skel { animation: none; }
  .prod-card,
  .prod-card__img { transition: none; }
}

/* ---------- Paginação ---------- */
.shop-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 40px;
}

.shop-pager__btn {
  padding: 10px 20px;
  border: 1px solid #d7dbe3;
  border-radius: 2px;
  background: #fff;
  font-size: 14px;
  font-weight: 600;
  color: #00338d;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.shop-pager__btn:hover:not(:disabled) {
  background: #f4f6f9;
  border-color: #00338d;
}

.shop-pager__btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.shop-pager__info {
  font-size: 14px;
  color: #6b7280;
}

/* ---------- Modal de detalhe ---------- */
.shop-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(8, 22, 43, 0.65);
}

.shop-modal.is-open {
  display: flex;
}

.shop-modal__panel {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 2px;
}

@media (min-width: 768px) {
  .shop-modal__panel {
    grid-template-columns: 1fr 1fr;
  }
}

.shop-modal__close {
  position: absolute;
  top: 8px;
  right: 12px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  font-size: 26px;
  line-height: 1;
  color: #374151;
  cursor: pointer;
}

.shop-modal__close:hover {
  background: #fff;
  color: #00338d;
}

.shop-modal__media {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  background: #f4f6f9;
}

.shop-modal__img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 2px;
  background: #fff;
}

.shop-modal__thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.shop-modal__thumb {
  width: 56px;
  height: 56px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 2px;
  background: #fff;
  cursor: pointer;
  overflow: hidden;
}

.shop-modal__thumb.is-active {
  border-color: #00338d;
}

.shop-modal__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.shop-modal__info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 32px 28px;
}

.shop-modal__name {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.25;
  color: #111827;
  margin-bottom: 8px;
}

.shop-modal__desc {
  font-size: 15px;
  line-height: 1.65;
  color: #4b5563;
  margin-bottom: 24px;
}

/* O css/styles.css carrega depois do css/tailwind.css, por isso as regras
   de display acima ganhavam ao .hidden do Tailwind (mesma especificidade,
   ordem decide) e o paginador nunca chegava a esconder-se. */
.shop-pager.hidden,
.shop-state.hidden,
.shop-toolbar__select.hidden {
  display: none;
}
