/* Componentes reutilizaveis: botao, card, form, badge, flash */

/* ===== Botoes ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  height: 44px;
  padding: 0 var(--sp-5);
  border: 0;
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--grad-destaque);
  color: var(--text-invert);
  box-shadow: 0 4px 12px var(--accent-glow);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px var(--accent-glow);
  color: var(--text-invert);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
  font-weight: 500;
}
.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  font-weight: 500;
}
.btn-ghost:hover { color: var(--accent); }

.btn-lg { height: 52px; padding: 0 var(--sp-6); font-size: 16px; }
.btn-sm { height: 36px; padding: 0 var(--sp-4); font-size: 14px; }

/* ===== Card ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-5);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}
.card:hover { box-shadow: var(--shadow); border-color: var(--border-strong); }

.card-neu {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  box-shadow: var(--shadow-neu);
  border: 0;
}

/* ===== Formulario ===== */
.form-grupo { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--sp-4); }

.form-grupo label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.form-grupo input,
.form-grupo textarea,
.form-grupo select {
  width: 100%;
  height: 48px;
  padding: 0 var(--sp-4);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-grupo textarea {
  height: auto;
  min-height: 120px;
  padding: var(--sp-3) var(--sp-4);
  resize: vertical;
  font-family: inherit;
  line-height: 1.5;
}

.form-grupo input:focus,
.form-grupo textarea:focus,
.form-grupo select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.form-grupo input::placeholder,
.form-grupo textarea::placeholder { color: var(--text-mute); }

/* ===== Badge ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent-hover);
}

/* ===== Flash / alerta ===== */
.flash {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-sm);
  margin-bottom: var(--sp-4);
  font-size: 14px;
  font-weight: 500;
}
.flash-sucesso { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.flash-erro    { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.flash-aviso   { background: #fff3cd; color: #856404; border: 1px solid #ffeaa7; }

/* ===== Header publico ===== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.header .container {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.header-logo img { height: 52px; width: auto; }
.header-nav { display: flex; gap: var(--sp-5); align-items: center; }
.header-nav a {
  color: var(--text);
  font-weight: 500;
  font-size: 15px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}
.header-nav a:hover { color: var(--accent); background: var(--accent-soft); }
.header-nav a.ativo { color: var(--accent); }

/* ===== Footer publico ===== */
.footer {
  background: var(--text);
  color: var(--text-invert);
  padding: var(--sp-8) 0 var(--sp-5);
  margin-top: var(--sp-9);
}
.footer .container {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: var(--sp-6);
}
.footer-marca img { height: 36px; margin-bottom: var(--sp-3); }
.footer-marca p { color: rgba(255, 255, 255, 0.7); font-size: 14px; margin: 0; max-width: 320px; }
.footer h3 { color: var(--text-invert); font-size: 14px; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: var(--sp-3); }
.footer ul { list-style: none; padding: 0; margin: 0; }
.footer li { margin-bottom: var(--sp-2); }
.footer a { color: rgba(255, 255, 255, 0.7); font-size: 14px; }
.footer a:hover { color: var(--accent); }
.footer-base {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: var(--sp-4);
  margin-top: var(--sp-6);
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
  text-align: center;
}

/* ===== WhatsApp float ===== */
.wa-float {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  background: transparent;
  border: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  z-index: 999;
  transition: transform var(--transition), box-shadow var(--transition);
}
.wa-float:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}
.wa-brand-icon { display:block; width:32px; height:32px; object-fit:contain; flex-shrink:0; }
.wa-float .wa-brand-icon { width:50px; height:50px; }
.wa-contact-link { display:inline-flex; align-items:center; gap:8px; min-height:44px; }
.wa-contact-link .wa-brand-icon { width:20px; height:20px; }
.btn .wa-brand-icon { width:24px; height:24px; }
@media(prefers-reduced-motion:reduce) { .wa-float { transition:none; } .wa-float:hover { transform:none; } }

/* ===== Admin: login card ===== */
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--sp-5);
  background: var(--grad-fundo);
}
.login-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--sp-7);
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-neu);
}
.login-card .marca {
  text-align: center;
  margin-bottom: var(--sp-6);
}
.login-card .marca img { height: 40px; margin: 0 auto; }
.login-card h1 {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  margin-bottom: var(--sp-2);
}
.login-card .sub {
  color: var(--text-dim);
  text-align: center;
  margin-bottom: var(--sp-5);
  font-size: 14px;
}

/* ===== Responsivo ===== */
@media (max-width: 768px) {
  .header-nav { gap: var(--sp-2); }
  .header-nav a { padding: 6px 10px; font-size: 14px; }
  .footer .container { grid-template-columns: 1fr; }
  .wa-float { bottom: 16px; right: 16px; width: 54px; height: 54px; }
  .wa-float .wa-brand-icon { width:46px; height:46px; }
}

/* ===== Banner de cookies (LGPD) ===== */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4);
  max-width: var(--container);
  margin: var(--sp-4) auto;
  padding: var(--sp-4) var(--sp-5);
  background: var(--surface);
  border-top: 3px solid var(--accent-hover);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.cookie-banner.fechando {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity var(--transition), transform var(--transition);
}
.cookie-banner-texto { flex: 1 1 320px; min-width: 0; }
.cookie-banner-texto strong { display: block; font-size: 15px; margin-bottom: var(--sp-1); }
.cookie-banner-texto p { margin: 0; font-size: 13px; color: var(--text-dim); line-height: 1.5; }
.cookie-banner-texto a { color: var(--accent-hover); font-weight: 600; }
.cookie-banner-acoes { display: flex; gap: var(--sp-2); align-items: center; flex-shrink: 0; }
.cookie-form { margin: 0; }

@media (max-width: 768px) {
  .cookie-banner {
    margin: var(--sp-2);
    padding: var(--sp-4);
  }
  .cookie-banner-acoes { width: 100%; }
  .cookie-banner-acoes .cookie-form { flex: 1; }
  .cookie-banner-acoes .btn { width: 100%; }
}

/* Consentimento LGPD no formulario publico */
.form-consentimento {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  font-weight: normal;
}
.form-consentimento input[type="checkbox"] {
  margin-top: .3rem;
}

/* ===== SelectBusca (dropdown customizado, substitui <select> nativo) ===== */
.selectbusca { position: relative; }
.sb-display {
  padding: 8px 10px;
  background: #FFF;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.sb-display:hover { border-color: var(--text-dim); }
.selectbusca.open .sb-display {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.sb-display svg {
  flex-shrink: 0;
  color: var(--text-mute);
  transition: transform .2s;
}
.selectbusca.open .sb-display svg { transform: rotate(180deg); }
.sb-label {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.sb-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  z-index: 50;
  background: #FFF;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-height: 240px;
  overflow-y: auto;
  display: none;
}
.selectbusca.open .sb-panel { display: block; }

.sb-search {
  width: 100%;
  padding: 8px 10px;
  background: var(--surface);
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
}
.sb-search:focus { background: #FFF; }

.sb-opt {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  transition: background .12s;
}
.sb-opt:hover { background: var(--accent-soft); color: var(--accent-hover); }
.sb-opt.ativo {
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-weight: 600;
}
.sb-vazio {
  padding: 12px;
  text-align: center;
  color: var(--text-mute);
  font-size: 12px;
}
