/*
 * ╔══════════════════════════════════════════════════════════════╗
 * ║  HAWK CUSTOMISER — Adjustable design tokens                  ║
 * ║  Change values here to restyle the form without touching     ║
 * ║  component selectors below.                                  ║
 * ╚══════════════════════════════════════════════════════════════╝
 */
#hawk-app {
  /* ── Layout ──────────────────────────────── */
  --hawk-form-width: 360px; /* width of the input form column   */
  --hawk-result-min-width: 420px; /* minimum width of the preview col */
  --hawk-col-gap: 28px; /* gap between form and preview      */
  --hawk-block-gap: 10px; /* vertical gap between form blocks  */

  /* ── Block card appearance ───────────────── */
  --hawk-block-bg: #ffffff;
  --hawk-block-border: #dde1e7;
  --hawk-block-radius: 6px;
  --hawk-block-pad-y: 12px;
  --hawk-block-pad-x: 14px;

  /* ── Label accent colours ────────────────── */
  --hawk-en-accent: #1a37be; /* English zone label colour  */
  --hawk-cn-accent: #c01a1a; /* CN main zone label colour  */
  --hawk-cn2-accent: #8b3a00; /* CN sub zone label colour   */

  /* ── Textarea ────────────────────────────── */
  --hawk-ta-font-size: 15px;
  --hawk-ta-border: #ccd0d4;
  --hawk-ta-radius: 4px;
  --hawk-ta-focus-ring: rgba(26, 55, 190, 0.15);

  /* ── Colour pill ─────────────────────────── */
  --hawk-pill-radius: 20px;
  --hawk-pill-font-size: 12px;
  --hawk-pill-pad: 3px 10px;

  /* ── Generate button ─────────────────────── */
  --hawk-btn-bg: #1a37be;
  --hawk-btn-bg-hover: #1530a8;
  --hawk-btn-bg-active: #102590;
  --hawk-btn-bg-disabled: #8da0e0;
  --hawk-btn-radius: 6px;
  --hawk-btn-pad: 11px 0;
  --hawk-btn-font-size: 15px;

  /* ── Template card diagram colours ──────────*/
  --hawk-tmpl-en-bar: #1a37be;
  --hawk-tmpl-cn-bar: #c01a1a;

  /* ── Preview image ───────────────────────── */
  --hawk-img-radius: 6px;
  --hawk-img-shadow: 0 3px 12px rgba(0, 0, 0, 0.12);
}

/* ═══════════════════════════════════════════════════════════════
   Layout — full-width column; form then preview stacked
═══════════════════════════════════════════════════════════════ */
#hawk-app {
  display: flex;
  flex-direction: column;
  gap: var(--hawk-block-gap);
  margin: 16px 0 24px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.hawk-form {
  display: flex;
  flex-direction: column;
  gap: var(--hawk-block-gap);
  width: 100%;
}

.hawk-result {
  width: 100%;
}

/* ═══════════════════════════════════════════════════════════════
   Block card
═══════════════════════════════════════════════════════════════ */
.hawk-block {
  background: var(--hawk-block-bg);
  border: 1px solid var(--hawk-block-border);
  border-radius: var(--hawk-block-radius);
  padding: var(--hawk-block-pad-y) var(--hawk-block-pad-x);
}

.hawk-block-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
  color: #555;
}

.hawk-label-en {
  color: var(--hawk-en-accent);
}
.hawk-label-cn {
  color: var(--hawk-cn-accent);
}
.hawk-label-cn2 {
  color: var(--hawk-cn2-accent);
}

/* ═══════════════════════════════════════════════════════════════
   Config block — size pills + template in one card
═══════════════════════════════════════════════════════════════ */
.hawk-config {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hawk-cfg-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hawk-cfg-divider {
  height: 1px;
  background: var(--hawk-block-border);
  margin: 0 calc(-1 * var(--hawk-block-pad-x));
}

/* Size pills — compact horizontal row */
.hawk-size-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.hawk-size-pill {
  cursor: pointer;
}

.hawk-size-pill input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.hawk-size-pill > span {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 5px 12px;
  border: 2px solid var(--hawk-block-border);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  color: #333;
  background: #f8f9fa;
  transition:
    border-color 0.15s,
    background 0.15s;
  white-space: nowrap;
}

.hawk-size-pill > span small {
  font-size: 10px;
  font-weight: 400;
  color: #888;
}

.hawk-size-pill input:checked + span {
  border-color: var(--hawk-en-accent);
  background: #eef1fd;
  color: var(--hawk-en-accent);
}

.hawk-size-pill-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ═══════════════════════════════════════════════════════════════
   Template selector cards
═══════════════════════════════════════════════════════════════ */
.hawk-template-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.hawk-tmpl-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.hawk-tmpl-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.hawk-tmpl-thumb {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 10px 8px 22px; /* left padding clears the hole */
  border: 2px solid var(--hawk-block-border);
  border-radius: 6px;
  background: #f8f9fa;
  width: 100%;
  max-width: 160px;
  box-sizing: border-box;
  aspect-ratio: 30/23; /* representative landscape ratio (大牌 30×23); cards show layout not size */
  transition:
    border-color 0.15s,
    background 0.15s;
}

/* Keychain hole indicator */
.hawk-tmpl-thumb::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 50%;
  transform: translateY(-50%);
  width: 9px;
  height: 9px;
  border: 2px solid #aaa;
  border-radius: 50%;
  background: #fff;
}

