/*
 * Kitchen Converters — public stylesheet (v1.0.4)
 *
 * v1.0.4 visual direction: light professional UI matching BudgetFlow Pro
 * (knightkettle.com/568-2/). All selectors scoped under the .kc-app root.
 *
 * IMPORTANT — sizing:
 *   Explicit px (and a few em) values, not rem, because the PenciDesign
 *   theme sets html { font-size: 10px }. Using rem would shrink every
 *   element to ~60% of intended. All text meets the 13px floor; controls
 *   use 16px (matches the BudgetFlow Pro reference and prevents iOS
 *   auto-zoom on focus).
 *
 *   v1.0.4 design rules:
 *   - Light theme ONLY (no prefers-color-scheme: dark override). The
 *     plugin must look the same regardless of browser dark mode.
 *   - Container max-width 1180px on desktop (matches BudgetFlow Pro).
 *   - Tab strip uses flex-wrap: wrap (not overflow-x: auto) so all 10
 *     tool names are always visible without horizontal scrolling.
 *   - Active tab is solid indigo rgb(79, 70, 229) with white text.
 *   - Inactive tabs are transparent with slate-700 text on white tab
 *     strip — high contrast.
 *   - Section cards are white, 14px radius, soft shadow — matches
 *     BudgetFlow Pro section/summary cards exactly.
 *   - Helper/approximation box uses a soft slate background, NOT the
 *     amber/error palette, so it reads as informational, not alarming.
 *   - Result card uses a light indigo-50/100 gradient with indigo-900
 *     text — prominent but professional, not garish.
 *
 * Type floor: 13px on all text — no exceptions.
 * Touch targets: 44x44 min (Apple HIG / WCAG 2.5.5 AAA mobile).
 * Motion: respects prefers-reduced-motion.
 * Print: result card preserved, tabs and helper chrome hidden.
 * Dark mode: INTENTIONALLY NOT RESPONDED to. The plugin's brand is
 * light, warm, and content-friendly; matching the surrounding Knife
 * Kettle editorial site is the goal.
 */

/* ---- 1. Local reset (scoped) ---- */
.kc-app,
.kc-app *,
.kc-app *::before,
.kc-app *::after {
  box-sizing: border-box;
}

.kc-app {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;                  /* explicit px so 10px html root cannot shrink it */
  line-height: 1.55;
  color: #0f172a;                   /* slate-900 — primary text on light bg */
  background: #f8fafc;              /* slate-50 — matches BudgetFlow Pro page bg */
  border: 0;
  border-radius: 0;
  padding: 24px 16px;
  max-width: 1180px;
  margin: 24px auto;
  -webkit-text-size-adjust: 100%;
  box-shadow: none;
}

.kc-app__main {
  display: block;
}

