/* Estilos principais: layout responsivo e componentes */
:root {
  --container-max: 1100px;
  --primary-font: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, 'Helvetica Neue', Arial, sans-serif;
  --text-color: #1f2937;
  --muted-text: #5b6470;
  --border-soft: #e6e9ef;
  --bg-soft: #f8fafc;
  --accent: #475569;
  --accent-strong: #334155;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--text-color);
  font-family: var(--primary-font);
  background: #fff;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 90%;
  max-width: var(--container-max);
  margin: 0 auto;
}

/* Header */
.site-header { background: #fff; border-bottom: 1px solid var(--border-soft); position: relative; }
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand .logo { height: 42px; width: auto; display: block; }
.site-name { font-weight: 600; font-size: 1.1rem; letter-spacing: 0.2px; color: var(--accent-strong); }
.main-nav { display: flex; align-items: center; }
.main-nav a { margin-left: 16px; text-decoration: none; color: #3a3f46; transition: color .2s ease; }
.main-nav a:hover { color: var(--accent-strong); }
.greeting { margin-left: 16px; color: #555; }
/* Botão sanduíche (desktop oculto) */
.menu-toggle { display: none; background: #fff; border: 1px solid var(--border-soft); color: #2f353b; border-radius: 8px; padding: 8px 10px; font-size: 1rem; cursor: pointer; }
.menu-toggle:hover { background: #f6f7fa; }

/* Banner */
.banner {
  position: relative;
  min-height: 500px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-size: cover;
  background-position: center;
}
.banner .overlay {
  position: absolute;
  inset: 0;
}
.banner .content {
  position: relative;
  z-index: 1;
  color: #fff;
  text-align: left;
  padding: 24px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.banner .content h1 { font-size: var(--banner-font-desktop, 22px); color: var(--banner-text-color, #fff); margin: 0; }

/* Catálogos Grid */
.catalog-section { padding: 28px 0 40px; }
.catalog-section h2 { margin: 0 0 6px; }
.catalog-section p.sub { margin: 0 0 20px; color: #555; }
.grid { display: grid; grid-template-columns: repeat(var(--grid-cols, 3), 1fr); gap: 18px; }
.card { border: 1px solid var(--border-soft); border-radius: 10px; overflow: hidden; background: #fff; display: flex; flex-direction: column; transition: box-shadow .2s ease, transform .2s ease; }
.card img { width: 100%; height: auto; }
.card .image-slot { width: var(--card-area-w, 250px); height: var(--card-area-h, 350px); aspect-ratio: var(--card-aspect-ratio, auto); margin: 0; overflow: hidden; background: #f7f7f7; display: block; align-self: var(--card-area-align-self, center); }
.card .image-slot img { width: 100%; height: 100%; display: block; object-fit: var(--card-object-fit, contain); object-position: var(--card-object-pos, 50% 50%); }
.card .body { padding: 14px; flex: 1; }
.card .title { font-weight: 600; margin: 0 0 8px; color: var(--accent-strong); }
.card .title { text-align: center; }
.card .desc { color: var(--muted-text); font-size: 0.95rem; }
.card .desc { text-align: justify; }
.card .actions { display: flex; gap: 10px; padding: 12px; justify-content: center; align-items: center; }
.card:hover { box-shadow: 0 6px 16px rgba(17, 24, 39, 0.08); transform: translateY(-2px); }
.btn { display: inline-block; padding: 8px 14px; border-radius: 8px; text-decoration: none; font-weight: 600; font-size: 0.95rem; border: 1px solid transparent; transition: background-color .2s ease, box-shadow .2s ease, transform .1s ease; }
.btn.primary { background: var(--accent-strong); color: #fff; box-shadow: 0 3px 8px rgba(51,65,85,.18); }
.btn.primary:hover { box-shadow: 0 6px 14px rgba(51,65,85,.22); transform: translateY(-1px); }
.btn.secondary { background: #f1f3f5; color: #2f353b; border-color: var(--border-soft); }
.btn.secondary:hover { background: #e9ecef; }

/* Página de catálogo (detalhe) */
.catalog-detail h2.title { text-align: center; }
.catalog-detail .catalog-image { display: block; margin: 0 auto; max-width: 100%; height: auto; object-fit: contain; border-radius: 8px; }
.catalog-detail .desc { margin-top: 12px; max-width: 800px; margin-left: auto; margin-right: auto; text-align: justify; text-align-last: center; }
.catalog-detail .desc p { margin: 0; }
.catalog-detail .actions { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 12px; }

/* Footer */
.site-footer { background: #000; color: #bbb; padding: 8px 0; margin-top: auto; }
.site-footer a { color: #fff; }
.site-footer .container { max-width: 700px; text-align: center; }
/* Compacta tipografia do rodapé para reduzir altura */
.site-footer p { margin: 0; line-height: 1.2; font-size: 0.9rem; }
/* Separador no desktop/tablet */
.site-footer .footer-line-1::after { content: " | "; }
/* Quebra de linhas específica para rodapé no mobile */
@media (max-width: 600px) {
  .site-footer .footer-line-1,
  .site-footer .footer-line-2 { display: block; }
  .site-footer .footer-line-2 { margin-top: 4px; }
  .site-footer .footer-line-1::after { content: ""; }
}

/* Responsive */
@media (max-width: 992px) { .grid { gap: 16px; } .banner { min-height: 500px; } }
@media (max-width: 992px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .banner { min-height: 500px; background-position: center center; background-size: cover; }
  .banner .content h1 { font-size: var(--banner-font-tablet, 18px); line-height: 1.4; overflow-wrap: break-word; word-break: break-word; hyphens: auto; }
}
/* Mobile nav: regras para <=992px */
@media (max-width: 992px) {
  .menu-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .main-nav { display: none; position: absolute; top: 100%; right: 0; left: 0; background: #fff; border-top: 1px solid var(--border-soft); flex-direction: column; padding: 10px; box-shadow: 0 6px 16px rgba(17,24,39,0.08); z-index: 10; }
  .main-nav.open { display: flex; }
  .main-nav a { margin: 8px 16px; }
  .greeting { margin: 8px 16px; }
}
@media (max-width: 600px) {
  .grid { grid-template-columns: 1fr; gap: 14px; }
  .header-inner { flex-direction: row; align-items: center; justify-content: space-between; gap: 6px; padding: 8px 0; }
  .brand .logo { height: 34px; }
  .site-name { font-size: 0.95rem; }
  .main-nav a { margin-left: 12px; font-size: 0.95rem; }
  .greeting { font-size: 0.9rem; }
  .banner { min-height: 500px; background-position: center center; background-size: cover; background-repeat: no-repeat; }
  .banner .content { padding: 12px; }
  .banner .content h1 { font-size: var(--banner-font-mobile, 18px); line-height: 1.35; overflow-wrap: break-word; word-break: break-word; hyphens: auto; }
  .card img { height: auto; }
}
/* Ajustes finos para <=600px */
@media (max-width: 600px) {
  .main-nav a { margin: 8px 12px; }
}

/* Admin */
.admin-page { padding: 20px 0 40px; }
.admin-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.admin-header h2 { margin: 0; }
.admin-header .btn { white-space: nowrap; }
.admin-group { border: 1px solid #eee; border-radius: 8px; padding: 16px; margin-bottom: 18px; background: #fff; }
.admin-group h3 { margin-top: 0; }
.admin-form-row { display: grid; grid-template-columns: 1fr; gap: 12px; }
.admin-form-row .full { grid-column: 1 / -1; }
/* Admin layout improvements */
.admin-sections { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.admin-sections .full-span { grid-column: 1 / -1; }
.messages { margin-bottom: 12px; }
.notice { background: #e8ffe8; color: #0a0; padding: 8px; border-radius: 6px; }
.error { background: #ffe5e5; color: #a00; padding: 8px; border-radius: 6px; }
.admin-group label { display: block; font-weight: 600; margin-bottom: 4px; }
table thead th { background: #f6f7fa; font-weight: 600; color: #3a3f46; }
tbody tr:hover { background: #f9fafb; }
details summary { cursor: pointer; color: inherit; }
details summary:hover { text-decoration: none; }
/* Faz o summary com classe .btn se comportar como botão, sem marcador */
details summary.btn { list-style: none; }
details summary.btn::marker { content: ""; }
details summary.btn::-webkit-details-marker { display: none; }
input[type="text"], input[type="url"], input[type="password"], textarea { width: 100%; padding: 10px; border: 1px solid var(--border-soft); border-radius: 8px; transition: border-color .2s ease, box-shadow .2s ease; }
textarea { min-height: 100px; }
input[type="text"]:focus, input[type="url"]:focus, input[type="password"]:focus, textarea:focus { outline: none; border-color: var(--accent-strong); box-shadow: 0 0 0 3px rgba(51,65,85,.15); }
table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--border-soft); }
th, td { border: 1px solid var(--border-soft); padding: 10px; text-align: left; }
/* Campo de ordem mais compacto */
.order-input { width: 64px; }
/* Linhas arrastáveis na tabela de catálogos */
.draggable-row { cursor: move; }
.draggable-row.dragging { opacity: 0.6; }
.draggable-row.drag-over { outline: 2px dashed #a0aec0; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.45); display: none; align-items: center; justify-content: center; backdrop-filter: blur(2px); }
.modal { background: #fff; border-radius: 10px; padding: 16px; width: min(520px, 92vw); box-shadow: 0 12px 32px rgba(17, 24, 39, 0.18); }
.modal h4 { margin-top: 0; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* Mobile override for admin header */
@media (max-width: 600px) {
  .admin-header { flex-direction: column; align-items: flex-start; }
  .admin-form-row { grid-template-columns: 1fr; }
  .admin-sections { grid-template-columns: 1fr; }
}
