/* ==========================================================================
   COMPONENTS.CSS
   Botões, cards, badges, formulários, modal e o switch de tema.
   Componentes genéricos: reutilize em qualquer página nova.
   ========================================================================== */

/* ---------- LOGO CLARO/ESCURO ----------
   Cada logo tem uma versão para o tema claro e outra para o tema escuro.
   Coloque as duas imagens lado a lado no HTML com as classes abaixo — o CSS
   troca qual delas aparece de acordo com [data-theme] no <html>. */
.logo-light {
  display: inline-block;
}
.logo-dark {
  display: none;
}
[data-theme='dark'] .logo-light {
  display: none;
}
[data-theme='dark'] .logo-dark {
  display: inline-block;
}

.brand-accent {
  color: var(--color-primary);
}

/* ---------- PLACEHOLDER DE FOTO ----------
   Use em qualquer lugar que ainda não tem uma foto real (seção "como
   funciona", galeria de contato, etc). Quando tiver a imagem, troque este
   bloco por um <img>. */
.photo-placeholder {
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-md);
  border: 2px dashed var(--color-border);
  background: var(--color-bg-alt);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  color: var(--color-text-muted);
  text-align: center;
  padding: var(--space-sm);
}

.photo-placeholder svg {
  width: 28px;
  height: 28px;
  color: var(--color-primary);
}

.photo-placeholder span {
  font-size: 0.8rem;
  font-weight: 500;
}

.step-card .photo-placeholder {
  aspect-ratio: 16 / 10;
  margin-top: var(--space-sm);
}

/* ---------- BOTÕES ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.6rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  border: 2px solid transparent;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: var(--shadow-md);
}

.btn-primary:hover {
  box-shadow: var(--shadow-lg);
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border);
}

.btn-secondary:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border-color: currentColor;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 0.55rem 1.1rem;
  font-size: 0.85rem;
}

/* ---------- THEME TOGGLE ---------- */
.theme-toggle {
  position: relative;
  width: 54px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  display: inline-flex;
  align-items: center;
  padding: 3px;
  flex-shrink: 0;
}

.theme-toggle .toggle-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: transform var(--transition-base);
  transform: translateX(0);
}

[data-theme='dark'] .theme-toggle .toggle-thumb {
  transform: translateX(24px);
}

.theme-toggle .toggle-thumb svg {
  width: 13px;
  height: 13px;
}

/* ---------- CARDS ---------- */
.feature-card,
.step-card,
.contact-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.feature-card:hover,
.contact-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.feature-card .icon-wrap,
.contact-card .icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--color-bg-alt);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-sm);
}

.feature-card .icon-wrap svg,
.contact-card .icon-wrap svg {
  width: 24px;
  height: 24px;
}

.step-card {
  counter-increment: step;
  position: relative;
  padding-top: var(--space-lg);
}

.step-card::before {
  content: counter(step);
  position: absolute;
  top: -18px;
  left: var(--space-md);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

/* ---------- PRODUCT CARD (catálogo) ---------- */
.product-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.product-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-md);
}

.product-thumb {
  aspect-ratio: 4 / 3;
  background: var(--gradient-hero);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  color: var(--color-primary);
}

.product-thumb svg {
  width: 40%;
  height: 40%;
  opacity: 0.85;
}

/* Quando o produto já tem uma foto real (campo "image" em catalog-data.js),
   ela preenche a miniatura por completo no lugar do ícone. */
.product-thumb img.product-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-thumb .product-category {
  position: absolute;
  top: 0.7rem;
  left: 0.7rem;
  background: var(--color-surface);
  color: var(--color-secondary);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}
[data-theme='dark'] .product-thumb .product-category {
  color: var(--color-secondary-light);
}

.product-body {
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.product-body h3 {
  margin: 0;
}

.product-body .product-desc {
  font-size: 0.9rem;
  margin: 0;
  flex: 1;
}

.product-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.4rem;
}

.product-price {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--color-primary);
}

.product-price small {
  display: block;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 0.7rem;
  color: var(--color-text-muted);
}

.product-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tag {
  font-size: 0.72rem;
  background: var(--color-bg-alt);
  color: var(--color-text-muted);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

/* ---------- FILTER CHIPS ---------- */
.filter-chip {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
  transition: all var(--transition-fast);
}

.filter-chip:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.filter-chip.active {
  background: var(--gradient-primary);
  border-color: transparent;
  color: #fff;
}

/* ---------- FORMULÁRIO ---------- */
.form-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-md);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
}

.form-group {
  margin-bottom: var(--space-sm);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-text);
}

.form-group .hint {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.form-group input[type='text'],
.form-group input[type='email'],
.form-group input[type='tel'],
.form-group input[type='date'],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 25%, transparent);
  outline: none;
}

.form-group textarea {
  resize: vertical;
  min-height: 110px;
}

/* Campo de anexo (drag & drop) */
.file-drop {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  padding: var(--space-md);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast);
  position: relative;
}

.file-drop:hover,
.file-drop.dragover {
  border-color: var(--color-primary);
  background: var(--color-bg-alt);
}

.file-drop input[type='file'] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-drop .file-drop-icon {
  width: 34px;
  height: 34px;
  margin: 0 auto 0.5rem;
  color: var(--color-primary);
}

.file-list {
  margin-top: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.file-list .file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-bg-alt);
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--color-text);
}

.file-list .file-item button {
  background: none;
  border: none;
  color: var(--color-danger);
  font-weight: 700;
}

/* Feedback de envio */
.form-feedback {
  display: none;
  margin-top: var(--space-sm);
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
}

.form-feedback.success {
  display: block;
  background: color-mix(in srgb, var(--color-success) 15%, transparent);
  color: var(--color-success);
}

.form-feedback.error {
  display: block;
  background: color-mix(in srgb, var(--color-danger) 15%, transparent);
  color: var(--color-danger);
}

/* ---------- MODAL (detalhes do projeto) ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 30, 0.6);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  z-index: 200;
}

.modal-overlay.open {
  display: flex;
}

.modal-box {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: var(--space-lg);
  position: relative;
  box-shadow: var(--shadow-lg);
}

.modal-close {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  background: var(--color-bg-alt);
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text);
}

.modal-thumb {
  aspect-ratio: 16/9;
  border-radius: var(--radius-md);
  background: var(--gradient-hero);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  margin-bottom: var(--space-md);
}

.modal-thumb svg {
  width: 30%;
  height: 30%;
}

.modal-thumb img.product-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-md);
}

.modal-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: var(--space-md) 0;
}

/* ---------- BADGES / TOAST ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  padding: 0.9rem 1.2rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  transform: translateY(140%);
  transition: transform var(--transition-base);
  z-index: 300;
  max-width: 320px;
}

.toast.show {
  transform: translateY(0);
}

/* ---------- BACK TO TOP ---------- */
.back-to-top {
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: all var(--transition-base);
  z-index: 150;
  border: none;
}

.back-to-top.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

@media (max-width: 640px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}
