/* EcoFlare Letter Pad — A4 solid business pad (Canva: header 2cm, footer 1.5cm) */

:root {
  --ef-deep: #064e3b;
  --ef-green: #59a83f;
  --ef-orange: #f47c20;
  --ef-gold: #d7a66a;
  --ef-paper: #ffffff;
  --ef-ink: #0f172a;
  --ef-muted: #475569;
  --pad-w: 210mm;
  --pad-h: 297mm;
  --pad-header-h: 2cm;
  --pad-footer-h: 1.5cm;
  --pad-side: 1cm;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: "IBM Plex Sans", sans-serif;
  color: var(--ef-ink);
  background: #e5ebe6;
}

/* —— Chrome —— */
.pad-chrome {
  max-width: 920px;
  margin: 0 auto;
  padding: 20px 20px 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pad-chrome-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pad-chrome-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.pad-chrome-brand strong {
  display: block;
  font-size: 1.05rem;
  color: var(--ef-deep);
}

.pad-chrome-brand span {
  display: block;
  font-size: 0.78rem;
  color: var(--ef-muted);
}

.pad-btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 8px;
  transition: background 0.15s ease, transform 0.1s ease;
}

.pad-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

.pad-btn-primary {
  background: var(--ef-deep);
  color: #fff;
}

.pad-btn-primary:hover:not(:disabled) {
  background: #053f30;
}

.pad-btn-primary:active:not(:disabled) {
  transform: translateY(1px);
}

/* —— Stage —— */
.pad-stage {
  padding: 12px 16px 48px;
  display: flex;
  justify-content: center;
}

.pad-sheet,
.pad-pdf-page {
  position: relative;
  width: var(--pad-w);
  height: var(--pad-h);
  background: #ffffff;
  overflow: hidden;
  font-family: "IBM Plex Sans", sans-serif;
}

.pad-sheet {
  box-shadow:
    0 1px 2px rgba(6, 78, 59, 0.06),
    0 18px 48px rgba(6, 78, 59, 0.14);
}

/* —— Header: 2cm, pinned top, clean white —— */
.pad-letterhead {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: var(--pad-header-h);
  max-height: var(--pad-header-h);
  padding: 0 var(--pad-side);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: #ffffff;
  overflow: hidden;
  z-index: 2;
}

.pad-letterhead-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6cm;
  flex: 1;
  min-height: 0;
  padding: 0.15cm 0 0.12cm;
}

.pad-brand-left {
  display: flex;
  align-items: center;
  gap: 0.35cm;
  min-width: 0;
}

.pad-logo {
  width: 1.45cm;
  height: 1.45cm;
  object-fit: contain;
  flex-shrink: 0;
}

.pad-brand-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0;
}

.pad-company {
  margin: 0;
  font-family: "IBM Plex Sans", sans-serif;
  font-weight: 700;
  font-size: 11.5pt;
  letter-spacing: 0.02em;
  color: var(--ef-deep);
  line-height: 1.05;
  white-space: nowrap;
}

.pad-tagline {
  margin: -0.08cm 0 0;
  font-family: Allura, cursive;
  font-size: 13pt;
  font-weight: 400;
  color: var(--ef-deep);
  line-height: 1;
  text-align: center;
}

.pad-slogan-block {
  display: flex;
  align-items: stretch;
  gap: 0.22cm;
  flex-shrink: 0;
}

.pad-slogan-bar {
  width: 3px;
  border-radius: 1px;
  background: linear-gradient(
    180deg,
    var(--ef-deep) 0%,
    var(--ef-green) 50%,
    var(--ef-orange) 100%
  );
  flex-shrink: 0;
}

