/* =========================================================
   Flashcard Maker — widget-body styles only.
   Layered on /tools/_shared/tool.css. The print credit uses the
   shared .print-credit component.
   ========================================================= */

.fc-controls { display: flex; flex-direction: column; gap: var(--space-5); }

.fc-field label,
.fc-legend {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.fc-field textarea,
.fc-add input[type="text"] {
  width: 100%;
  font: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--surface-inset);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.fc-field textarea { min-height: 150px; resize: vertical; line-height: 1.5; }
.fc-field textarea:focus,
.fc-add input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.fc-hint { font-size: 13px; color: var(--text-secondary); margin: 6px 0 0; }

.fc-status {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-4);
  align-items: center;
  margin-top: 8px;
}
.fc-skipped { font-size: 13px; color: var(--text-secondary); margin: 0; }

.fc-add {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: var(--space-3);
  align-items: end;
}
.fc-add label { margin-bottom: 4px; }

.fc-options { display: flex; flex-wrap: wrap; gap: var(--space-5); align-items: flex-end; }
.fc-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.fc-seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; }
.fc-seg label {
  position: relative;
  margin: 0;
  padding: 8px 16px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-secondary);
  background: var(--surface-inset);
}
.fc-seg input { position: absolute; opacity: 0; pointer-events: none; }
.fc-seg label:has(input:checked) { background: var(--accent); color: var(--accent-fg); }
.fc-seg label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }

.fc-toggle { display: inline-flex; gap: 8px; align-items: center; font-size: 14px; cursor: pointer; padding-bottom: 8px; }

.fc-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.fc-copy-note { font-size: 13px; color: var(--text-secondary); margin: 0; }

/* ---------- Preview ---------- */
.fc-preview-wrap { border-top: 1px solid var(--border); padding-top: var(--space-5); margin-top: var(--space-5); }
.fc-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-4);
}
.fc-card,
.fc-study-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  min-height: 110px;
  padding: 12px 14px;
  font: inherit;
  text-align: center;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}
.fc-card:hover { border-color: var(--accent); }
.fc-card:focus-visible,
.fc-study-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fc-card.is-flipped,
.fc-study-card.is-flipped { background: var(--accent-soft-bg); border-color: var(--accent); }
.fc-card-side {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}
.fc-card-text { font-size: 16px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.fc-preview-note { font-size: 13px; color: var(--text-secondary); margin: var(--space-3) 0 0; }

/* ---------- Study mode ---------- */
.fc-study-panel { margin-top: var(--space-5); display: flex; flex-direction: column; gap: var(--space-4); align-items: stretch; }
.fc-study-card { min-height: 180px; justify-content: center; }
.fc-study-card .fc-card-text { font-size: 22px; }
.fc-study-bar { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.fc-study-pos { margin-left: auto; font-size: 13px; color: var(--text-secondary); }

/* ---------- Print sheets (hidden on screen) ---------- */
.fc-print { display: none; }

@media (max-width: 520px) {
  .fc-add { grid-template-columns: 1fr; }
  .fc-add .btn { width: 100%; }
}

@media print {
  @page { size: 8.5in 11in; margin: 0.5in; }
  html, body { background: #FFFFFF !important; color: #000 !important; margin: 0 !important; padding: 0 !important; }
  .tool-header,
  .tool-footer,
  .article,
  .skip-link,
  .widget-card,
  .pensara-inline,
  .toast { display: none !important; }
  main { display: block !important; }
  .widget-wrap { margin: 0 !important; padding: 0 !important; max-width: none !important; width: 100% !important; background: #FFFFFF !important; }
  .fc-print { display: block !important; }

  .fc-sheet {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    height: 9.4in;
    border-top: 1px dashed #777;
    border-left: 1px dashed #777;
    break-after: page;
    page-break-after: always;
    box-sizing: border-box;
  }
  #fc-sheets[data-rows="3"] .fc-sheet { grid-template-rows: repeat(3, 1fr); }
  #fc-sheets[data-rows="4"] .fc-sheet { grid-template-rows: repeat(4, 1fr); }
  #fc-sheets[data-rows="5"] .fc-sheet { grid-template-rows: repeat(5, 1fr); }
  .fc-sheet:last-child { break-after: auto; page-break-after: auto; }

  .fc-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.2in;
    border-right: 1px dashed #777;
    border-bottom: 1px dashed #777;
    overflow: hidden;
    text-align: center;
    color: #000;
    background: #FFFFFF;
    font-family: var(--font-sans);
    box-sizing: border-box;
  }
  .fc-cell.is-empty { border-color: transparent; }
  .fc-cell-text { font-size: 24pt; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
  .fc-cell-text.fc-len-l { font-size: 17pt; }
  .fc-cell-text.fc-len-xl { font-size: 12pt; font-weight: 500; }
  .print-credit { margin-top: 0.1in; }
}