/* ---- 2. Screen reader only utility (scoped) ---- */
.kc-app .kc-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- 3. Header card (title + tagline) — matches BudgetFlow Pro .app-header ---- */
.kc-app .kc-app__header {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 16px;
  background: #ffffff;
  border: 1px solid #e2e8f0;        /* slate-200 */
  border-bottom: 0;
  border-radius: 14px 14px 0 0;
  padding: 20px 24px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.kc-app .kc-app__title {
  font-size: 24px;
  font-weight: 800;
  color: #0f172a;                   /* slate-900 */
  margin: 0;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.kc-app .kc-app__tagline {
  font-size: 14px;
  color: #64748b;                   /* slate-500 */
  margin: 0;
  line-height: 1.4;
}

.kc-app .kc-app__tagline::before {
  content: "•";
  color: #cbd5e1;
  margin-right: 8px;
}

/* ---- 4. Tabs — pill style, wraps to multiple rows, in a soft card container ---- */
.kc-app .kc-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
  padding: 6px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-top: 0;
  border-bottom: 0;
  border-radius: 0;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.kc-app .kc-tab {
  appearance: none;
  background: transparent;
  border: 0;
  color: #475569;                   /* slate-600 */
  cursor: pointer;
  font: inherit;
  font-size: 13px;                  /* explicit px */
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: none;             /* case-preserved; the budgetflow reference uses title case */
  padding: 12px 16px;
  min-height: 44px;
  min-width: 44px;
  white-space: nowrap;
  border-radius: 6px;
  transition: color 120ms ease, background-color 120ms ease,
    box-shadow 120ms ease;
  flex: 0 0 auto;
}

.kc-app .kc-tab:hover {
  color: #0f172a;
  background: #f1f5f9;              /* slate-100 */
}

.kc-app .kc-tab:focus {
  outline: 2px solid #4f46e5;
  outline-offset: 2px;
}

.kc-app .kc-tab:focus:not(:focus-visible) {
  outline: 0;
}

.kc-app .kc-tab:focus-visible {
  outline: 2px solid #4f46e5;
  outline-offset: 2px;
}

.kc-app .kc-tab--active {
  background: #4f46e5;              /* indigo-600 — exact match to BudgetFlow Pro */
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.25);
}

.kc-app .kc-tab--active:hover {
  background: #4338ca;              /* indigo-700 */
  color: #ffffff;
}

/* ---- 5. Panel host / panel / content area — matches BudgetFlow Pro .tab-content ---- */
.kc-app .kc-panel-host {
  display: block;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-top: 0;
  border-radius: 0 0 14px 14px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.kc-app .kc-panel {
  display: block;
}

.kc-app .kc-title {
  font-size: 20px;
  margin: 0 0 4px;
  color: #0f172a;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.kc-app .kc-description {
  margin: 0 0 20px;
  color: #475569;
  font-size: 15px;
  line-height: 1.55;
}

/* ---- 6. Form ---- */
.kc-app .kc-form {
  display: block;
  margin: 0 0 20px;
}

.kc-app .kc-field {
  display: flex;
  flex-direction: column;
  margin-bottom: 16px;
}

.kc-app .kc-label {
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 6px;
  line-height: 1.4;
  letter-spacing: 0.01em;
}

.kc-app .kc-input {
  appearance: none;
  font: inherit;
  font-size: 16px;                  /* 16px = iOS no-zoom, matches BudgetFlow Pro inputs */
  color: #0f172a;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 12px 14px;
  min-height: 48px;
  width: 100%;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.kc-app .kc-input::placeholder {
  color: #94a3b8;
  opacity: 1;
}

.kc-app .kc-input:hover {
  border-color: #94a3b8;
}

.kc-app .kc-input:focus {
  outline: 2px solid #4f46e5;
  outline-offset: 1px;
  border-color: #4f46e5;
}

.kc-app .kc-input:focus:not(:focus-visible) {
  outline: 0;
}

.kc-app .kc-input:focus-visible {
  outline: 2px solid #4f46e5;
  outline-offset: 1px;
  border-color: #4f46e5;
}

.kc-app .kc-input:disabled {
  background: #f1f5f9;
  color: #94a3b8;
  cursor: not-allowed;
}

/* Native select arrow — custom chevron, scales with select height */
.kc-app select.kc-input {
  background-image: linear-gradient(45deg, transparent 50%, #64748b 50%),
                    linear-gradient(135deg, #64748b 50%, transparent 50%);
  background-position: calc(100% - 20px) center, calc(100% - 14px) center;
  background-size: 6px 6px;
  background-repeat: no-repeat;
  padding-right: 40px;
}

.kc-app .kc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.kc-app .kc-button {
  appearance: none;
  font: inherit;
  font-weight: 600;
  font-size: 15px;                  /* px */
  padding: 12px 22px;
  min-height: 48px;
  min-width: 44px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  letter-spacing: 0.01em;
  transition: background-color 120ms ease, border-color 120ms ease,
    color 120ms ease, transform 80ms ease, box-shadow 120ms ease;
}

.kc-app .kc-button:focus {
  outline: 2px solid #4f46e5;
  outline-offset: 2px;
}

.kc-app .kc-button:focus:not(:focus-visible) {
  outline: 0;
}

.kc-app .kc-button:focus-visible {
  outline: 2px solid #4f46e5;
  outline-offset: 2px;
}

.kc-app .kc-button:active {
  transform: translateY(1px);
}

.kc-app .kc-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.kc-app .kc-button--primary {
  background: #4f46e5;              /* indigo-600 — exact match to BudgetFlow Pro */
  color: #ffffff;
  border-color: #4f46e5;
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.18);
}

.kc-app .kc-button--primary:hover {
  background: #4338ca;              /* indigo-700 */
  border-color: #4338ca;
  box-shadow: 0 2px 4px rgba(79, 70, 229, 0.25);
}

.kc-app .kc-button--secondary {
  background: #ffffff;
  color: #1f2937;
  border-color: #cbd5e1;
}

.kc-app .kc-button--secondary:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

/* ---- 7. Result card — light indigo gradient, prominent but professional ---- */
.kc-app .kc-result {
  display: block;
  margin: 24px 0 0;
  background: linear-gradient(180deg, #eef2ff 0%, #e0e7ff 100%);
  border: 1px solid #c7d2fe;
  border-radius: 12px;
  padding: 20px 24px;
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.08);
}

.kc-app .kc-result:empty {
  display: none;
}

.kc-app .kc-result-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px dashed #c7d2fe;
  gap: 16px;
  flex-wrap: wrap;
}

.kc-app .kc-result-row:last-child {
  border-bottom: 0;
}

.kc-app .kc-result-label {
  color: #3730a3;                   /* indigo-800 */
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.kc-app .kc-result-value {
  color: #1e1b4b;                   /* indigo-950 */
  font-weight: 700;
  font-size: 22px;
  text-align: right;
  line-height: 1.2;
  word-break: break-word;
  font-variant-numeric: tabular-nums;
}

.kc-app .kc-error {
  color: #991b1b;                   /* red-800 */
  background: #fef2f2;              /* red-50 */
  border: 1px solid #fecaca;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.5;
  margin-top: 12px;
}

/* ---- 8. Helper / Approximation text — soft slate, NOT amber-error ---- */
.kc-app .kc-helper {
  margin: 20px 0 0;
  padding: 14px 18px;
  background: #f1f5f9;              /* slate-100 — neutral, informational */
  border: 1px solid #e2e8f0;        /* slate-200 */
  border-left: 4px solid #94a3b8;   /* slate-400 — soft accent rail */
  border-radius: 10px;
  color: #475569;                   /* slate-600 */
  font-size: 14px;
  line-height: 1.55;
}

.kc-app .kc-helper p {
  margin: 0 0 6px;
}

.kc-app .kc-helper p:last-child {
  margin-bottom: 0;
}

.kc-app .kc-helper-assumption {
  font-style: italic;
  color: #475569;
}

.kc-app .kc-helper-approx {
  font-weight: 500;
  color: #334155;                   /* slate-700 */
}

/* ---- 9. Responsive: mobile-first, tablet+ widening ---- */
@media (min-width: 640px) {
  .kc-app {
    padding: 28px 20px;
  }

  .kc-app .kc-app__header {
    padding: 24px 28px;
  }

  .kc-app .kc-panel-host {
    padding: 28px;
  }

  .kc-app .kc-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 20px;
  }

  .kc-app .kc-form .kc-actions {
    grid-column: 1 / -1;
  }
}

@media (min-width: 960px) {
  .kc-app {
    padding: 32px 24px;
  }

  .kc-app .kc-app__header {
    padding: 28px 32px;
  }

  .kc-app .kc-panel-host {
    padding: 32px;
  }
}

@media (min-width: 1180px) {
  /* At 1180+ we have room for a 3-column form on wide tools. */
  .kc-app .kc-form {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ---- 10. Reduced motion (per-selector overrides, no !important) ---- */
@media (prefers-reduced-motion: reduce) {
  .kc-app,
  .kc-app *,
  .kc-app *::before,
  .kc-app *::after {
    animation-duration: 0.01ms;
    animation-iteration-count: 1;
    transition-duration: 0.01ms;
    scroll-behavior: auto;
  }
}

/* ---- 11. Print ---- */
@media print {
  .kc-app {
    border: 0;
    padding: 0;
    background: #ffffff;
    color: #000000;
    max-width: 100%;
    box-shadow: none;
  }

  .kc-app .kc-app__header,
  .kc-app .kc-tabs,
  .kc-app .kc-actions,
  .kc-app .kc-helper {
    display: none;
  }

  .kc-app .kc-form {
    display: none;
  }

  .kc-app .kc-panel-host,
  .kc-app .kc-panel,
  .kc-app .kc-result {
    page-break-inside: avoid;
    background: #ffffff;
    border: 0;
    padding: 0;
    box-shadow: none;
  }

  .kc-app .kc-title,
  .kc-app .kc-description {
    color: #000000;
  }

  .kc-app .kc-result-row {
    border-bottom-color: #999999;
  }

  .kc-app .kc-result-label {
    color: #333333;
  }

  .kc-app .kc-result-value {
    color: #000000;
  }
}
