/* =========================
   BASE THEME + DARK (RPG)
   ========================= */

:root {
  --bg-page: #f5f1e6;
  --bg-card: #ffffff;
  --bg-alt: #f0e6d2;
  --bg-hero: #ebe0c6;

  --text-main: #20241a;
  --text-muted: #5c6456;

  --accent: #234322;
  --accent-soft: #3c5d38;
  --accent-gold: #d3a845;

  --border-soft: #d3c7b4;

  --shadow-soft: 0 12px 30px rgba(0, 0, 0, 0.08);

  --radius-card: 16px;

  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: "Georgia", "Times New Roman", serif;

  --transition: 0.25s ease;
}

/* modo escuro RPG para site público */

body.theme-quest {
  --bg-page: #18120c;
  --bg-card: #231811;
  --bg-alt: #251b12;
  --bg-hero: #2e2117;

  --text-main: #f7e4cf;
  --text-muted: #c6ad92;

  --accent: #f2c36b;
  --accent-soft: #f0d48f;
  --accent-gold: #f8dd95;

  --border-soft: #4a2a18;

  --shadow-soft: 0 16px 30px rgba(0, 0, 0, 0.45);
}

/* =========================
   RESET / BASE
   ========================= */

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.4rem;
}

/* =========================
   TOPBAR (PÚBLICO + PORTAL)
   ========================= */

.topbar {
  position: sticky;
  top: 0;
  background-color: rgba(245, 241, 230, 0.96);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
  z-index: 20;
}

body.theme-quest .topbar {
  background-color: rgba(24, 18, 12, 0.96);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.brand-logo {
  height: 40px;
}

.brand-logo img {
  height: 40px;
  width: auto;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}

.brand-name {
  font-family: var(--font-serif);
  letter-spacing: 0.12em;
  font-size: 0.85rem;
}

.brand-tagline {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.user-label {
  font-size: 0.86rem;
  color: var(--text-muted);
}

.backup-link {
  color: var(--accent);
  cursor: pointer;
}

.backup-link:hover {
  text-decoration: none;
}


/* ====== NAV PÚBLICO ====== */

.main-nav {
  display: flex;
  align-items: center;
  gap: 1.3rem;
  font-size: 0.9rem;
}

.main-nav a {
  position: relative;
  padding-bottom: 0.1rem;
}

.main-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 2px;
  background-color: var(--accent);
  transition: width 0.18s ease;
}

.main-nav a:hover::after {
  width: 100%;
}

/* =========================
   BOTÕES
   ========================= */

.btn {
  border-radius: 999px;
  padding: 0.5rem 1.2rem;
  border: 1px solid transparent;
  font-size: 0.9rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background-color var(--transition),
    color var(--transition),
    border-color var(--transition),
    box-shadow var(--transition),
    transform var(--transition);
}

.btn-solid {
  background-color: var(--accent);
  color: #fffdf5;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
}

.btn-solid:hover {
  background-color: var(--accent-soft);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
  transform: translateY(-1px);
}

.btn-outline {
  background-color: transparent;
  color: var(--accent);
  border-color: var(--border-soft);
}

.btn-outline:hover {
  border-color: var(--accent);
}

.btn-ghost {
  background-color: transparent;
  color: var(--accent);
  border-color: var(--border-soft);
}

.btn-ghost:hover {
  border-color: var(--accent);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background-color: #f4e2c3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.18);
  transition:
    transform var(--transition),
    box-shadow var(--transition);
}

.icon-btn:hover {
  transform: translateY(-1px) rotate(-3deg);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.24);
}

body.theme-quest .icon-btn {
  background-color: #5d3718;
}

.icon-btn2 {
  width: 42px;
  height: 42px;
  /*border-radius: 999px;*/
  border: none;
  background-color: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  /*box-shadow: 0 10px 22px rgba(0, 0, 0, 0.18);*/
  transition:
    transform var(--transition),
    box-shadow var(--transition);
}

.icon-btn2:hover {
  transform: translateY(-1px) rotate(-3deg);
  /*box-shadow: 0 12px 26px rgba(0, 0, 0, 0.24);*/
}