.hawk-tmpl-card input:checked + .hawk-tmpl-thumb {
  border-color: var(--hawk-en-accent);
  background: #eef1fd;
}

.hawk-tmpl-card input:checked + .hawk-tmpl-thumb::before {
  border-color: var(--hawk-en-accent);
}

/* Diagram bars — flex proportions so they fill the landscape thumbnail correctly */
.tmpl-en {
  display: block;
  flex: 0 0 22%;
  background: var(--hawk-tmpl-en-bar);
  border-radius: 2px;
  opacity: 0.8;
}
.tmpl-cn-big {
  display: block;
  flex: 1;
  background: var(--hawk-tmpl-cn-bar);
  border-radius: 2px;
  opacity: 0.8;
}
.tmpl-cn-row {
  display: block;
  flex: 1;
  background: var(--hawk-tmpl-cn-bar);
  border-radius: 2px;
  opacity: 0.8;
}

/* Template E thumbnail — corner chars + vertical centre */
.hawk-tmpl-e {
  gap: 3px;
}

.tmpl-e-row {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 3px;
  flex: 1;
}

.tmpl-cn-corner {
  flex: 3; /* 30% of row (3+2+3 = 8 parts) */
  background: var(--hawk-tmpl-cn-bar);
  border-radius: 2px;
  opacity: 0.8;
}

.tmpl-e-vert {
  flex: 2; /* 20% of row (3+2+3 = 8 parts) */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 3px;
}

.tmpl-cn-dot {
  width: 5px;
  height: 5px;
  background: var(--hawk-tmpl-cn-bar);
  border-radius: 50%;
  opacity: 0.7;
}

.hawk-tmpl-name {
  font-size: 11px;
  font-weight: 700;
  color: #333;
  text-align: center;
  line-height: 1.4;
}

.hawk-tmpl-name small {
  display: block;
  font-size: 10px;
  font-weight: 400;
  color: #777;
  margin-top: 1px;
}

/* ═══════════════════════════════════════════════════════════════
   Combined inputs block — all zones in one card
═══════════════════════════════════════════════════════════════ */
.hawk-inputs {
  padding: 0;
}

.hawk-inputs .hawk-zone {
  padding: var(--hawk-block-pad-y) var(--hawk-block-pad-x);
}

.hawk-zone-sep {
  height: 1px;
  background: var(--hawk-block-border);
}

/* ── Zone text inputs ── */
.hawk-zone textarea {
  width: 100%;
  box-sizing: border-box;
  font-size: var(--hawk-ta-font-size);
  padding: 7px 9px;
  border: 1px solid var(--hawk-ta-border);
  border-radius: var(--hawk-ta-radius);
  resize: vertical;
  font-family: inherit;
  line-height: 1.5;
  margin-bottom: 8px;
  min-height: 38px;
  height: 38px;
  overflow: hidden;
  transition:
    height 0.15s,
    box-shadow 0.15s;
}

.hawk-zone textarea:focus {
  outline: none;
  border-color: var(--hawk-en-accent);
  box-shadow: 0 0 0 2px var(--hawk-ta-focus-ring);
  height: 68px;
  overflow: auto;
}

/* EN character counter injected by JS below the English textarea */
.hawk-char-count {
  display: block;
  font-size: 11px;
  color: #888;
  text-align: right;
  margin: -5px 0 6px;
  font-variant-numeric: tabular-nums;
  transition: color 0.15s;
}
.hawk-char-count-warn {
  color: #b36200;
}
.hawk-char-count-over {
  color: var(--hawk-cn-accent);
  font-weight: 700;
}

/* ═══════════════════════════════════════════════════════════════
   角字版 — two-column corner char input
═══════════════════════════════════════════════════════════════ */
.hawk-corner-split {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
}