.pad-slogan {
  margin: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  font-family: "IBM Plex Sans", sans-serif;
  font-weight: 700;
  font-size: 7pt;
  line-height: 1.2;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.pad-slogan-l1 { color: var(--ef-deep); }
.pad-slogan-l2 { color: var(--ef-green); }
.pad-slogan-l3 { color: var(--ef-orange); }

.pad-rule {
  height: 1.5px;
  flex-shrink: 0;
  margin: 0 calc(-1 * var(--pad-side));
  background: linear-gradient(
    90deg,
    var(--ef-deep) 0%,
    var(--ef-green) 45%,
    var(--ef-orange) 78%,
    var(--ef-gold) 100%
  );
}

/* —— Body: between header and footer —— */
.pad-body,
.pad-pdf-body {
  position: absolute;
  top: var(--pad-header-h);
  bottom: var(--pad-footer-h);
  left: 0;
  right: 0;
  padding: 0.45cm var(--pad-side) 0.35cm;
  background: #ffffff;
  overflow: hidden;
  z-index: 1;
}

.pad-body {
  display: flex;
  flex-direction: column;
}

.pad-body .tox-tinymce {
  border: 1px dashed rgba(6, 78, 59, 0.22) !important;
  border-radius: 4px !important;
  flex: 1;
  min-height: 0;
  display: flex !important;
  flex-direction: column;
}

.pad-body .tox-editor-header {
  box-shadow: none !important;
  border-bottom: 1px solid rgba(6, 78, 59, 0.12) !important;
}

.pad-body .tox-toolbar-overlord,
.pad-body .tox-toolbar__primary {
  background: #f1f5f2 !important;
}

.pad-body .tox-edit-area__iframe {
  background: #ffffff !important;
}

.pad-body .tox-statusbar {
  border-top: 1px solid rgba(6, 78, 59, 0.1) !important;
}

.pad-pdf-body {
  font-size: 11pt;
  line-height: 1.55;
  color: #0f172a;
}

.pad-pdf-body p { margin: 0 0 0.55em; }
.pad-pdf-body table {
  border-collapse: collapse;
  width: 100%;
  margin: 0 0 0.7em;
  font-size: 10pt;
}
.pad-pdf-body td,
.pad-pdf-body th {
  border: 1px solid #64748b;
  padding: 6px 8px;
  vertical-align: top;
}

/* —— Footer: 1.5cm, flush to page bottom (no gap below) —— */
.pad-footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--pad-footer-h);
  max-height: var(--pad-footer-h);
  background: var(--ef-deep);
  color: #fff;
  padding: 0 0.75cm;
  display: grid;
  grid-template-columns: 1fr auto 1.2fr auto 1.65fr;
  align-items: center;
  gap: 0.35cm;
  border-radius: 14px 14px 0 0;
  overflow: hidden;
  z-index: 2;
}

.pad-footer-col {
  display: flex;
  align-items: center;
  gap: 0.28cm;
  min-width: 0;
}

.pad-footer-col-mid {
  flex-direction: column;
  align-items: stretch;
  gap: 0.12cm;
}

.pad-footer-row {
  display: flex;
  align-items: center;
  gap: 0.22cm;
  font-size: 6pt;
  font-weight: 500;
  line-height: 1.2;
  word-break: break-word;
}

.pad-footer-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: 4px;
}

.pad-footer-icon svg {
  width: 11px;
  height: 11px;
}

.pad-footer-text {
  display: flex;
  flex-direction: column;
  gap: 0.06cm;
  font-size: 6pt;
  font-weight: 500;
  line-height: 1.25;
}

.pad-footer-divider {
  width: 1.5px;
  height: 0.95cm;
  align-self: center;
  border-radius: 1px;
  background: linear-gradient(
    180deg,
    var(--ef-gold) 0%,
    var(--ef-orange) 45%,
    var(--ef-green) 100%
  );
}

/* —— PDF off-screen render —— */
.pad-pdf-root {
  position: fixed;
  left: 0;
  top: 0;
  width: 210mm;
  height: 297mm;
  opacity: 0;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}

@media (max-width: 860px) {
  .pad-stage {
    overflow-x: auto;
    justify-content: flex-start;
    padding-bottom: 32px;
  }

  .pad-sheet {
    transform-origin: top left;
    transform: scale(0.72);
    margin-bottom: calc(var(--pad-h) * -0.28);
  }
}
