/* ===========================
 * Radio Button Component Styles
 * ===========================
 * Sizes: sm (16px), md (20px default)
 * States: default, hover, focused, disabled
 * Checked: unchecked, checked
 * Elements: radio-group (wrapper), radio-input (hidden input + visual circle),
 *           radio-label, radio-supporting-text
 * ===========================
 * Dark mode handled by CSS custom properties via data-theme attribute
 * =========================== */


/* ─── 1. Radio Group (wrapper: input + label + supporting text) ─── */

.radio-group {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-md, 8px);
  padding: var(--spacing-xs, 4px);
  cursor: pointer;
}

.radio-group.radio-disabled {
  cursor: not-allowed;
}


/* ─── 2. Radio Input Wrapper (contains hidden input + visual circle) ─── */

.radio-input {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  /* md size defaults */
  width: 20px;
  height: 20px;
  /* align with first line of label text */
  margin-top: var(--spacing-xxs, 2px);
}


/* ─── 3. Hidden Native Input ─── */

.radio-input input[type="radio"] {
  position: absolute;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
}

.radio-disabled .radio-input input[type="radio"] {
  cursor: not-allowed;
}


/* ─── 4. Visual Radio Circle ─── */

.radio-circle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-full, 9999px);
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
}

/* Inner dot — shown on checked state */
.radio-circle::after {
  content: '';
  display: none;
  border-radius: var(--radius-full, 9999px);
  background-color: var(--fg-white, #fff);
  /* md size: 8px dot in 20px circle */
  width: 8px;
  height: 8px;
}


/* ─── 5. Checked State ─── */

.radio-input input:checked ~ .radio-circle {
  background-color: var(--bg-brand-solid);
  border-color: var(--bg-brand-solid);
}

.radio-input input:checked ~ .radio-circle::after {
  display: block;
}


/* ─── 6. Hover State ─── */

.radio-group:hover:not(.radio-disabled) .radio-input input:not(:checked) ~ .radio-circle {
  border-color: var(--border-brand);
  background-color: var(--bg-primary);
}

.radio-group:hover:not(.radio-disabled) .radio-input input:checked ~ .radio-circle {
  background-color: var(--bg-brand-solid_hover);
  border-color: var(--bg-brand-solid_hover);
}


/* ─── 7. Focused State ─── */

.radio-input input:focus-visible ~ .radio-circle,
.radio-group.radio-focused .radio-circle {
  box-shadow: 0 0 0 1px var(--bg-primary), 0 0 0 3px var(--focus-ring, #92acf7);
}


/* ─── 8. Disabled State ─── */

.radio-disabled .radio-circle {
  background-color: var(--bg-disabled_subtle, #fcfcfd);
  border-color: var(--border-disabled);
}

.radio-disabled .radio-input input:checked ~ .radio-circle {
  background-color: var(--bg-disabled_subtle, #fcfcfd);
  border-color: var(--border-disabled);
}

.radio-disabled .radio-input input:checked ~ .radio-circle::after {
  background-color: var(--fg-disabled_subtle, #d0d5dd);
}

.radio-disabled .radio-input input {
  pointer-events: none;
}


/* ─── 9. Size: sm (16px) ─── */

.radio-sm .radio-input {
  width: 16px;
  height: 16px;
}

/* sm inner dot: 6px in 16px circle */
.radio-sm .radio-circle::after {
  width: 6px;
  height: 6px;
}


/* ─── 10. Label & Supporting Text ─── */

.radio-text {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}

.radio-label {
  font-family: var(--font-primary);
  font-weight: var(--font-weight-medium);
  /* md defaults */
  font-size: var(--font-size-md);
  line-height: var(--line-height-md);
  color: var(--text-primary);
}

.radio-supporting-text {
  font-family: var(--font-primary);
  font-weight: var(--font-weight-regular);
  /* md defaults */
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
  color: var(--text-quaternary-500, #85888e);
}

/* sm text sizes */
.radio-sm .radio-label {
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
}

.radio-sm .radio-supporting-text {
  font-size: var(--font-size-xs);
  line-height: var(--line-height-xs);
}

/* Disabled text */
.radio-disabled .radio-label {
  color: var(--text-disabled);
}

.radio-disabled .radio-supporting-text {
  color: var(--text-disabled);
}


/* ─── 11. Demo State Classes (pointer-events: none for showcase) ─── */

.radio-group.radio-focused {
  pointer-events: none;
}


/* ─── 12. Documentation Display Styles ─── */

.radio-demo-row {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.radio-states-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  margin: 24px 0;
}

.radio-state-card {
  display: flex;
  flex-direction: column;
  padding: 24px;
  background-color: var(--bg-secondary);
  border-radius: 8px;
}

.radio-state-title {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 16px;
  color: var(--text-secondary);
}

.radio-matrix {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  margin: 24px 0;
}

.radio-matrix-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  background-color: var(--bg-secondary);
  border-radius: 8px;
}

.radio-matrix-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
}
