/* Buttons, text inputs, select boxes, checkboxes, radio buttons, and
   label/value form rows -- from design-handoffs/asportal-public/design-guide/
   {Portal_Button,Portal_Input,"Portal_Select box","Portal_Check, Radio
   Button",Portal_List}.css. Structured identically to asportal-admin's own
   forms.css (native <select>/<input type="checkbox|radio"> styled
   directly rather than reimplemented, for free accessibility/keyboard
   behavior) -- see that file for the general pattern this follows.

   Colors/sizes below were cross-checked against admin's shipped forms.css
   and matched almost value-for-value; genuine differences (the 180px
   list-label width, the Small/Medium/XSmall button sizing split, and
   every real mobile-only change) are called out inline. The exact
   Normal/Hover/Pressed color for each .btn-* variant hasn't been
   confirmed against Portal_Button.png directly yet (that file's raw CSS
   dump has the same "hundreds of ungrouped per-instance blocks" problem
   admin's own Button.css export had) -- built to match admin's proven
   variant set for now; revisit against a real screen's own PNG once one
   using each variant exists, same as admin's .btn-text comment describes
   doing for itself. */

/* ---- Buttons ---- */

.btn {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-family);
  font-weight: 400;
  letter-spacing: var(--letter-spacing-tight);
  text-align: center;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}

.btn:disabled {
  background: var(--color-surface-hover);
  border-color: var(--color-surface-hover);
  color: var(--color-text-placeholder);
  cursor: not-allowed;
}

/* Sizes -- Portal_Button.css shows 3 sizes (01 Small/02 Medium/02 XSmall),
   one more than admin's 2 (admin has no XSmall). Small/Medium heights
   (32/36) and radii (6/8) match admin's .btn-sm/.btn-md exactly; XSmall
   is new. No separate .btn-lg (48px) shown in this guide the way admin's
   was -- the guide's one oversized pill (54px, 1000px radius) is a
   distinct hero/CTA shape, not a bigger version of this same button
   family, see .btn-hero below. */
.btn-xs { height: 24px; padding: 0 8px;  border-radius: var(--radius-sm); font-size: 13px; }
.btn-sm { height: 32px; padding: 0 10px; border-radius: var(--radius-sm); font-size: 14px; }
.btn-md { height: 36px; padding: 0 16px; border-radius: var(--radius-md); font-size: 15px; }

/* Color variants -- each defines Normal / Hover-or-Pressed (one shared
   color) / Disabled (:disabled above), same 3-state rule as admin's
   Button.css guide. */
.btn-white  { background: var(--color-surface); border-color: var(--color-border); color: var(--color-text-secondary); }
.btn-white:active:not(:disabled) { background: var(--color-surface-muted); }

.btn-text   { background: transparent; border-color: transparent; color: var(--color-text-secondary); }
.btn-text:active:not(:disabled) { background: var(--color-surface-muted); }

.btn-gray   { background: var(--color-surface-muted); border-color: var(--color-border); color: var(--color-text-secondary); }
.btn-gray:active:not(:disabled) { background: var(--color-surface-hover); }

.btn-primary   { background: var(--color-accent-orange); color: var(--color-text-inverse); }
.btn-primary:active:not(:disabled) { background: var(--color-accent-orange-hover); }

.btn-secondary { background: var(--color-button-primary-bg); color: var(--color-text-inverse); }
.btn-secondary:active:not(:disabled) { background: var(--color-button-secondary-bg); }

/* Large pill CTA (design-guide's own oversized "Basic"/128x54 example,
   1000px radius, 32px bold text) -- a visually distinct shape from the
   .btn-sm/md/xs family above, not just a bigger size step of it. No
   current screen actually uses this class yet -- login and home's own
   CTA buttons turned out not to need this exact variant once built;
   expect to confirm sizing/color once something does. */
.btn-hero {
  height: 54px;
  padding: 8px 24px;
  border-radius: var(--radius-pill);
  background: var(--color-button-primary-bg);
  color: var(--color-text-inverse);
  font-size: 32px;
  font-weight: 700;
}

.btn-hero:active:not(:disabled) {
  background: var(--color-button-secondary-bg);
}

/* Every :hover rule in this file (and every other asportal-public stylesheet)
   is scoped to (hover: hover) -- without it, a real iPhone Safari report
   showed tapped buttons staying visibly "stuck" in their Hover color
   after the tap ended, since touch has no cursor to leave and clear the
   :hover state the way a mouse pointer moving away naturally does. The
   already-existing `:active` rules above (unaffected, always apply) are
   what already gives real tap feedback -- this block only adds the
   Hover-only look back for actual pointer/mouse devices, gated so touch
   never sees it at all (not just "clears faster"). */
@media (hover: hover) {
  .btn-white:hover:not(:disabled) { background: var(--color-surface-muted); }
  .btn-text:hover:not(:disabled) { background: var(--color-surface-muted); }
  .btn-gray:hover:not(:disabled) { background: var(--color-surface-hover); }
  .btn-primary:hover:not(:disabled) { background: var(--color-accent-orange-hover); }
  .btn-secondary:hover:not(:disabled) { background: var(--color-button-secondary-bg); }
  .btn-hero:hover:not(:disabled) { background: var(--color-button-secondary-bg); }
}

