/* ── Shared UI Components ──────────────────────────────────
   Canonical implementations extracted from per-page inline CSS.
   Import via <link rel="stylesheet" href="/css/components.css">
   Page-specific overrides can still be defined in inline <style>.
   ──────────────────────────────────────────────────────────── */

/* ── Spinner (inline button) ── */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  vertical-align: middle;
  margin-right: 5px;
}

/* ── Spinner (page-level loading) ── */
.spinner-lg {
  display: block;
  width: 36px;
  height: 36px;
  border: 3px solid #e4e4e4;
  border-top-color: var(--accent, var(--brand-primary, #6366f1));
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast animations ── */
@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes toastOut {
  from { opacity: 1; }
  to   { opacity: 0; transform: translateY(-6px); }
}

/* ── Skip link ── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--brand-primary, #1a1a2e);
  color: #fff;
  padding: 10px 20px;
  border-radius: 0 0 8px 8px;
  z-index: 9999;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: top .2s;
}
.skip-link:focus { top: 0; }

/* ── Powered footer ── */
.powered-footer,
.powered-footer-line {
  display: block;
  text-align: center;
  padding: 16px;
  font-size: 11px;
  color: #767676;
}

/* ── Feedback widget ── */
#feedback-btn {
  position: fixed;
  bottom: 80px;
  right: 20px;
  z-index: 500;
  background: var(--brand-primary, var(--accent, #6366f1));
  color: #fff;
  border: none;
  border-radius: 24px;
  padding: 9px 16px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
  font-family: inherit;
  transition: background .15s, transform .15s;
}
#feedback-btn:hover {
  background: var(--brand-primary-dark, #6b1212);
  transform: translateY(-1px);
}
#feedback-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 9000;
  align-items: flex-end;
  justify-content: center;
  padding: 0 0 80px;
}
#feedback-overlay.open { display: flex; }
#feedback-modal {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
#feedback-modal h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 10px;
}
#feedback-modal textarea {
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  min-height: 80px;
}
#feedback-modal textarea:focus {
  outline: none;
  border-color: var(--brand-primary, var(--accent, #6366f1));
}
.feedback-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.feedback-actions button {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.feedback-submit {
  background: var(--brand-primary, var(--accent, #6366f1));
  color: #fff;
}
.feedback-cancel {
  background: #f0f0f0;
  color: #444;
}

/* ── Feedback dark mode ── */
@media (prefers-color-scheme: dark) {
  #feedback-modal { background: #2a2a2a; color: #e0e0e0; }
  #feedback-modal textarea { background: #333; border-color: #444; color: #e0e0e0; }
  .feedback-cancel { background: #3a3a3a !important; color: #ccc !important; }
  .powered-footer, .powered-footer-line { color: #666; }
  .spinner-lg { border-color: #333; border-top-color: var(--accent, var(--brand-primary, #6366f1)); }
}

/* ── Feedback print hide ── */
@media print {
  #feedback-btn, #feedback-overlay { display: none !important; }
  .powered-footer, .powered-footer-line { color: #737373; }
}

/* ── Screen reader only ── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .spinner, .spinner-lg { animation: none; }
}
