/* Add / edit word form (#18). Classes prefixed yf- ("yaasalu form"); same palette and font
   as the word and home pages. Full screen on phones, a centred dialog from 576px. */

.yf {
  --yf-text: #1f2328;
  --yf-muted: #656d76;
  --yf-line: #e3e6ea;
  --yf-input: #c9d1d9;
  --yf-soft: #f6f8f7;
  --yf-green: #198754;
  --yf-green-dark: #146c43;
  --yf-green-soft: #e8f3ee;
  --yf-red: #b42318;
  color: var(--yf-text);
  font-family: "Noto Sans Telugu", system-ui, -apple-system, "Segoe UI", sans-serif;
}
/* The site's old ".modal-dialog { width: 1000px }" rule would make this wider than a phone */
.yf-modal .modal-dialog { width: auto; max-width: 560px; }
@media (max-width: 575.98px) { .yf-modal .modal-dialog { width: 100vw; max-width: none; margin: 0; } }
.yf label, .yf .yf-label, .yf .yf-card-title, .yf .yf-check { color: var(--yf-text); }
.yf .yf-sublabel { color: #3d444d; }
.yf-modal .modal-content { border: 0; border-radius: 16px; overflow: hidden; }
@media (max-width: 575.98px) { .yf-modal .modal-content { border-radius: 0; } }
#yf-form { display: flex; flex-direction: column; height: 100%; min-height: 0; }

/* Header: close, title, step and progress */
.yf-head { padding: 0.5rem 0.75rem 0.75rem; border-bottom: 1px solid var(--yf-line); background: #fff; }
.yf-head-row { display: flex; align-items: center; justify-content: space-between; }
.yf-title { margin: 0; font-size: 1.1rem; font-weight: 700; }
.yf-step-count { width: 44px; text-align: right; font-size: 0.8rem; color: var(--yf-muted); }
.yf-progress { height: 4px; margin-top: 0.5rem; border-radius: 4px; background: var(--yf-line); }
.yf-progress-bar { width: 50%; height: 4px; border-radius: 4px; background: var(--yf-green); transition: width 0.2s; }
.yf-icon-btn { width: 44px; height: 44px; border: 0; background: none; color: var(--yf-text); font-size: 1.1rem; }

/* Body and fields */
.yf-body { padding: 1rem; display: flex; flex-direction: column; }
.yf-page { display: flex; flex-direction: column; gap: 1.35rem; }
.yf-page[hidden] { display: none; }
.yf-field { display: flex; flex-direction: column; gap: 0.4rem; }
.yf-label, .yf-card-title { font-size: 0.95rem; font-weight: 600; margin: 0; }
.yf-label-row { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.yf-sublabel { font-size: 0.82rem; color: #3d444d; margin: 0.2rem 0 0; }
.yf-req { color: var(--yf-red); }
.yf-muted { color: var(--yf-muted); font-size: 0.78rem; font-weight: 400; }
.yf-hint { margin: 0; font-size: 0.78rem; color: var(--yf-muted); }
.yf-error { margin: 0; font-size: 0.85rem; color: var(--yf-red); }
.yf-lead { margin: 0; font-size: 0.9rem; color: #3d444d; }
.yf-input {
  width: 100%; border: 1px solid var(--yf-input); border-radius: 10px; padding: 0.6rem 0.85rem;
  font: inherit; font-size: 1rem; color: var(--yf-text); background: #fff;
}
.yf-input:focus { outline: none; border-color: var(--yf-green); box-shadow: 0 0 0 3px rgba(25, 135, 84, 0.15); }
textarea.yf-input { resize: vertical; }
.yf-input-word { font-size: 1.2rem; font-weight: 600; min-height: 50px; }
.yf-select { appearance: auto; min-height: 48px; }
.yf-with-mic { display: flex; gap: 0.5rem; align-items: flex-start; }
.yf-with-mic .yf-input { flex: 1; min-width: 0; }
.yf-mic {
  flex: 0 0 auto; width: 50px; height: 50px; border: 1px solid var(--yf-input); border-radius: 10px;
  background: #fff; color: var(--yf-green-dark); font-size: 1.1rem;
}
.yf-mic.recording { background: var(--yf-red); border-color: var(--yf-red); color: #fff; animation: yf-pulse 1.2s infinite; }
@keyframes yf-pulse { 50% { opacity: 0.6; } }
@media (prefers-reduced-motion: reduce) { .yf-mic.recording { animation: none; } }

/* A recorded clip: play / again / remove */
.yf-clip { display: flex; align-items: center; gap: 0.35rem; font-size: 0.82rem; color: var(--yf-muted); }
.yf-clip[hidden] { display: none; }
.yf-play { width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--yf-green-soft); color: var(--yf-green-dark); }
.yf-clip .yf-icon-btn { width: 36px; height: 36px; color: var(--yf-muted); font-size: 0.9rem; }

/* Notes and the "slang of" question */
.yf-note, .yf-confirm {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  padding: 0.5rem 0.65rem; border-radius: 10px; font-size: 0.82rem;
}
.yf-note[hidden], .yf-confirm[hidden] { display: none; }
.yf-note { background: #fff8e6; border: 1px solid #f0dca8; color: #5c4400; }
.yf-note a { flex: 0 0 auto; font-weight: 600; color: #146c43; }
.yf-confirm { background: var(--yf-soft); border: 1px solid var(--yf-line); color: var(--yf-text); font-size: 0.88rem; }
.yf-pill-btn {
  flex: 0 0 auto; min-height: 36px; padding: 0 0.8rem; border: 1px solid var(--yf-green); border-radius: 999px;
  background: #fff; color: var(--yf-green-dark); font: inherit; font-size: 0.85rem; font-weight: 600;
}
.yf-pill-btn.on { background: var(--yf-green-dark); color: #fff; }

/* Chips */
.yf-chips, .yf-chips-line { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.yf-chips-line { font-size: 0.82rem; color: var(--yf-muted); }
.yf-chips-line[hidden] { display: none; }
.yf-chip { display: inline-flex; align-items: center; gap: 0.1rem; padding: 0.1rem 0.15rem 0.1rem 0.7rem; border-radius: 999px; font-size: 0.88rem; }
.yf-chip button { width: 30px; height: 30px; border: 0; background: none; color: inherit; font-size: 0.75rem; }
.yf-chip-soft { background: var(--yf-green-soft); color: var(--yf-green-dark); }
.yf-chip-solid { background: var(--yf-green-dark); color: #fff; }
.yf-dropdown-chips .yf-chip { padding-right: 0.7rem; }

/* Pickers */
.yf-picker { position: relative; }
.yf-options {
  position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px); max-height: 260px; overflow-y: auto;
  border: 1px solid var(--yf-line); border-radius: 10px; background: #fff; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}
.yf-options[hidden] { display: none; }
.yf-option {
  display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; width: 100%; min-height: 46px;
  padding: 0 0.85rem; border: 0; border-bottom: 1px solid #eef0f2; background: #fff; font: inherit; font-size: 0.95rem; text-align: left;
}
.yf-option:hover, .yf-option:focus { background: var(--yf-soft); }
.yf-option-custom { color: var(--yf-green-dark); background: var(--yf-soft); font-size: 0.88rem; justify-content: flex-start; }

/* Page 2 cards */
.yf-card { display: flex; flex-direction: column; gap: 0.5rem; padding: 0.8rem 0.9rem; border: 1px solid var(--yf-line); border-radius: 12px; }
.yf-card-row { display: flex; justify-content: space-between; align-items: center; }
.yf-dropdown { display: flex; align-items: center; justify-content: space-between; gap: 0.4rem; min-height: 48px; text-align: left; }
.yf-dropdown-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.yf-checklist { max-height: 240px; overflow-y: auto; border: 1px solid var(--yf-line); border-radius: 10px; }
.yf-checklist[hidden] { display: none; }
.yf-check { display: flex; align-items: center; gap: 0.6rem; min-height: 46px; margin: 0; padding: 0 0.8rem; border-bottom: 1px solid #eef0f2; font-size: 0.95rem; }
.yf-check input { width: 20px; height: 20px; accent-color: var(--yf-green-dark); }
.yf-check:has(input:disabled) { color: var(--yf-muted); }

.yf-images { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; }
.yf-image { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--yf-line); }
.yf-image img { width: 100%; height: 100%; object-fit: cover; }
.yf-image button {
  position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; border: 0; border-radius: 50%;
  background: rgba(31, 35, 40, 0.75); color: #fff; font-size: 0.8rem;
}
.yf-image-add {
  aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.25rem;
  border: 1.5px dashed #b7dcc8; border-radius: 10px; background: var(--yf-soft); color: var(--yf-green-dark); font: inherit; font-size: 0.82rem;
}
.yf-image-add[hidden] { display: none; }

.yf-more { border: 1px solid var(--yf-line); border-radius: 12px; padding: 0 0.9rem; }
.yf-more summary { display: flex; flex-direction: column; justify-content: center; min-height: 56px; cursor: pointer; font-weight: 600; list-style: none; }
.yf-more summary::-webkit-details-marker { display: none; }
.yf-more[open] { padding-bottom: 0.9rem; }
.yf-more[open] > *:not(summary) { margin-top: 0.4rem; }

/* Footer buttons */
.yf-foot { padding: 0.75rem 1rem 1rem; border-top: 1px solid var(--yf-line); background: #fff; }
.yf-foot > div { display: flex; flex-direction: column; gap: 0.4rem; }
.yf-foot > div[hidden] { display: none; }
.yf-foot .yf-foot-row { flex-direction: row; gap: 0.6rem; }
.yf-btn { min-height: 48px; border-radius: 12px; font: inherit; font-weight: 700; padding: 0 1.1rem; }
.yf-btn:disabled { opacity: 0.6; }
.yf-btn-primary { flex: 1; border: 0; background: var(--yf-green); color: #fff; font-size: 1.05rem; }
.yf-btn-primary:hover { background: var(--yf-green-dark); }
.yf-btn-secondary { flex: 0 0 auto; border: 1px solid var(--yf-input); background: #fff; color: var(--yf-text); font-weight: 400; }
.yf-btn-link { border: 0; background: none; color: var(--yf-green-dark); font: inherit; font-size: 0.9rem; font-weight: 600; min-height: 40px; }