/* ---- Text inputs ---- */

.field {
  box-sizing: border-box;
  width: 100%;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  font-family: var(--font-family);
  /* 16px, not 15px -- iOS Safari auto-zooms the whole page in on focus
     when a text input's own font-size is under 16px. Same fix applied
     to .login-input/.search-box-input, see that rule's own note. */
  font-size: 16px;
  font-weight: 400;
  letter-spacing: var(--letter-spacing-tight);
  color: var(--color-text-primary);
}

.field::placeholder {
  color: var(--color-text-placeholder);
}

.field:focus {
  outline: none;
  border-color: var(--color-text-muted);
}

.field.field-error {
  border-color: var(--color-accent-error);
}

.field:disabled {
  background: var(--color-surface-muted);
}

.field-lg {
  height: 48px;
  padding: 0 16px;
  border-radius: var(--radius-md);
}

textarea.field {
  height: auto;
  max-width: none;
  padding: 12px;
  resize: vertical;
  min-height: 120px;
}

.field-error-message {
  display: block;
  margin-top: 8px;
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: var(--letter-spacing-tight);
  color: var(--color-accent-error);
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-group-title {
  font-family: var(--font-family);
  font-size: 15px;
  font-weight: 400;
  letter-spacing: var(--letter-spacing-tight);
  color: var(--color-text-muted);
}

/* Input/Select box sizes are unchanged at every breakpoint per
   Portal_Input.css/"Portal_Select box".css (confirmed directly in each
   guide's own mobile mockup) -- the guide's own Mobile step shrinks the
   text 15px -> 14px, same Body2 Regular -> Mobile Body2 Regular step as
   typography.css, but that's silently below the 16px floor .field's own
   base rule specifically exists to hold -- iOS Safari auto-zooms the
   whole page in on focus for any input under 16px, and this override
   reintroduced exactly that bug at every Mobile width (real report: the
   change-password field auto-zoomed on a real iPhone). Kept at 16px here
   too instead, matching the same call already made for .login-input/
   .search-box-input (neither has ever had a Mobile-specific font-size
   override for this same reason). */

/* ---- Select box (native <select>, custom chevron) ---- */

.select {
  box-sizing: border-box;
  width: 100%;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background:
    var(--color-surface)
    url('../../images/base/icons/ic-down-stroke-12-md.svg') no-repeat right 12px center;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  font-family: var(--font-family);
  font-size: 15px;
  font-weight: 400;
  letter-spacing: var(--letter-spacing-tight);
  color: var(--color-text-primary);
}

.select:focus {
  outline: none;
  border-color: var(--color-text-muted);
}

.select.select-error {
  border-color: var(--color-accent-error);
}

.select:disabled {
  background-color: var(--color-surface-muted);
}

/* "02. Medium (+제목)" -- height 36/radius 8, matches admin's .select-lg
   exactly. */
.select-lg {
  height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-md);
}

.select-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.select-ghost {
  height: 36px;
  padding: 0 28px 0 8px;
  border-color: transparent;
  border-radius: var(--radius-md);
  background-color: var(--color-surface);
  background-position: right 8px center;
}

.select-ghost:active {
  background-color: var(--color-surface-muted);
}

@media (hover: hover) {
  .select-ghost:hover {
    background-color: var(--color-surface-muted);
  }
}

/* ---- Checkbox ---- */

/* Design-guide component (Portal_Check, Radio Button, zpl.io/8EWjnKX) --
   the checked/disabled states now render its own real exported SVGs
   (images/base/icons/ic-check-{s,disabled,s-disabled}.svg, already in
   the repo, previously unused) instead of a CSS ::after triangle-corner
   rotated 45deg -- a generic hack whose sharp square-cut corners never
   matched the guide's actual checkmark, a real vector path with rounded
   stroke-linecap/linejoin. Colors/radius were already correct (every
   token below matches the guide's own fills exactly -- --color-border/
   -surface/-accent-orange/-surface-muted/-text-placeholder), only the
   checkmark's own shape was wrong. No ic-check-n.svg exists (or is
   needed) for the plain unchecked/enabled state -- that's just a flat
   white box with a border, which this base rule already draws exactly
   right on its own. */
.checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  flex: none;
  box-sizing: border-box;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-surface);
  cursor: pointer;
  position: relative;
}

.checkbox:checked {
  border: none;
  background: url("../../images/base/icons/ic-check-s.svg") center / 24px 24px no-repeat;
}

.checkbox:disabled {
  border: none;
  background: url("../../images/base/icons/ic-check-disabled.svg") center / 24px 24px no-repeat;
  cursor: not-allowed;
}

.checkbox:disabled:checked {
  background-image: url("../../images/base/icons/ic-check-s-disabled.svg");
}

/* ---- Radio ---- */

.radio {
  appearance: none;
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  flex: none;
  box-sizing: border-box;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  background: var(--color-surface);
  cursor: pointer;
  position: relative;
}