/* =========================
   LANDING / PÚBLICO
   ========================= */

.public-body {
  background-color: var(--bg-page);
}

/* HERO */

.hero {
  background-color: var(--bg-hero);
  padding: 3.2rem 0 3.4rem;
}

.hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 3.5fr) minmax(0, 3fr);
  gap: 2.4rem;
  align-items: center;
}

.hero-main {
  width: 100%;
}

.hero-kicker {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--text-muted);
  margin: 0 0 0.7rem;
}

.hero-main h1 {
  font-family: var(--font-serif);
  font-size: clamp(2.1rem, 3vw + 1rem, 3rem);
  margin: 0 0 0.75rem;
}

.hero-sub {
  font-size: 0.98rem;
  color: var(--text-muted);
  max-width: 32rem;
  margin: 0 0 1.3rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-bottom: 1.1rem;
}

.hero-badges {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0;
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.hero-badges li {
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background-color: rgba(255, 255, 255, 0.9);
}

body.theme-quest .hero-badges li {
  background-color: rgba(0, 0, 0, 0.3);
}

/* HERO SIDE PANEL */

.hero-side {
  width: 100%;
}

.panel {
  background-color: var(--bg-card);
  border-radius: 18px;
  border: 1px solid var(--border-soft);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.panel-image {
  width: 100%;
  display: block;
}

.panel-body {
  padding: 1.1rem 1.3rem 1.3rem;
}

.panel-body h2 {
  margin: 0 0 0.6rem;
  font-family: var(--font-serif);
  font-size: 1.1rem;
}

.panel-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.panel-list li {
  padding: 0.25rem 0;
}

/* SEÇÕES GENÉRICAS */

.section {
  padding: 3rem 0;
}

.section-alt {
  background-color: var(--bg-alt);
}

.section-header {
  margin-bottom: 1.7rem;
}

.section-header h2 {
  font-family: var(--font-serif);
  font-size: 1.7rem;
  margin: 0 0 0.4rem;
}

.section-header p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-muted);
  /*max-width: 30rem;*/
}

/* CARDS PÚBLICOS */

.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.3rem;
}

.card {
  background-color: var(--bg-card);
  border-radius: var(--radius-card);
  border: 1px solid var(--border-soft);
  padding: 1.3rem 1.4rem;
  box-shadow: var(--shadow-soft);
}

.card h3 {
  margin: 0 0 0.3rem;
  font-family: var(--font-serif);
  font-size: 1.1rem;
}

.card-sub {
  margin: 0 0 0.5rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.card-list {
  list-style: none;
  padding: 0;
  margin: 0.3rem 0 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.card-list li {
  padding: 0.2rem 0;
}

.card-accent {
  border-color: var(--accent-gold);
}

/* GRID ESPECÍFICA PARA PLANOS (4 / 2 / 1) */

.plans-grid {
  display: grid;
  gap: 1.3rem;
  grid-template-columns: repeat(1, minmax(0, 1fr)); /* mobile padrão */
}

/* telas médias: 2 planos por linha */
@media (min-width: 640px) {
  .plans-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* desktop: 4 planos lado a lado */
@media (min-width: 1024px) {
  .plans-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}


/* JOURNEY / MAPA */

#journey {
    /* 1. Torna a seção um ponto de referência para o posicionamento */
    position: relative; 
    /* Garante que o conteúdo fique por cima da imagem transparente */
    z-index: 1;
}

#journey::before {
    /* 2. Cria a camada de fundo */
    content: ""; 
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    
    /* 3. Aplica a imagem de fundo */
    background-image: url('map.jpg');
    background-size: cover; 
    background-position: center; 
    
    /* 4. Define a opacidade desejada (0.4) */
    opacity: 0.05;
    
    /* 5. Garante que esta camada fique atrás do conteúdo da seção */
    z-index: -1; 
}

.journey-steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.1rem;
}

.journey-step {
  background-color: var(--bg-card);
  border-radius: 14px;
  border: 1px solid var(--border-soft);
  padding: 0.9rem 1rem;
  font-size: 0.9rem;
}

.journey-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.3rem;
}

