/* ==========================================================================
   KAI Golf — base typography and form controls (single source of truth)

   Linked first on every page, before dashboard.css / buttons.css / etc.

   Two things live here and nowhere else:
     1. The font stack and the type scale.
     2. How every input, select and textarea looks and how tall it is.

   Do NOT set font-family, font-size or control padding/height in a page
   <style> block. If a page needs a denser control, use .input-sm /
   .input-xs below rather than inventing a new size.
   ========================================================================== */

/* Border-box everywhere.

   This rule used to live only in dashboard.css and public-site.css. Every page
   that loads neither -- login, register, forgot_password, reset_password, all
   of which load style.css -- therefore sized in content-box, so `width: 100%`
   plus padding overflowed the viewport: 26 to 48px of horizontal scroll
   measured at 320, 360, 390 and 430px. base.css is linked first by every page,
   which is the only place a global rule can sit and be true.
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
}

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;

  /* Type scale — every size in the portal is one of these six */
  --text-page-title: 24px;      /* h1 / .content-title                       */
  --text-section-title: 18px;   /* .title / .section-title                   */
  --text-subsection: 16px;      /* h3 inside a section                       */
  --text-body: 14px;            /* body copy, table cells, labels, controls  */
  --text-secondary: 13px;       /* hints, subtitles, dense tables            */
  --text-micro: 12px;           /* badges, tags                              */

  /* Control metrics — the default height matches --btn-height in buttons.css
     so an input and the button beside it line up. */
  --control-height: 38px;
  --control-height-sm: 32px;
  --control-padding-y: 8px;
  --control-padding-x: 12px;
  --control-radius: 6px;
}

html,
body {
  font-family: var(--font-sans);
  font-size: var(--text-body);
}

/* --------------------------------------------------------------------------
   Form controls do not inherit the page font on their own — say so once,
   for every control on every page. This is what kept dropdowns rendering
   in the browser's own UI font while the text beside them did not.
   -------------------------------------------------------------------------- */

input,
select,
textarea,
button,
optgroup,
option {
  font-family: var(--font-sans);
}

input,
select,
textarea {
  font-size: var(--text-body);
  line-height: 1.2;
}

/* --------------------------------------------------------------------------
   The standard control: one height, one padding, one border, one radius.
   Excludes the input types that are not text boxes.
   -------------------------------------------------------------------------- */

input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="range"]):not([type="file"]):not([type="color"]),
select,
textarea {
  min-height: var(--control-height);
  padding: var(--control-padding-y) var(--control-padding-x);
  color: var(--color-text-primary, #f0f0f0);
  background-color: var(--color-bg-tertiary, #252525);
  border: 1px solid var(--color-border, #3a3a3a);
  border-radius: var(--control-radius);
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-accent, #cb1533);
  box-shadow: 0 0 0 3px rgba(203, 21, 51, 0.15);
}

input::placeholder,
textarea::placeholder {
  color: var(--color-text-secondary, #a0a0a0);
}

input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

textarea {
  min-height: 80px;
  line-height: 1.5;
  resize: vertical;
}

/* --------------------------------------------------------------------------
   Dropdowns: one chevron everywhere instead of each platform's own control.
   -------------------------------------------------------------------------- */

select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23a0a0a0' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

select::-ms-expand {
  display: none;
}

/* The list itself, for the platforms that let us style it */
option {
  background-color: var(--color-bg-secondary, #1a1a1a);
  color: var(--color-text-primary, #f0f0f0);
}

/* --------------------------------------------------------------------------
   Denser tiers — for grid-like editors (scorecards, hole tables) where a
   38px row would not fit. Use these instead of new one-off sizes.
   -------------------------------------------------------------------------- */

.input-sm,
.input-sm input,
.input-sm select {
  min-height: var(--control-height-sm);
  padding: 6px 10px;
  font-size: var(--text-secondary);
}

.input-xs,
.input-xs input,
.input-xs select {
  min-height: 26px;
  padding: 4px 6px;
  font-size: var(--text-micro);
}

.input-sm select,
.input-xs select {
  padding-right: 26px;
  background-position: right 8px center;
}

/* Existing dense editors keep the sizing they already had — they opt out of
   the standard height rather than being stretched to it. */
.scorecard-row input,
.holes-table input,
.holes-table select,
.tee-compact-input input,
.tee-boxes-table input,
.table-time-input,
.quick-time,
.phone-country-search input {
  min-height: 0;
}

/* Widgets that are not <input> but must line up with one (the phone country
   picker is a div pretending to be a select). */
.phone-country-display {
  min-height: var(--control-height);
  padding: var(--control-padding-y) var(--control-padding-x);
  font-size: var(--text-body);
  border-radius: var(--control-radius);
  box-sizing: border-box;
}

/* --------------------------------------------------------------------------
   Labels and helper text
   -------------------------------------------------------------------------- */

label,
.form-group label {
  font-size: var(--text-body);
  color: var(--color-text-primary, #f0f0f0);
}

.field-hint,
.section-subtitle,
.form-group small {
  font-size: var(--text-secondary);
  color: var(--color-text-secondary, #a0a0a0);
}