.radio:checked {
  background: var(--color-accent-orange);
  border-color: var(--color-accent-orange);
}

.radio:checked::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-text-inverse);
  transform: translate(-50%, -50%);
}

.radio:disabled {
  background: var(--color-surface-muted);
  border-color: var(--color-border);
  cursor: not-allowed;
}

.radio:disabled:checked::after {
  background: var(--color-text-placeholder);
  opacity: 0.7;
}

/* ---- Form rows (label left / value right) -- Portal_List.css's
   page-level pattern (내 정보 등), distinct from admin's in one real way:
   label column is 180px here, not admin's 200px -- confirmed directly in
   the guide's own "180px 고정" callout, not a transcription slip. ---- */

.form-table {
  width: 100%;
  border-top: 1px solid var(--color-border-strong);
  border-bottom: 1px solid var(--color-border-strong);
}

.form-row {
  display: flex;
  align-items: center;
  /* Portal_List.css: row min-height 48px (PC/Tablet) -- padding, not a
     fixed height, so a taller value (e.g. a wrapped label) can still grow
     the row instead of clipping. */
  min-height: 48px;
  box-sizing: border-box;
  border-bottom: 1px solid var(--color-border-light);
  gap: 24px;
}

.form-label {
  flex: none;
  width: 180px;
  font-family: var(--font-family);
  font-size: 15px;
  font-weight: 400;
  letter-spacing: var(--letter-spacing-tight);
  line-height: 1.5;
  color: var(--color-text-muted);
}

.form-label .required {
  color: var(--color-accent-error);
  margin-left: 2px;
}

.form-value {
  flex: 1;
  min-width: 0;
  font-family: var(--font-family);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: var(--letter-spacing-tight);
  color: var(--color-text-primary);
  /* Plain-text values (e.g. 내 정보's email, no <input> wrapper) have
     nothing else forcing them to respect this row's width -- a long,
     unbroken token like an email address otherwise overflows straight
     past the viewport edge on narrow screens instead of wrapping. Real
     bug, confirmed on mobile 내 정보 (public-spec section 6). */
  overflow-wrap: break-word;
}

.form-value .field,
.form-value .select {
  max-width: 350px;
}

.form-value textarea.field {
  max-width: none;
}

/* A button sitting directly in a .form-value (e.g. 내 정보's own 비밀번호
   변경 trigger, public-spec section 6) -- 8px top/bottom so it doesn't
   just sit flush-centered on .form-row's own min-height, per explicit
   user request. .form-row's align-items:center still centers it
   horizontally-adjacent to the label; this margin is what actually grows
   the row past its 48px floor to leave real breathing room above/below. */
.form-value > .btn {
  margin: 8px 0;
}

.form-hint {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  color: var(--color-text-faint);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 24px;
}

/* Portal_List.css's modal-embedded variant (160px label) -- matches
   admin's #passwordModal .form-label exactly; scoped the same way,
   per-modal-id, not here -- see base/modal.css's own #passwordModal/
   #trainingModal rules, each independently confirmed against its own
   real CSS export rather than declared generically here. */

/* Portal_List.css mobile tier: row shrinks to 40px min-height, label
   column narrows to 100px (page-level) -- a real reflow, not just a font
   change like Input/Select above. */
@media (max-width: 767px) {
  .form-row {
    min-height: 40px;
  }

  .form-label {
    width: 100px;
  }
}

/* ---- Option list (checkbox/radio rows) -- 교육 신청 popup's own 교육 과정/
   희망 교육 일정 lists (`design-handoffs/asportal-public/apply for edu popup/
   Portal_교육 신청.css`), a genuinely new component: .form-table's label/
   value row shape doesn't fit a checkbox/radio + text row, and no admin
   screen has an equivalent bordered checkbox/radio list to mirror. Same
   outer-border/row-divider structure as .form-table (border-strong top/
   bottom, border-light between rows) so it reads as the same "List"
   family, just with a 40px icon column instead of a fixed label column. ---- */

.option-list {
  width: 100%;
  border-top: 1px solid var(--color-border-strong);
  border-bottom: 1px solid var(--color-border-strong);
}

.option-row {
  display: flex;
  align-items: center;
  min-height: 48px;
  box-sizing: border-box;
  border-bottom: 1px solid var(--color-border-light);
  cursor: pointer;
}

.option-row-check {
  flex: none;
  display: flex;
  align-items: center;
  width: 40px;
  padding: 8px;
  box-sizing: border-box;
}

.option-row-label {
  flex: 1;
  padding: 8px;
  font-family: var(--font-family);
  font-size: 15px;
  font-weight: 400;
  letter-spacing: var(--letter-spacing-tight);
  color: var(--color-text-primary);
}

/* Check/Radio Button has no mobile variant of its own (COMPONENTS.md) --
   only the row height/font shrink, same delta as .form-row/.form-label. */
@media (max-width: 767px) {
  .option-row {
    min-height: 40px;
  }

  .option-row-label {
    font-size: 14px;
  }
}