/* MÉTODO */

.system-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.3rem;
}

.system-item {
  background-color: var(--bg-card);
  border-radius: 14px;
  border: 1px solid var(--border-soft);
  padding: 1rem 1rem 1.1rem;
  font-size: 0.9rem;
}

.system-icon {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid var(--accent-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  margin-bottom: 0.4rem;
}

/* CONTATO (PÚBLICO) */

.contact-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr);
  gap: 1.8rem;
}

.contact-form {
  background-color: var(--bg-card);
  border-radius: var(--radius-card);
  border: 1px solid var(--border-soft);
  padding: 1.5rem 1.6rem;
  box-shadow: var(--shadow-soft);
  display: grid;
  gap: 0.9rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-bottom: 0.8rem;
}

.field-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

label {
  font-size: 0.86rem;
}

input,
select,
textarea {
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  padding: 0.5rem 0.6rem;
  font-family: inherit;
  font-size: 0.9rem;
  background-color: #ffffff;
  color: var(--text-main);
  transition:
    border-color var(--transition),
    box-shadow var(--transition),
    background-color var(--transition);
}

body.theme-quest input,
body.theme-quest select,
body.theme-quest textarea {
  background-color: #231811;
  color: var(--text-main);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

.form-note {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* FOOTER PÚBLICO */

.footer {
  border-top: 1px solid var(--border-soft);
  padding: 1.3rem 0 1.6rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

/* =========================
   LANDING LOGIN / INDEX SIMPLES
   ========================= */

.landing-body .hero {
  padding: 4rem 0;
}

.hero-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-portal {
  text-align: center;
  max-width: 480px;
}

.hero-portal h1 {
  font-family: var(--font-serif);
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.hero-portal p {
  color: var(--text-muted);
  margin-bottom: 1.4rem;
}

/* =========================
   AUTH (LOGIN)
   ========================= */

.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-page);
}

.auth-wrapper {
  width: 100%;
  max-width: 380px;
  padding: 1.4rem;
}

.auth-card {
  background-color: var(--bg-card);
  border-radius: var(--radius-card);
  border: 1px solid var(--border-soft);
  padding: 1.8rem 1.9rem;
  box-shadow: var(--shadow-soft);
}

.auth-card h1 {
  margin-top: 0;
  font-family: var(--font-serif);
}

.auth-error {
  background-color: #ffe0e0;
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  font-size: 0.86rem;
  margin-bottom: 0.7rem;
}

.auth-note {
  margin-top: 1rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* =========================
   PORTAL / ADMIN
   ========================= */

.app-body {
  background-color: var(--bg-page);
}

.app-shell {
  display: flex;
  min-height: calc(100vh - 64px);
}

/* SIDEBAR */

.sidebar {
  width: 200px;
  border-right: 1px solid var(--border-soft);
  background-color: #f1e7d7;
}

body.theme-quest .sidebar {
  background-color: #221811;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 1rem;
  gap: 0.4rem;
}

.sidebar-link {
  display: block;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  font-size: 0.9rem;
  border: 1px solid transparent;
  text-align: left;
  background: none;
}

.sidebar-link.active {
  background-color: var(--accent);
  color: #fffdf5;
}

.sidebar-link:hover {
  border-color: var(--border-soft);
}

.sidebar-logout {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  text-align: left;
  cursor: pointer;
}

/* MAIN DO PORTAL */

.app-main {
  flex: 1;
  padding: 1.4rem 0 2rem;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.9rem;
}

.page-header h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.4rem;
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* ALERTAS */

.alert {
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  font-size: 0.86rem;
  margin-bottom: 0.7rem;
}

.alert-success {
  background-color: #e3f6e5;
}

.alert-error {
  background-color: #ffe0e0;
}

/* TABELA */

.table-card {
  background-color: var(--bg-card);
  border-radius: var(--radius-card);
  border: 1px solid var(--border-soft);
  padding: 0.9rem 1rem 1rem;
  box-shadow: var(--shadow-soft);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.table th,
.table td {
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid var(--border-soft);
}

.table th {
  text-align: left;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.table-link {
  color: var(--accent);
  font-size: 0.86rem;
}

/* BUSCA NA TABELA */

.search-input {
  min-width: 220px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  padding: 0.4rem 0.8rem;
  font-size: 0.9rem;
  background-color: #ffffff;
}

/* FORM DE TÓPICO */

.lesson-form-card {
  background-color: var(--bg-card);
  border-radius: var(--radius-card);
  border: 1px solid var(--border-soft);
  padding: 1.4rem 1.6rem;
  box-shadow: var(--shadow-soft);
}

.lesson-form-card h1 {
  margin-top: 0;
  font-family: var(--font-serif);
  font-size: 1.4rem;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
}

.hint {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* RICH TEXT EDITOR */

.rt-group {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.rt-field {
  border-radius: 12px;
  border: 1px solid var(--border-soft);
  padding: 0.7rem 0.8rem;
  background-color: #fffdf7;
}

.rt-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.rt-label-row label {
  font-weight: 600;
}

.rt-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  align-items: center;
}

.rt-toolbar button {
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background-color: #f7f1e4;
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  cursor: pointer;
}

.rt-toolbar button:hover {
  background-color: #efe1cc;
}

.rt-color-label {
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.rt-color-picker {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  padding: 0;
}

.rt-editor {
  min-height: 70px;
  border-radius: 8px;
  border: 1px solid var(--border-soft);
  padding: 0.5rem 0.6rem;
  background-color: #ffffff;
  font-size: 0.9rem;
}

.rt-hidden {
  display: none;
}

/* LINKS (PORTAL) */

.link-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.4fr);
  gap: 0.8rem;
  margin-bottom: 0.6rem;
}

/* PREVIEW AULA */

.lesson-preview {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.preview-main {
  background-color: var(--bg-card);
  border-radius: var(--radius-card);
  border: 1px solid var(--border-soft);
  padding: 1.2rem 1.4rem;
  box-shadow: var(--shadow-soft);
}

.preview-main h2 {
  margin-top: 0;
  font-family: var(--font-serif);
}

.preview-meta {
  font-size: 0.86rem;
  color: var(--text-muted);
  margin-bottom: 0.8rem;
}

.preview-section {
  margin-bottom: 0.7rem;
}

.preview-section h3 {
  margin: 0 0 0.2rem;
  font-size: 0.98rem;
}

.preview-content {
  padding: 0.4rem 0.5rem;
  border-radius: 8px;
  background-color: #faf5eb;
  font-size: 0.9rem;
}

.images-field {
  margin-top: 1.2rem;
}

/*.preview-images {*/
/*  display: flex;*/
/*  flex-wrap: wrap;*/
/*  gap: 0.5rem;*/
/*  margin-top: 0.5rem;*/
/*}*/

/*.preview-thumb {*/
/*  margin: 0;*/
/*}*/

/*.preview-thumb img {*/
/*  width: 100px;*/
/*  height: 100px;*/
/*  object-fit: cover;*/
/*  border-radius: 8px;*/
/*  border: 1px solid var(--border-soft);*/
/*  background-color: #faf5eb;*/
/*}*/


/*OUTRO*/
/*.preview-images {*/
/*  display: flex;*/
/*  flex-wrap: wrap;*/
/*  gap: 1rem;*/
/*  margin-top: 0.5rem;*/
/*  justify-content: space-between;*/
/*}*/

/*.preview-thumb {*/
/*  margin: 0;*/
/*  flex: 0 0 calc(50% - 0.5rem); */
/*  display: flex;*/
/*  justify-content: center;*/
/*}*/

/*.preview-thumb img {*/
/*  height: 200px;*/
/*  width: auto;*/
/*  border-radius: 8px;*/
/*  border: 1px solid var(--border-soft);*/
/*  background-color: #faf5eb;*/
/*}*/

.preview-images {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.preview-thumb {
  position: relative;
  flex: 0 0 calc(50% - 0.75rem); 
}

.preview-thumb img {
  display: block;
  height: 200px;
  width: auto;
  margin: 0 auto;
}

.image-remove-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background-color: #c0392b;
  color: #ffffff;
  border: none;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.7rem;
  cursor: pointer;
}

.image-remove-btn:hover {
  background-color: #e74c3c;
}

@media (max-width: 720px) {
  .preview-thumb {
    flex: 0 0 100%; /* 1 por linha em telas pequenas */
  }
}


/* Em telas pequenas: 1 por linha, sem space-between forçado */
@media (max-width: 720px) {
  .preview-thumb {
    flex: 0 0 100%;
    justify-content: flex-start;
  }

  .preview-images {
    justify-content: flex-start;
  }
}



.preview-sidebar {
  background-color: var(--bg-card);
  border-radius: var(--radius-card);
  border: 1px solid var(--border-soft);
  padding: 1rem 1.2rem;
  box-shadow: var(--shadow-soft);
}

.preview-sidebar h3 {
  margin-top: 0;
  font-size: 1rem;
}

.preview-links {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.88rem;
}

.preview-links li {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.25rem 0;
}

.link-desc {
  font-weight: 500;
}

.preview-empty {
  font-size: 0.86rem;
  color: var(--text-muted);
}

/* LAYOUT VIEW (CONTEÚDO + SIDEBAR LINKS) */

.view-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 1rem;
}

/* FOOTER DE FORM NO PORTAL */

.form-footer {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}

/* MODAL (NÍVEIS) */

.modal {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 40;
}

.modal.open {
  display: flex;
}

.modal-dialog {
  background-color: var(--bg-card);
  border-radius: 16px;
  border: 1px solid var(--border-soft);
  padding: 1rem 1.2rem 1.3rem;
  max-width: 360px;
  width: 100%;
  box-shadow: var(--shadow-soft);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.6rem;
}

.modal-header h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.2rem;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
}

.modal-body {
  font-size: 0.9rem;
}

/* =========================
   RESPONSIVO
   ========================= */

@media (max-width: 960px) {
  .hero-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-side {
    max-width: 420px;
    margin: 0 auto;
  }

  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-soft);
  }

  .view-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .journey-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .system-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .main-nav {
    display: none;
  }

  .cards-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .journey-steps {
    grid-template-columns: minmax(0, 1fr);
  }

  .system-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .grid-4 {
    grid-template-columns: minmax(0, 1fr);
  }

  .field-group {
    grid-template-columns: minmax(0, 1fr);
  }

  .link-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .topbar-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .hero {
    padding-top: 2.6rem;
  }

  .brand-tagline {
    display: none;
  }

  .hero-portal h1 {
    font-size: 1.7rem;
  }
}

/* IMAGENS DO TÓPICO – 2 POR LINHA (DESKTOP) */

.preview-images {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.preview-thumb {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0.25rem;
  background-color: #faf5eb;
  border-radius: 10px;
  height: 200px;
}

/* imagem: altura fixa, largura automática, centralizada */
.preview-thumb img {
  height: auto;
  width: auto;
  display: block;
  cursor: pointer;
}

/* botão remover pequeno e vermelho no topo */
.image-remove-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background-color: #c0392b;
  color: #ffffff;
  border: none;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.7rem;
  cursor: pointer;
}

.image-remove-btn:hover {
  background-color: #e74c3c;
}

/* em telas pequenas: 1 por linha */
@media (max-width: 720px) {
  .preview-images {
    grid-template-columns: 1fr;
  }
}



/* MODAL DE IMAGEM (LIGHTBOX) */

#imageModal {
  display: none; /* herdado de .modal, mas garantimos */
}

#imageModal.open {
  display: flex;
}

#imageModal .image-modal-dialog {
  max-width: 90vw;
  max-height: 90vh;
  background-color: rgba(0, 0, 0, 0.92);
  border: none;
  padding: 0.75rem 0.75rem 1rem;
  box-shadow: none;
  position: relative;
}

.image-modal-img {
  max-width: 100%;
  max-height: 80vh;
  display: block;
  margin: 0 auto;
  border-radius: 8px;
}

.image-modal-close {
  position: absolute;
  top: 6px;
  right: 10px;
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 1.8rem;
  cursor: pointer;
}

html {
  scroll-behavior: smooth;
}