/*
 * Postbud Forms — front-end styles.
 * Scoped under `.postbud-form` so we don't bleed into the host theme.
 * Three themes (modern / minimal / bold) provide visual baselines;
 * dashboard-configured color overrides are applied as inline styles
 * by the renderer JS.
 */

.postbud-form {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #1a202c;
  background: #ffffff;
  border-radius: 12px;
  padding: 24px;
  box-sizing: border-box;
  max-width: 480px;
}
.postbud-form * { box-sizing: border-box; }

.postbud-form-headline {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
  line-height: 1.3;
}
.postbud-form-subtitle {
  font-size: 14px;
  opacity: 0.75;
  margin-bottom: 16px;
  line-height: 1.5;
}

.postbud-form-inner {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.postbud-form-inner input[type="text"],
.postbud-form-inner input[type="email"],
.postbud-form-inner input[type="tel"] {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 8px;
  outline: none;
  background: #ffffff;
  color: #1a202c;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.postbud-form-inner input:focus {
  border-color: #3182ce;
  box-shadow: 0 0 0 3px rgba(49,130,206,0.18);
}

.postbud-form-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  line-height: 1.4;
  cursor: pointer;
  user-select: none;
}
.postbud-form-checkbox input[type="checkbox"] {
  margin-top: 3px;
}

