/*
 * Invoice / document generator — scoped form styling
 * Requires: hw-tool-shell.css (for --hw-tool-* tokens)
 */

.invoice-gen {
  position: relative;
}

/* Stack: design-system grid → soft radial → content (matches hub / QR tools) */
.invoice-gen > .hw-tool-body-pattern {
  z-index: 0;
}

.invoice-gen::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(
    ellipse 140% 90% at 50% -15%,
    rgba(32, 62, 122, 0.055),
    transparent 58%
  );
  pointer-events: none;
  z-index: 1;
}

.invoice-gen > .hw-tool-body-inner {
  position: relative;
  z-index: 2;
}

.invoice-gen .inv-main-inner {
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
}

.invoice-gen .inv-form-wrap {
  margin-top: 2rem;
}

/* Main card + history panel */
.invoice-gen .inv-card {
  width: 100%;
  max-width: 42rem;
  margin-left: auto;
  margin-right: auto;
  padding: 2rem 1.75rem 2.25rem;
  background: var(--hw-tool-white);
  border: 1px solid var(--hw-tool-line);
  border-radius: 16px;
  box-shadow:
    0 1px 2px rgba(15, 26, 51, 0.04),
    0 12px 40px rgba(32, 62, 122, 0.08);
}

@media (min-width: 640px) {
  .invoice-gen .inv-card {
    padding: 2.25rem 2.25rem 2.5rem;
  }
}

.invoice-gen .inv-section-title {
  font-family: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  font-size: 1.45rem;
  font-weight: 600;
  color: var(--hw-tool-ink);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--hw-tool-line);
}

.invoice-gen .inv-doc-panel {
  margin-bottom: 2.5rem;
  padding-top: 0.25rem;
}

.invoice-gen .inv-doc-option {
  margin: 0;
  padding: 0.7rem 0.35rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.invoice-gen .inv-doc-option + .inv-doc-option {
  margin-top: 0.25rem;
}

.invoice-gen .inv-doc-option:hover {
  background: rgba(32, 62, 122, 0.05);
}

.invoice-gen .inv-doc-option:focus-within {
  background: rgba(32, 62, 122, 0.06);
  outline: none;
}

.invoice-gen .inv-doc-option label {
  color: var(--hw-tool-ink);
}

.invoice-gen .inv-doc-option p {
  color: var(--hw-tool-text-soft);
}

.invoice-gen .inv-label {
  display: block;
  color: var(--hw-tool-ink);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}

.invoice-gen input[type="radio"] {
  accent-color: var(--hw-tool-ocean);
  width: 1rem;
  height: 1rem;
  margin-top: 0.2rem;
  border-color: rgba(15, 26, 51, 0.25);
}

/* Text fields */
.invoice-gen .inv-field {
  display: block;
  width: 100%;
  padding: 0.55rem 0.75rem;
  font-family: inherit;
  font-size: 0.9375rem;
  line-height: 1.45;
  color: var(--hw-tool-ink);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--hw-tool-line);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(15, 26, 51, 0.03);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.invoice-gen .inv-field:hover {
  border-color: rgba(32, 62, 122, 0.28);
}

.invoice-gen .inv-field:focus {
  outline: none;
  border-color: var(--hw-tool-ocean);
  box-shadow: 0 0 0 3px rgba(32, 62, 122, 0.18);
}

.invoice-gen select.inv-field {
  padding-right: 2.35rem;
  appearance: none;
  cursor: pointer;
}

.invoice-gen textarea.inv-field {
  min-height: 5.5rem;
  resize: vertical;
}

/* Select chevron overlay from markup — keep icons readable */
.invoice-gen .pointer-events-none svg {
  opacity: 0.65;
}

/* Toggle */
.invoice-gen .inv-switch-track {
  position: relative;
  width: 2.75rem;
  height: 1.5rem;
  flex-shrink: 0;
  background: rgba(15, 26, 51, 0.15);
  border-radius: 999px;
  transition: background 0.2s ease;
}

.invoice-gen .inv-switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 1.25rem;
  height: 1.25rem;
  background: var(--hw-tool-white);
  border: 1px solid rgba(15, 26, 51, 0.12);
  border-radius: 999px;
  box-shadow: 0 1px 3px rgba(15, 26, 51, 0.12);
  transition: transform 0.2s ease;
}

.invoice-gen .inv-switch-input:checked + .inv-switch-track {
  background: var(--hw-tool-ocean);
}

.invoice-gen .inv-switch-input:checked + .inv-switch-track::after {
  transform: translateX(1.25rem);
  border-color: rgba(255, 255, 255, 0.35);
}

.invoice-gen .inv-switch-input:focus-visible + .inv-switch-track {
  box-shadow: 0 0 0 3px rgba(32, 62, 122, 0.25);
}

/* Primary action — same language as QR tool .action-btn.primary */
.invoice-gen .inv-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  padding: 14px 18px;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.84rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--hw-tool-white);
  background: var(--hw-tool-ocean);
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.invoice-gen .inv-btn-primary:hover {
  background: #162f61;
}

.invoice-gen .inv-btn-primary:focus-visible {
  outline: 3px solid rgba(32, 62, 122, 0.26);
  outline-offset: 2px;
}

.invoice-gen .inv-btn-primary:active {
  background: #142a55;
}

/* History placeholder */
.invoice-gen .inv-muted {
  color: var(--hw-tool-text-soft);
  font-size: 0.9375rem;
  line-height: 1.55;
}

/* Mobile: tight top, full-bleed form — less “boxed” chrome, more workspace */
@media (max-width: 680px) {
  .hw-tool-page:has(.invoice-gen) {
    min-height: 100dvh;
  }

  .invoice-gen {
    flex: 1 1 auto;
    min-height: 0;
  }

  .invoice-gen .inv-main-inner {
    padding-top: 0;
    padding-bottom: 0;
  }

  .invoice-gen .inv-form-wrap {
    margin-top: 0;
    max-width: none;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
  }

  .invoice-gen .inv-card {
    max-width: none;
    margin-left: 0;
    margin-right: 0;
    padding: 1.15rem 1rem 1.35rem;
    padding-left: max(1rem, env(safe-area-inset-left, 0));
    padding-right: max(1rem, env(safe-area-inset-right, 0));
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: 1px solid var(--hw-tool-line);
    box-shadow: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .invoice-gen .inv-doc-option,
  .invoice-gen .inv-field,
  .invoice-gen .inv-switch-track,
  .invoice-gen .inv-switch-track::after,
  .invoice-gen .inv-btn-primary {
    transition: none;
  }

}