.hawk-corner-cell {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hawk-corner-hint {
  font-size: 11px;
  font-weight: 600;
  color: #888;
  text-align: center;
}

.hawk-corner-cell input[type="text"] {
  width: 100%;
  box-sizing: border-box;
  font-size: 28px;
  text-align: center;
  padding: 10px 6px;
  border: 1px solid var(--hawk-ta-border);
  border-radius: var(--hawk-ta-radius);
  font-family: inherit;
  line-height: 1;
}

.hawk-corner-cell input[type="text"]:focus {
  outline: none;
  border-color: var(--hawk-en-accent);
  box-shadow: 0 0 0 2px var(--hawk-ta-focus-ring);
}

/* ═══════════════════════════════════════════════════════════════
   Colour pills
═══════════════════════════════════════════════════════════════ */
.hawk-colours {
  display: flex;
  gap: 6px;
}

.hawk-col-pill {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.hawk-col-pill input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.hawk-col-pill span {
  display: inline-block;
  padding: var(--hawk-pill-pad);
  border-radius: var(--hawk-pill-radius);
  border: 2px solid transparent;
  font-size: var(--hawk-pill-font-size);
  font-weight: 600;
  transition:
    border-color 0.12s,
    background 0.12s;
}

.hawk-col-blue span {
  background: #e8ecfd;
  color: #1a37be;
}
.hawk-col-red span {
  background: #fdecea;
  color: #c01a1a;
}
.hawk-col-na span {
  background: #f0f0f0;
  color: #666;
}

.hawk-col-blue input:checked + span {
  border-color: #1a37be;
}
.hawk-col-red input:checked + span {
  border-color: #c01a1a;
}
.hawk-col-na input:checked + span {
  border-color: #999;
}

/* ═══════════════════════════════════════════════════════════════
   Order extras — Need Help + Agreement (frontend only, below #hawk-app)
═══════════════════════════════════════════════════════════════ */
.hawk-order-extras {
  display: flex;
  flex-direction: column;
  gap: var(--hawk-block-gap);
  margin-top: var(--hawk-block-gap);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Design choice — single-select option cards */
.hawk-design-choice {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hawk-choice-opt {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 2px solid var(--hawk-block-border);
  border-radius: var(--hawk-block-radius);
  cursor: pointer;
  font-size: 13px;
  line-height: 1.5;
  color: #333;
  transition: border-color 0.15s, background 0.15s;
}

.hawk-choice-opt:hover {
  border-color: #aab;
  background: #f8f9fc;
}

.hawk-choice-opt.hawk-choice-selected {
  border-color: var(--hawk-en-accent);
  background: #f0f4ff;
}

.hawk-choice-opt input[type="radio"] {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 2px;
  cursor: pointer;
  accent-color: var(--hawk-en-accent);
}

.hawk-choice-text small {
  display: block;
  color: #777;
  font-size: 11px;
  margin-top: 2px;
}

#hawk-help-body {
  margin-top: 2px;
}

#hawk-help-body textarea {
  width: 100%;
  box-sizing: border-box;
  font-size: 14px;
  padding: 7px 9px;
  border: 1px solid var(--hawk-ta-border);
  border-radius: var(--hawk-ta-radius);
  resize: vertical;
  font-family: inherit;
  line-height: 1.5;
  min-height: 72px;
}

#hawk-help-body textarea:focus {
  outline: none;
  border-color: var(--hawk-en-accent);
  box-shadow: 0 0 0 2px var(--hawk-ta-focus-ring);
}

/* Locked Add to Cart state */
.hawk-atc-locked,
.single_add_to_cart_button[disabled] {
  opacity: 0.45 !important;
  cursor: not-allowed !important;
}

/* ═══════════════════════════════════════════════════════════════
   Admin-only watermark toggle
═══════════════════════════════════════════════════════════════ */
.hawk-wm-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #555;
  cursor: pointer;
}

.hawk-wm-toggle input[type="checkbox"] {
  width: 15px;
  height: 15px;
  cursor: pointer;
}

/* ═══════════════════════════════════════════════════════════════
   Generate button
═══════════════════════════════════════════════════════════════ */
#hawk-generate {
  width: 100%;
  padding: var(--hawk-btn-pad);
  font-size: var(--hawk-btn-font-size);
  font-weight: 700;
  color: #fff;
  background: var(--hawk-btn-bg);
  border: none;
  border-radius: var(--hawk-btn-radius);
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: background 0.15s;
}

#hawk-generate:hover {
  background: var(--hawk-btn-bg-hover);
}
#hawk-generate:active {
  background: var(--hawk-btn-bg-active);
}
#hawk-generate:disabled {
  background: var(--hawk-btn-bg-disabled);
  cursor: not-allowed;
}

/* ═══════════════════════════════════════════════════════════════
   Result / preview image
═══════════════════════════════════════════════════════════════ */
#hawk-loading {
  font-style: italic;
  color: #666;
  margin-bottom: 8px;
  font-size: 13px;
}

/* hidden attribute overridden by ID selectors below — force it back */
#hawk-loading[hidden],
#hawk-preview-img[hidden] {
  display: none !important;
}

#hawk-error {
  color: var(--hawk-cn-accent);
  font-size: 13px;
  margin: 0;
  padding: 8px 10px;
  background: #fdecea;
  border-radius: 4px;
  border: 1px solid #f5c6c6;
}

#hawk-preview-img {
  max-width: 100%;
  border-radius: var(--hawk-img-radius);
  box-shadow: var(--hawk-img-shadow);
  display: block;
}

/* hotline-small canvas (383×125) is short — stretch to fill column width */
#hawk-preview-img.hawk-preview-fill-width {
  width: 40%;
}