.postbud-form-submit {
  margin-top: 4px;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 600;
  background: #3182ce;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.postbud-form-submit:hover { opacity: 0.92; }
.postbud-form-submit:disabled { opacity: 0.6; cursor: not-allowed; }

.postbud-form-honeypot {
  /* Off-screen but actionable by bots that submit every field. */
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.postbud-form-feedback {
  font-size: 13px;
  margin-top: 6px;
  min-height: 1em;
}
.postbud-form-feedback.is-error { color: #c53030; }
.postbud-form-feedback.is-success { color: #2f855a; }

/* ---- Theme: minimal ---- */
.postbud-form-theme-minimal {
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: none;
  border-radius: 6px;
}
.postbud-form-theme-minimal .postbud-form-submit {
  background: #1a202c;
  border-radius: 4px;
}

/* ---- Theme: bold ---- */
.postbud-form-theme-bold {
  background: #1a202c;
  color: #f7fafc;
  border-radius: 16px;
}
.postbud-form-theme-bold .postbud-form-inner input[type="text"],
.postbud-form-theme-bold .postbud-form-inner input[type="email"],
.postbud-form-theme-bold .postbud-form-inner input[type="tel"],
.postbud-form-theme-bold .postbud-form-select,
.postbud-form-theme-bold .postbud-form-textarea {
  background: rgba(255,255,255,0.95);
  color: #1a202c;
  border-color: transparent;
}
.postbud-form-theme-bold .postbud-form-submit {
  background: #ed8936;
  border-radius: 8px;
}

/* ---- Theme: dark ---- */
.postbud-form-theme-dark {
  background: #0f172a;
  color: #f1f5f9;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
}
.postbud-form-theme-dark .postbud-form-inner input[type="text"],
.postbud-form-theme-dark .postbud-form-inner input[type="email"],
.postbud-form-theme-dark .postbud-form-inner input[type="tel"],
.postbud-form-theme-dark .postbud-form-select,
.postbud-form-theme-dark .postbud-form-textarea {
  background: #1e293b;
  color: #f1f5f9;
  border-color: rgba(255,255,255,0.08);
}
.postbud-form-theme-dark .postbud-form-inner input::placeholder,
.postbud-form-theme-dark .postbud-form-textarea::placeholder {
  color: rgba(241,245,249,0.5);
}
.postbud-form-theme-dark .postbud-form-submit {
  background: #3b82f6;
  border-radius: 8px;
}

/* ---- Select + Textarea (shared across themes) ---- */
.postbud-form-select,
.postbud-form-textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 8px;
  outline: none;
  background: #ffffff;
  color: #1a202c;
}
.postbud-form-textarea { resize: vertical; min-height: 80px; }
.postbud-form-select { cursor: pointer; }
.postbud-form-select:focus,
.postbud-form-textarea:focus {
  border-color: #3182ce;
  box-shadow: 0 0 0 3px rgba(49,130,206,0.18);
}

/* ---- Lead magnet success button ---- */
.postbud-form-lead-magnet {
  display: inline-block;
  margin-top: 12px;
  padding: 10px 16px;
  background: #3182ce;
  color: #ffffff;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  border-radius: 8px;
  transition: opacity 0.15s;
}
.postbud-form-lead-magnet:hover { opacity: 0.92; }

/* ---- Popup overlay ---- */
.postbud-form-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2147483600;
  padding: 16px;
  animation: postbud-fade-in 0.18s ease-out;
}
.postbud-form-modal {
  position: relative;
  max-width: 480px;
  width: 100%;
  animation: postbud-pop-in 0.22s ease-out;
}
@keyframes postbud-fade-in {
  from { opacity: 0; } to { opacity: 1; }
}
@keyframes postbud-pop-in {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.postbud-form-close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: transparent;
  border: none;
  color: inherit;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  opacity: 0.55;
  transition: opacity 0.15s;
  z-index: 1;
}
.postbud-form-close:hover { opacity: 1; }
.postbud-form-modal .postbud-form-close { color: #1a202c; }

/* ---- Sticky bar ---- */
.postbud-form-bar {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 2147483600;
  background: #1a202c;
  color: #f7fafc;
  padding: 12px 56px 12px 16px;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.15);
  animation: postbud-slide-up 0.22s ease-out;
}
.postbud-form-bar-top {
  top: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  animation: postbud-slide-down 0.22s ease-out;
}
.postbud-form-bar-bottom { bottom: 0; }

.postbud-form-bar .postbud-form {
  background: transparent;
  color: inherit;
  padding: 0;
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  border-radius: 0;
}
.postbud-form-bar .postbud-form-headline {
  margin-bottom: 0;
  font-size: 16px;
  flex: 1;
  min-width: 0;
}
.postbud-form-bar .postbud-form-subtitle {
  display: none; /* keep the bar compact */
}
.postbud-form-bar .postbud-form-inner {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  flex: 2;
  min-width: 0;
}
.postbud-form-bar .postbud-form-inner input {
  flex: 1;
  min-width: 0;
}
.postbud-form-bar .postbud-form-checkbox {
  /* GDPR checkbox in a bar gets awkward; if present we let it wrap below */
  flex-basis: 100%;
  font-size: 12px;
}
.postbud-form-bar .postbud-form-close {
  color: inherit;
}

@keyframes postbud-slide-up {
  from { transform: translateY(100%); } to { transform: translateY(0); }
}
@keyframes postbud-slide-down {
  from { transform: translateY(-100%); } to { transform: translateY(0); }
}

/* ---- Slide-in (corner box) ---- */
.postbud-form-slidein {
  position: fixed;
  width: 360px;
  max-width: calc(100vw - 32px);
  z-index: 2147483600;
}
.postbud-form-slidein-bottom-right {
  bottom: 16px; right: 16px;
  animation: postbud-slide-from-right 0.26s ease-out;
}
.postbud-form-slidein-bottom-left {
  bottom: 16px; left: 16px;
  animation: postbud-slide-from-left 0.26s ease-out;
}
.postbud-form-slidein-top-right {
  top: 16px; right: 16px;
  animation: postbud-slide-from-right 0.26s ease-out;
}
.postbud-form-slidein-top-left {
  top: 16px; left: 16px;
  animation: postbud-slide-from-left 0.26s ease-out;
}
.postbud-form-slidein .postbud-form {
  box-shadow: 0 12px 32px rgba(0,0,0,0.18);
}
@keyframes postbud-slide-from-right {
  from { transform: translateX(110%); } to { transform: translateX(0); }
}
@keyframes postbud-slide-from-left {
  from { transform: translateX(-110%); } to { transform: translateX(0); }
}

/* ---- Welcome mat (full-screen) ---- */
.postbud-form-welcomemat {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2147483640;
  padding: 24px;
  overflow-y: auto;
  animation: postbud-fade-in 0.22s ease-out;
}
.postbud-form-welcomemat-inner {
  position: relative;
  width: 100%;
  max-width: 560px;
  animation: postbud-pop-in 0.28s ease-out;
}
.postbud-form-welcomemat .postbud-form {
  border-radius: 16px;
  padding: 36px 32px;
}
.postbud-form-welcomemat .postbud-form-headline {
  font-size: 28px;
}
.postbud-form-welcomemat .postbud-form-subtitle {
  font-size: 16px;
}

/* ---- Inline placeholder ---- */
.postbud-form-inline {
  margin: 24px auto;
  max-width: 480px;
}

/* ---- Mobile tweaks ---- */
@media (max-width: 600px) {
  .postbud-form { padding: 18px; border-radius: 10px; }
  .postbud-form-bar { padding: 10px 44px 10px 12px; }
  .postbud-form-bar .postbud-form { flex-wrap: wrap; }
  .postbud-form-bar .postbud-form-inner { flex-basis: 100%; flex-direction: column; align-items: stretch; }
}
