/* ===================================================
   SINDICATO RURAL DE BACABAL — style.css
   =================================================== */

/* ─── TOKENS ─────────────────────────────── */
:root {
  --verde:      #0d5c2a;
  --verde-mid:  #166534;
  --verde-lite: #22a84b;
  --verde-bg:   #f4fbf6;
  --ouro:       #c9a227;
  --ouro-lite:  #f0c940;
  --cinza-100:  #f8faf9;
  --cinza-200:  #e2e8e4;
  --cinza-400:  #9ca3af;
  --cinza-500:  #64748b;
  --cinza-800:  #1e293b;
  --white:      #ffffff;
  --shadow-sm:  0 2px 8px rgba(13, 92, 42, 0.05);
  --shadow:     0 6px 20px rgba(13, 92, 42, 0.08);
  --shadow-md:  0 12px 36px rgba(13, 92, 42, 0.12);
  --radius:     12px;
  --radius-lg:  20px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── RESET ──────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  background: linear-gradient(135deg, var(--verde-bg) 0%, #e2f2e7 100%);
  color: var(--cinza-800);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ─── HEADER ─────────────────────────────── */
.site-header {
  background: var(--verde);
  background-image: radial-gradient(circle at 100% 0%, rgba(255,255,255,0.08) 0%, transparent 40%);
  border-bottom: 4px solid var(--ouro);
  padding: 1.2rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
.header-inner {
  max-width: 1060px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.logo-wrap { display: flex; align-items: center; gap: 0.8rem; }
.site-logo  { height: 48px; width: auto; border-radius: 6px; border: 2px solid var(--ouro); box-shadow: 0 0 10px rgba(201, 162, 39, 0.3); }
.logo-text  { display: flex; flex-direction: column; line-height: 1.1; }
.logo-title { font-family: 'Playfair Display', serif; font-size: 1.25rem; font-weight: 800; color: #fff; letter-spacing: 0.5px; }
.logo-sub   { font-size: 0.75rem; color: var(--ouro-lite); letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600;}
.header-tagline { font-size: 0.85rem; color: rgba(255,255,255,0.8); font-weight: 500; background: rgba(0,0,0,0.2); padding: 6px 14px; border-radius: 99px; }

/* ─── STEPS ──────────────────────────────── */
.steps-nav {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--cinza-200);
  padding: 1.2rem 1.5rem;
  box-shadow: var(--shadow-sm);
}
.steps-inner {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.step {
  display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
  opacity: 0.4; transition: var(--transition);
}
.step.active, .step.done { opacity: 1; }
.step-bubble {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--cinza-200); color: var(--cinza-500);
  font-weight: 700; font-size: 1rem;
  display: grid; place-items: center;
  transition: var(--transition);
}
.step.active .step-bubble { background: var(--verde-mid); color: #fff; box-shadow: 0 0 0 4px rgba(22,101,52,0.15); transform: scale(1.05); }
.step.done   .step-bubble { background: var(--ouro); color: var(--verde); }
.step span   { font-size: 0.75rem; font-weight: 600; white-space: nowrap; color: var(--cinza-500); }
.step.active span { color: var(--verde-mid); }
.step-line   { flex: 1; height: 3px; background: var(--cinza-200); min-width: 30px; max-width: 80px; margin-top: -20px; transition: var(--transition); border-radius: 3px;}
.step-line.done { background: var(--ouro); }

/* ─── MAIN ───────────────────────────────── */
.main-content {
  flex: 1;
  padding: 2.5rem 1.25rem 4rem;
  max-width: 1060px;
  margin: 0 auto;
  width: 100%;
}

/* ─── PANELS ─────────────────────────────── */
.step-panel       { display: none; }
.step-panel.active { display: block; animation: fadeUp 0.4s ease-out; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.panel-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255,255,255,0.5);
}
.panel-title { font-family: 'Playfair Display', serif; font-size: 1.8rem; font-weight: 800; color: var(--verde); margin-bottom: 0.5rem; }
.panel-desc  { color: var(--cinza-500); font-size: 0.95rem; margin-bottom: 2rem; }

/* ─── SEARCH ─────────────────────────────── */
.search-wrap { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.75rem; position: relative; }
.search-wrap .field-input { flex: 1; min-width: 220px; padding: 0.8rem 1.2rem; font-size: 1rem; }

.autocomplete-list {
  display: none; list-style: none;
  background: var(--white); border: 1px solid var(--cinza-200);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  max-height: 260px; overflow-y: auto; margin-bottom: 1.5rem;
  position: absolute; top: 100%; left: 0; right: 0; z-index: 10;
}
.autocomplete-list.visible { display: block; }
.autocomplete-list li {
  padding: 0.8rem 1.2rem; cursor: pointer;
  border-bottom: 1px solid var(--cinza-100); font-size: 0.9rem; transition: background 0.15s;
}
.autocomplete-list li:last-child { border-bottom: none; }
.autocomplete-list li:hover { background: var(--verde-bg); }
.ac-name { font-weight: 700; color: var(--verde-mid); }
.ac-info { color: var(--cinza-400); font-size: 0.8rem; }

/* ─── RESULT CARDS ───────────────────────── */
.result-card {
  background: var(--verde-bg); border: 1px solid #cce8d6;
  border-left: 5px solid var(--verde-lite); border-radius: var(--radius);
  padding: 1.25rem 1.5rem; display: flex; align-items: center;
  justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  margin-top: 1rem; box-shadow: var(--shadow-sm);
}
.result-info h4 { font-weight: 700; font-size: 1.1rem; color: var(--verde); }
.result-info p  { font-size: 0.85rem; color: var(--cinza-500); margin-top: 0.25rem; font-weight: 500;}
.result-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }

.not-found-card {
  background: #fffbeb; border: 1px solid #fde68a;
  border-left: 5px solid var(--ouro); border-radius: var(--radius);
  padding: 1.25rem 1.5rem; display: flex; align-items: center;
  justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  margin-top: 1rem; box-shadow: var(--shadow-sm);
}
.not-found-card p { font-size: 0.95rem; color: #92400e; }

/* ─── REGISTER FORM ──────────────────────── */
.register-form { margin-top: 2rem; animation: fadeUp 0.3s ease-out; }
.form-subtitle {
  font-family: 'Playfair Display', serif; font-size: 1.3rem; color: var(--verde);
  padding-top: 1.5rem; margin-bottom: 1.25rem;
  border-top: 1px solid var(--cinza-200); font-weight: 700;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--cinza-500); }

.field-input {
  padding: 0.75rem 1rem; border: 2px solid var(--cinza-200);
  border-radius: var(--radius); font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem; color: var(--cinza-800); background: var(--cinza-100);
  transition: var(--transition); outline: none; width: 100%;
}
.field-input:hover { border-color: #cbd5e1; }
.field-input:focus { border-color: var(--verde-lite); background: var(--white); box-shadow: 0 0 0 4px rgba(34,168,75,0.15); }

/* ─── PHOTO UPLOAD ───────────────────────── */
.photo-upload-area {
  border: 2px dashed #cbd5e1; border-radius: var(--radius);
  min-height: 140px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: var(--transition);
  overflow: hidden; position: relative; background: var(--cinza-100);
}
.photo-upload-area:hover,
.photo-upload-area.dragover { border-color: var(--verde-lite); background: var(--verde-bg); }
.photo-upload-area.small { min-height: 100px; }
.upload-placeholder { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; color: var(--cinza-500); font-size: 0.9rem; font-weight: 500; pointer-events: none; }
.upload-icon { font-size: 2rem; margin-bottom: 0.2rem;}
.photo-preview { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }

/* ─── BUTTONS ────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.75rem 1.5rem; border-radius: var(--radius); border: none;
  cursor: pointer; font-family: 'DM Sans', sans-serif; font-size: 0.95rem;
  font-weight: 700; transition: var(--transition);
  white-space: nowrap; text-decoration: none;
}
.btn:active { transform: scale(0.96); }

.btn-primary { background: var(--verde-mid); color: #fff; box-shadow: 0 4px 12px rgba(22, 101, 52, 0.2); }
.btn-primary:hover { background: var(--verde); box-shadow: 0 6px 16px rgba(13, 92, 42, 0.3); transform: translateY(-2px); }

.btn-ghost { background: transparent; color: var(--cinza-500); border: 2px solid var(--cinza-200); }
.btn-ghost:hover { border-color: var(--cinza-400); color: var(--cinza-800); background: var(--cinza-100); }

.btn-ouro { background: var(--ouro); color: var(--verde); box-shadow: 0 4px 12px rgba(201, 162, 39, 0.2); }
.btn-ouro:hover { background: var(--ouro-lite); box-shadow: 0 6px 16px rgba(201, 162, 39, 0.3); transform: translateY(-2px); }

.btn-sm { font-size: 0.85rem; padding: 0.5rem 1rem; }

.form-actions { display: flex; justify-content: flex-end; gap: 0.75rem; margin-top: 2rem; flex-wrap: wrap; border-top: 1px solid var(--cinza-200); padding-top: 1.5rem;}

/* ─── STEP 2 – EDITOR LAYOUT ─────────────── */
.edit-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 2.5rem;
  align-items: start;
}
.edit-fields { display: flex; flex-direction: column; gap: 1.25rem; }

.format-selector { display: flex; flex-direction: column; gap: 0.5rem; }
.format-btns { display: flex; gap: 0.75rem; background: var(--cinza-100); padding: 0.4rem; border-radius: calc(var(--radius) + 4px); border: 1px solid var(--cinza-200);}
.btn-format {
  flex: 1; padding: 0.75rem 0.5rem; border-radius: var(--radius);
  border: 2px solid transparent; background: transparent;
  cursor: pointer; font-family: 'DM Sans', sans-serif; font-size: 0.85rem;
  font-weight: 700; text-align: center; color: var(--cinza-500);
  transition: var(--transition); line-height: 1.4;
}
.btn-format:hover { color: var(--cinza-800); }
.btn-format.active { border-color: var(--verde-mid); background: var(--white); color: var(--verde); box-shadow: var(--shadow-sm); }

.photo-controls { display: flex; flex-direction: column; gap: 0.75rem; background: var(--cinza-100); padding: 1.25rem; border-radius: var(--radius); border: 1px solid var(--cinza-200); }
.slider-row {
  display: grid; grid-template-columns: 80px 1fr 44px;
  align-items: center; gap: 0.5rem; font-size: 0.85rem; color: var(--cinza-800); font-weight: 500;
}
.slider-row input[type=range] { accent-color: var(--verde-mid); cursor: pointer; height: 6px; }

/* ─── CANVAS ─────────────────────────────── */
.edit-preview { display: flex; flex-direction: column; align-items: center; gap: 0.8rem; position: sticky; top: 100px;}
.canvas-wrap {
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-md); cursor: grab;
  width: 100%; max-width: 400px; 
  /* Fundo xadrez para ver transparência */
  background: repeating-linear-gradient(45deg, #e5e5e5 25%, transparent 25%, transparent 75%, #e5e5e5 75%, #e5e5e5),
              repeating-linear-gradient(45deg, #e5e5e5 25%, #f0f0f0 25%, #f0f0f0 75%, #e5e5e5 75%, #e5e5e5);
  background-position: 0 0, 10px 10px;
  background-size: 20px 20px;
  border: 1px solid var(--cinza-200);
}
.canvas-wrap:active { cursor: grabbing; }
#previewCanvas { display: block; width: 100%; height: auto; }
.preview-hint  { font-size: 0.8rem; color: var(--cinza-500); font-weight: 500; background: var(--cinza-100); padding: 4px 12px; border-radius: 99px;}

/* ─── STEP 3 – EXPORT ────────────────────── */
.export-previews {
  display: flex; gap: 2.5rem; justify-content: center;
  flex-wrap: wrap; margin-bottom: 2.5rem;
}
.export-thumb-wrap { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; }
.export-thumb-wrap p { font-size: 0.85rem; font-weight: 700; color: var(--cinza-500); background: var(--cinza-100); padding: 4px 12px; border-radius: 99px;}
.thumb-canvas { border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--cinza-200); max-width: 180px; display: block; }

.export-actions { display: flex; gap: 1.5rem; justify-content: center; flex-wrap: wrap; }
.btn-export {
  display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
  padding: 1.5rem 2.5rem; border-radius: var(--radius-lg); border: none;
  cursor: pointer; font-family: 'DM Sans', sans-serif; font-weight: 800;
  font-size: 1.05rem; transition: var(--transition);
  min-width: 200px;
}
.btn-export small { font-weight: 500; font-size: 0.8rem; opacity: 0.85; }
.btn-export .btn-icon { font-size: 2rem; margin-bottom: 0.2rem;}
.btn-export:active { transform: scale(0.96); }
.btn-export.story { background: var(--verde-mid); color: #fff; box-shadow: 0 8px 24px rgba(22, 101, 52, 0.25);}
.btn-export.story:hover { background: var(--verde); box-shadow: 0 12px 32px rgba(13, 92, 42, 0.35); transform: translateY(-4px); }
.btn-export.feed  { background: var(--ouro); color: var(--verde); box-shadow: 0 8px 24px rgba(201, 162, 39, 0.25);}
.btn-export.feed:hover  { background: var(--ouro-lite); box-shadow: 0 12px 32px rgba(201, 162, 39, 0.35); transform: translateY(-4px); }

/* ─── TOAST ──────────────────────────────── */
.toast-success {
  display: none; margin: 2rem auto 0;
  background: #ecfdf5; border: 2px solid #10b981; color: #065f46;
  border-radius: var(--radius); padding: 1rem 1.5rem;
  text-align: center; font-weight: 700; font-size: 0.95rem;
  max-width: 400px; animation: fadeUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* ─── LOADER ─────────────────────────────── */
.loader-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); z-index: 999; place-items: center;
}
.loader-overlay.active { display: grid; }
.loader-box {
  background: var(--white); border-radius: var(--radius-lg);
  padding: 2.5rem 3.5rem; display: flex; flex-direction: column;
  align-items: center; gap: 1.25rem; box-shadow: var(--shadow-md);
}
.loader-box p { font-weight: 700; color: var(--verde-mid); font-size: 1.05rem; }
.loader-spinner {
  width: 50px; height: 50px; border: 4px solid var(--cinza-200);
  border-top-color: var(--verde-mid); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── FOOTER ─────────────────────────────── */
.site-footer {
  background: var(--verde);
  border-top: 3px solid var(--ouro);
  color: rgba(255,255,255,0.6);
  text-align: center; padding: 1.25rem; font-size: 0.85rem; font-weight: 500;
}

/* ─── RESPONSIVE ─────────────────────────── */
@media (max-width: 860px) {
  .edit-layout { grid-template-columns: 1fr; }
  .edit-preview { order: -1; position: relative; top: 0;}
}
@media (max-width: 560px) {
  .panel-card { padding: 1.5rem 1.25rem; }
  .form-grid  { grid-template-columns: 1fr; }
  .form-group.full { grid-column: 1; }
  .panel-title { font-size: 1.5rem; }
  .export-actions { flex-direction: column; align-items: center; }
  .btn-export { width: 100%; max-width: 320px; }
  .header-tagline { display: none; }
  .step span { font-size: 0.65rem; }
  .step-line { min-width: 20px; }
  .slider-row { grid-template-columns: 70px 1fr 40px; }
}