/* ============================================================
   AMHASS Feedback widget — FAB, modal, inline, toast
   Reuses dashboard CSS vars: --brand, --text, --line, --shadow-lg
   ============================================================ */

/* Floating Action Button */
.amf-fab{
  position:fixed;right:22px;bottom:22px;z-index:9998;
  background:var(--brand, #1e5ea8);color:#fff;border:0;border-radius:999px;
  padding:12px 18px;font-size:13.5px;font-weight:600;font-family:inherit;
  box-shadow:0 6px 18px rgba(15,23,42,.18),0 2px 6px rgba(15,23,42,.12);
  cursor:pointer;display:inline-flex;align-items:center;gap:8px;
  transition:transform .15s, box-shadow .15s, background .15s
}
.amf-fab:hover{background:var(--brand-dark, #164a86);transform:translateY(-1px);
  box-shadow:0 10px 24px rgba(15,23,42,.22),0 3px 8px rgba(15,23,42,.14)}
.amf-fab:focus-visible{outline:3px solid rgba(30,94,168,.4);outline-offset:2px}
.amf-fab .amf-fab-ic{font-size:16px;line-height:1}

/* Modal backdrop + dialog */
.amf-backdrop{
  position:fixed;inset:0;z-index:9999;background:rgba(15,23,42,.55);
  display:none;align-items:flex-start;justify-content:center;
  padding:48px 16px 16px;overflow-y:auto
}
.amf-backdrop.amf-open{display:flex}
.amf-modal{
  background:var(--surface, #fff);border-radius:14px;width:100%;max-width:520px;
  box-shadow:0 20px 60px rgba(15,23,42,.35);overflow:hidden;
  display:flex;flex-direction:column;max-height:calc(100vh - 64px)
}
.amf-head{padding:18px 22px 12px 22px;border-bottom:1px solid var(--line,#e4e8f0)}
.amf-head h3{margin:0;font-size:17px;font-weight:700;color:var(--text,#1e293b)}
.amf-head p{margin:4px 0 0 0;font-size:13px;color:var(--text-soft,#475569);line-height:1.5}
.amf-body{padding:16px 22px;overflow-y:auto;flex:1}
.amf-foot{padding:12px 22px 18px 22px;display:flex;gap:10px;justify-content:flex-end;
  align-items:center;border-top:1px solid var(--line,#e4e8f0);background:var(--surface-alt,#f9fafc)}
.amf-close{
  background:transparent;border:0;cursor:pointer;color:var(--muted,#64748b);
  font-size:20px;padding:4px 8px;line-height:1;border-radius:6px
}
.amf-close:hover{background:var(--surface-alt,#f9fafc);color:var(--text,#1e293b)}
.amf-head-row{display:flex;justify-content:space-between;align-items:flex-start;gap:12px}

/* Form fields */
.amf-field{margin-bottom:14px}
.amf-field:last-child{margin-bottom:0}
.amf-field label{display:block;font-size:11.5px;color:var(--text-soft,#475569);
  font-weight:600;margin-bottom:6px;text-transform:uppercase;letter-spacing:.5px}
.amf-field .amf-opt{font-size:10.5px;color:var(--muted,#64748b);
  font-weight:500;text-transform:none;letter-spacing:0;margin-left:4px}
.amf-field input[type="text"],
.amf-field input[type="email"],
.amf-field select,
.amf-field textarea{
  width:100%;padding:9px 12px;border:1px solid var(--line,#e4e8f0);border-radius:8px;
  font-size:14px;background:var(--surface,#fff);color:var(--text,#1e293b);
  font-family:inherit;line-height:1.5
}
.amf-field textarea{min-height:96px;resize:vertical}
.amf-field input:focus,.amf-field select:focus,.amf-field textarea:focus{
  outline:2px solid rgba(30,94,168,.2);border-color:var(--brand,#1e5ea8)
}
.amf-field .amf-hint{font-size:11.5px;color:var(--muted,#64748b);margin-top:6px;line-height:1.45}

/* Star rating */
.amf-stars{display:inline-flex;gap:2px}
.amf-star{
  background:transparent;border:0;cursor:pointer;padding:4px 2px;
  font-size:24px;color:#d1d5db;line-height:1;transition:color .1s
}
.amf-star:hover,.amf-star.amf-active{color:#fbbf24}
.amf-star:focus-visible{outline:2px solid rgba(30,94,168,.4);outline-offset:1px;border-radius:4px}
.amf-rating-row{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.amf-rating-label{font-size:12px;color:var(--text-soft,#475569);min-width:56px}

/* Buttons (reuse dashboard convention) */
.amf-btn{
  padding:9px 16px;border-radius:8px;border:0;font-size:13.5px;font-weight:600;
  cursor:pointer;font-family:inherit;transition:background .15s,color .15s
}
.amf-btn.amf-primary{background:var(--brand,#1e5ea8);color:#fff}
.amf-btn.amf-primary:hover{background:var(--brand-dark,#164a86)}
.amf-btn.amf-primary:disabled{background:#cbd5e1;cursor:not-allowed}
.amf-btn.amf-ghost{background:transparent;color:var(--muted,#64748b)}
.amf-btn.amf-ghost:hover{color:var(--text,#1e293b);background:var(--surface-alt,#f9fafc)}

/* Honeypot — hidden from humans, visible to bots */
.amf-hp{position:absolute;left:-9999px;width:1px;height:1px;opacity:0}

/* Inline per-chapter block */
.amf-inline{
  margin-top:28px;padding:18px 20px;background:var(--surface,#fff);
  border:1px solid var(--line,#e4e8f0);border-radius:12px;
  box-shadow:var(--shadow,0 1px 2px rgba(15,23,42,.04),0 1px 3px rgba(15,23,42,.06))
}
.amf-inline h4{margin:0 0 4px 0;font-size:14.5px;font-weight:700;color:var(--text,#1e293b);
  display:flex;align-items:center;gap:8px}
.amf-inline h4 .amf-inline-ic{font-size:16px}
.amf-inline .amf-inline-sub{margin:0 0 12px 0;font-size:12.5px;color:var(--text-soft,#475569);line-height:1.5}
.amf-inline-actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin-top:10px}
.amf-inline textarea{
  width:100%;padding:10px 12px;border:1px solid var(--line,#e4e8f0);border-radius:8px;
  font-size:13.5px;font-family:inherit;min-height:72px;resize:vertical;line-height:1.5;
  background:var(--surface-alt,#f9fafc)
}
.amf-inline textarea:focus{
  outline:2px solid rgba(30,94,168,.2);border-color:var(--brand,#1e5ea8);
  background:var(--surface,#fff)
}

/* Thumb buttons (inline quick rating) */
.amf-thumbs{display:inline-flex;gap:6px}
.amf-thumb{
  background:var(--surface-alt,#f9fafc);border:1px solid var(--line,#e4e8f0);
  border-radius:8px;padding:6px 12px;cursor:pointer;font-size:15px;line-height:1;
  transition:all .15s;font-family:inherit
}
.amf-thumb:hover{background:var(--brand-soft,#e9f1fb);border-color:var(--brand,#1e5ea8)}
.amf-thumb.amf-active{background:var(--brand-soft,#e9f1fb);border-color:var(--brand,#1e5ea8);
  color:var(--brand-dark,#164a86)}

/* Toast */
.amf-toast{
  position:fixed;bottom:22px;left:50%;transform:translateX(-50%) translateY(80px);
  z-index:10000;background:#1e293b;color:#fff;padding:12px 20px;border-radius:10px;
  font-size:13.5px;font-weight:500;box-shadow:0 12px 32px rgba(15,23,42,.28);
  opacity:0;transition:opacity .25s, transform .25s;pointer-events:none;
  display:inline-flex;align-items:center;gap:10px;max-width:calc(100vw - 32px)
}
.amf-toast.amf-toast-show{opacity:1;transform:translateX(-50%) translateY(0);pointer-events:auto}
.amf-toast.amf-toast-err{background:#991b1b}
.amf-toast.amf-toast-ok{background:#065f46}
.amf-toast .amf-toast-ic{font-size:15px;line-height:1}

/* Small screens */
@media(max-width:480px){
  .amf-fab{right:14px;bottom:14px;padding:10px 14px;font-size:13px}
  .amf-fab .amf-fab-txt{display:none}
  .amf-fab .amf-fab-ic{font-size:18px}
  .amf-modal{border-radius:12px}
  .amf-head,.amf-body,.amf-foot{padding-left:16px;padding-right:16px}
}

/* Honor reduced motion */
@media(prefers-reduced-motion:reduce){
  .amf-fab,.amf-btn,.amf-toast{transition:none}
}
