/* ============================================================
   UDYOT · COMMON · COMPONENTS

   Buttons, form controls, counters, hints, the required marker, the
   status pills and the screen-reader-only utility. Reusable as-is by
   any feature; a feature styles its own parts around them.
   ============================================================ */

/* Visible to assistive tech, invisible on screen. */
.udyot_plugin_sr {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.udyot_plugin_btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--udyot-plugin-font-display);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.812rem 1.75rem;
  border-radius: var(--udyot-plugin-r-sm);
  transition: all 0.2s ease;
  white-space: nowrap;
  cursor: pointer;
  letter-spacing: -0.01em;
}

.udyot_plugin_btn_primary {
  background: var(--udyot-plugin-blue);
  color: var(--udyot-plugin-white);
  box-shadow: var(--udyot-plugin-shadow-blue);
}

.udyot_plugin_btn_primary:hover {
  background: var(--udyot-plugin-blue-light);
  transform: translateY(-1px);
  box-shadow: 0 12px 40px rgba(27, 79, 216, 0.36);
}

.udyot_plugin_btn_secondary {
  background: var(--udyot-plugin-white);
  color: var(--udyot-plugin-ink);
  border: 2px solid var(--udyot-plugin-mist-2);
  box-shadow: var(--udyot-plugin-shadow-sm);
}

.udyot_plugin_btn_secondary:hover {
  border-color: var(--udyot-plugin-ink-3);
  transform: translateY(-1px);
}

.udyot_plugin_btn_sm {
  padding: 0.562rem 1.25rem;
  font-size: 0.82rem;
}

.udyot_plugin_form_group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  min-width: 0;
}

/* Label row: the name on the left, the character counter on the right, so
   the two never push each other off a narrow box. */
.udyot_plugin_form_head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  min-width: 0;
}

.udyot_plugin_form_label {
  font-family: var(--udyot-plugin-font-display);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--udyot-plugin-ink);
  min-width: 0;
}

/* The required marker. Red, and never a screen-reader announcement in its
   own right — the label carries a visually hidden "required" too. */
.udyot_plugin_req {
  color: var(--udyot-plugin-red);
  font-weight: 700;
  margin-left: 0.1rem;
}

.udyot_plugin_counter {
  flex: 0 0 auto;
  font-family: var(--udyot-plugin-font-mono);
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  color: var(--udyot-plugin-ink-3);
}

.udyot_plugin_counter.udyot_plugin_is_full {
  color: var(--udyot-plugin-red);
  font-weight: 700;
}

.udyot_plugin_hint {
  margin: 0;
  font-size: 0.68rem;
  line-height: 1.4;
  color: var(--udyot-plugin-ink-3);
}

.udyot_plugin_form_control {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--udyot-plugin-mist-2);
  border-radius: var(--udyot-plugin-r-sm);
  font-size: 0.95rem;
  color: var(--udyot-plugin-ink);
  background: var(--udyot-plugin-white);
  transition: border-color 0.2s;
}

.udyot_plugin_form_control:focus {
  border-color: var(--udyot-plugin-blue);
  outline: none;
}

/* Two different rejections, two different classes.
   .udyot_plugin_is_invalid  — a required field left blank by validateRequired()
   .udyot_plugin_is_badvalue — a B.S. date shaped like a date but impossible */
.udyot_plugin_form_control.udyot_plugin_is_invalid,
#udyot_plugin_field_date_bs.udyot_plugin_is_badvalue {
  border-color: var(--udyot-plugin-red);
  background: var(--udyot-plugin-red-pale);
}

.udyot_plugin_form_control::placeholder {
  color: #9ca3af;
}

.udyot_plugin_form_control:disabled {
  cursor: not-allowed;
}

textarea.udyot_plugin_form_control {
  resize: vertical;
  min-height: 8.125rem;
}

/* `hidden` is what keeps the preview view out of sight until the user asks for
   it. Both views stay in the DOM, so going back never loses what was typed. */
[hidden] {
  display: none !important;
}