/* TTB Award Certificate Maker – Styles (cleaned) */
.ttb-acm-wrap {
  max-width: 1100px;
  margin: 0 auto;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  color: #111;
}
.ttb-acm-h2 { margin: 10px 0 16px; font-size: 22px; }
.ttb-acm-controls { background: #0f172a0d; padding: 16px; border-radius: 10px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }

/* === Controls grid: 2 columns === */
.ttb-acm-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.ttb-acm-field { display: flex; flex-direction: column; gap: 6px; }
.ttb-acm-field-wide { grid-column: 1 / -1; }
.ttb-acm-field input[type="text"],
.ttb-acm-field textarea,
.ttb-acm-field select {
  padding: 9px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

/* Reserve the cell to the right of Preset for “Custom Award” */
#ttb-acm-custom-award-wrap {
  grid-column: 2 / 3;
  visibility: hidden;   /* keep its slot */
  height: 0;
  padding: 0;
  margin: 0;
}
#ttb-acm-custom-award-wrap.is-visible {
  visibility: visible;
  height: auto;
  padding: initial;
  margin: initial;
}

/* Actions */
.ttb-acm-actions { margin-top: 14px; display: flex; gap: 10px; flex-wrap: wrap; }
.ttb-acm-btn { border: 1px solid #ddd; background: #fff; padding: 10px 14px; border-radius: 10px; cursor: pointer; }
.ttb-acm-btn-primary { background: #111; color: #fff; }
/* Force dark label on Print button */
#ttb-acm-print { color: #111; }

/* Preview shell */
.ttb-acm-preview-wrap { margin: 16px 0 34px; }
.ttb-acm-canvas {
  width: 100%;
  border: 1px dashed #e5e7eb;
  border-radius: 12px;
  background: #fff;
  min-height: 300px;
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}

/* === Preview page & premium typography === */
.ttb-acm-page { width: 842px; height: 595px; background:#fff; position:relative; overflow:hidden; box-shadow:0 1px 4px rgba(0,0,0,.10); border: 20px double var(--ttb-primary, #1a48a6); }
.ttb-acm-page.portrait { width: 595px; height: 842px; }
.ttb-acm-page.letter.portrait { width: 612px; height: 792px; }
.ttb-acm-page.letter.landscape { width: 792px; height: 612px; }

.ttb-acm-inner {
  position:absolute; inset:0;
  padding: 32px 40px 52px;          /* less top, more bottom to lift stack visually */
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  text-align:center; z-index:1;
}

/* Background */
.ttb-acm-bg { position:absolute; inset:0; z-index:0; }
.ttb-acm-bg img { width:100%; height:100%; object-fit:cover; opacity:.18; display:none; }
.ttb-acm-bg img.show { display:block; }

/* Bigger logo & polished hierarchy */
.ttb-acm-logo { max-height: 150px; margin-bottom: 18px; z-index:1; }
.ttb-acm-org   { font-size: 24px; font-variant: small-caps; letter-spacing:.6px; color:#1f2937; margin-bottom: 16px; z-index:1; }
.ttb-acm-title { font-size: 48px; font-weight: 800; letter-spacing:.3px; margin: 0 0 18px; z-index:1; }
.ttb-acm-divider { width: 90%; height: 4px; background: #111; margin: 16px auto 20px; border-radius: 2px; opacity:.9; z-index:1; }
.ttb-acm-name  { font-size: 42px; line-height: 42px; font-weight: 900; text-transform: uppercase; letter-spacing:.6px; border-bottom: 6px solid #111; padding: 8px 16px 4px; margin: 6px 0 8px; z-index:1; }
.ttb-acm-extra { margin-top: 18px; max-width: 780px; line-height: 1.6; font-size: 18px; color:#1f2937; z-index:1; }
.ttb-acm-date  { margin-top: 36px; font-size: 32px; color:#334155; z-index:1; font-weight: 700; }

/* Ribbon (Modern) */
.ttb-acm-ribbon { position:absolute; top: 26px; left:0; right:0; height: 70px; opacity:.10; z-index:0; }

/* Ornate flourishes */
.ttb-acm-ornate svg { position: absolute; width: 70px; height: 70px; opacity: .35; }
.ttb-acm-ornate .tl { top: 10px; left: 10px; }
.ttb-acm-ornate .tr { top: 10px; right: 10px; transform: scaleX(-1); }
.ttb-acm-ornate .bl { bottom: 10px; left: 10px; transform: scaleY(-1); }
.ttb-acm-ornate .br { bottom: 10px; right: 10px; transform: scale(-1,-1); }

/* === Color picker widget === */
/* (fixes stray selector typing) */
.ttb-acm-color { display: flex; align-items: center; gap: 8px; }
.ttb-acm-swatch { width: 36px; height: 28px; border-radius: 6px; border: 1px solid #e5e7eb; cursor: pointer; }

.ttb-acm-picker-modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.35);
  display: none; align-items: center; justify-content: center; z-index: 9999;
}
.ttb-acm-picker-card {
  background: #fff; padding: 14px; border-radius: 12px; box-shadow: 0 6px 18px rgba(0,0,0,.15);
  width: 320px;
}
.ttb-acm-picker-canvas { width: 100%; height: 160px; border-radius: 8px; border: 1px solid #eee; display: block; }
.ttb-acm-hue { width: 100%; margin: 10px 0; }
.ttb-acm-picker-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
/* Ensure dark font on non-primary (Cancel) */
.ttb-acm-picker-actions .ttb-acm-btn { color: #111; }
.ttb-acm-picker-actions .ttb-acm-btn-primary { color: #fff; }

.ttb-acm-tooltip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: #f1f5f9; border: 1px solid #e2e8f0; cursor: help;
}
.ttb-acm-bg-field .ttb-acm-bg-tip { display: flex; align-items: center; gap: 8px; }

/* Responsive */
@media (max-width: 900px) {
  .ttb-acm-grid { grid-template-columns: 1fr; }
  #ttb-acm-custom-award-wrap { grid-column: 1 / -1; }
}

/* Placeholder styling */
.ttb-acm-field input::placeholder,
.ttb-acm-field textarea::placeholder {
  color: #9ca3af; /* Tailwind’s neutral grey */
  opacity: 1;     /* Ensure visible in Firefox */
}

.tcm-acm-color-row { flex-direction: row; justify-content: space-evenly; }

.ttb-acm-title{
  text-transform: uppercase;
  font-size: 48px;
  line-height: 48px;
}

.ttb-acm-inner{
  transform-origin: 50% 0%; /* allow JS to scale/translate cleanly */
}

/* SAFE layout for live preview */
.ttb-acm-inner{
  position: absolute;          /* revert: must be absolute */
  inset: 0;
  padding: 12mm 10mm;          /* your safe area */
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.ttb-acm-stack{
  display: flex;
  flex-direction: column;
  align-items: center;
  transform-origin: 50% 0%;    /* scale from top edge inside padding */
}

/* Override for live preview landscape mode logo */
.ttb-acm-page.landscape .ttb-acm-logo {
  max-height: 100px;
}
.ttb-acm-page.landscape .ttb-acm-title, .ttb-acm-page.landscape .ttb-acm-divider{
  margin: 0;
}

/* Adjust padding for vertical centering */
.ttb-acm-page.landscape .ttb-acm-inner {
  padding: 8mm 10mm 14mm;
}

/* Fix tooltip display */
.ttb-acm-tooltip::before {
  content: attr(aria-label);
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 6px 8px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  font-size: 14px;
  z-index: 10;
}
.ttb-acm-tooltip:hover::before {
  opacity: 1;
  visibility: visible;
}
.ttb-acm-tooltip {
  position: relative;
}

.ttb-acm-title,
.ttb-acm-name{
  font-family: "Helvetica", Arial, sans-serif !important;
}

/* === Live preview fix (landscape, logo not clipped, no bottom overflow) === */
.ttb-acm-page{ display:flex; align-items:stretch; }                /* make page a flex box */
.ttb-acm-inner{
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;          /* vertical centering inside preview */
  justify-content: center;
  padding: 12mm 10mm;           /* same safe area you like */
  box-sizing: border-box;
}
.ttb-acm-stack{ transform-origin: 50% 0%; will-change: transform; }/* we scale/translate this only */

/* Orientation-specific logo caps so it never hits the border */
.ttb-acm-page.portrait  .ttb-acm-logo{ max-height: 48mm; }
.ttb-acm-page.landscape .ttb-acm-logo{ max-height: 40mm; }

/* Keep your thick classic border visible in preview */
.ttb-acm-page{ border: 20px double var(--ttb-primary, #1a48a6); }

/* File upload styling */
#ttb-acm-logo,
#ttb-acm-bg {
  display: block;
  width: 100%;
  padding: 12px;
  border: 2px dashed #cbd5e1;   /* light grey-blue */
  border-radius: 8px;
  background: #f8fafc;          /* subtle light background */
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

#ttb-acm-logo:hover,
#ttb-acm-bg:hover {
  border-color: #94a3b8;        /* slightly darker on hover */
  background: #f1f5f9;
}

#ttb-acm-logo:focus,
#ttb-acm-bg:focus {
  outline: none;
  border-color: #1a48a6;        /* your primary accent */
  background: #eef2ff;
}

.tcm-acm-color-picker { display: flex; flex-direction: column; justify-content: center; }