/* Formatter widget styles. Mirrors feedback-widget's dark aesthetic.
   tk-fm-* mirrors tk-fb-*. */

.tk-formatter-rail-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 0 5px;
  margin: 0 -4px 4px;
  border-radius: 6px;
  border: none;
  background: rgba(212, 39, 24, 0.10);
  color: #F5F5F5;
  text-decoration: none;
  overflow: visible;
  cursor: pointer;
  font: inherit;
  transition: background 120ms ease, transform 120ms ease;
}
.tk-formatter-rail-btn:hover { background: rgba(212, 39, 24, 0.22); transform: translateY(-1px); }
.tk-formatter-rail-btn:focus-visible { outline: 2px solid #D42718; outline-offset: 2px; }
.tk-formatter-rail-btn .tk-formatter-label {
  display: block;
  font: 700 10px/1 "Roboto Condensed", "Roboto", system-ui, sans-serif;
  font-stretch: 90%;
  letter-spacing: 0.2px;
  text-transform: uppercase;
  text-align: center;
  color: #F5F5F5;
  white-space: nowrap;
  transform: scaleX(0.95);
  transform-origin: center;
}
.tk-formatter-rail-btn svg { flex-shrink: 0; color: #D42718; width: 18px; height: 18px; }

#tk-formatter-modal {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: center; justify-content: center;
}
.tk-fm-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
}
.tk-fm-dialog {
  position: relative;
  background: var(--surface-primary, #202123);
  color: var(--text-primary, #ececf1);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 28px 32px;
  width: min(720px, calc(100% - 32px));
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  font-family: var(--font-sans, system-ui, sans-serif);
}
.tk-fm-dialog h2 { margin: 0 0 4px; font-size: 20px; font-weight: 600; }
.tk-fm-subtitle { margin: 0 0 20px; opacity: 0.7; font-size: 13px; }

.tk-fm-section {
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.tk-fm-section:last-of-type { border-bottom: none; padding-bottom: 6px; margin-bottom: 14px; }
.tk-fm-section-title {
  margin: 0 0 12px;
  font-size: 13px; font-weight: 600;
  letter-spacing: 0.02em; text-transform: uppercase;
  opacity: 0.85;
}
.tk-fm-section-hint {
  font-weight: 400; text-transform: none;
  opacity: 0.6; font-size: 12px;
  letter-spacing: 0; margin-left: 6px;
}

.tk-fm-field { display: block; margin-bottom: 12px; font-size: 12px; font-weight: 500; opacity: 0.85; }
.tk-fm-field > span {
  display: block; margin-bottom: 6px;
  letter-spacing: 0.02em; text-transform: uppercase;
}

.tk-fm-dialog input[type="text"],
.tk-fm-dialog input[type="date"],
.tk-fm-dialog textarea {
  width: 100%; box-sizing: border-box;
  background: var(--surface-secondary, #2a2b32);
  color: inherit;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit; font-size: 14px; font-weight: 400;
}
.tk-fm-dialog textarea {
  resize: vertical; min-height: 180px;
  font-family: var(--font-mono, ui-monospace, "SFMono-Regular", Menlo, monospace);
  font-size: 13px; line-height: 1.5;
}
.tk-fm-dialog input:focus,
.tk-fm-dialog textarea:focus {
  outline: none;
  border-color: var(--brand-purple, #c8102e);
  box-shadow: 0 0 0 2px rgba(200, 16, 46, 0.25);
}

.tk-fm-or { font-size: 12px; opacity: 0.65; margin: 10px 0 8px; text-align: center; letter-spacing: 0.02em; }

.tk-fm-row { display: flex; gap: 12px; }
.tk-fm-row .tk-fm-field { flex: 1; margin-bottom: 12px; }

.tk-fm-file-input { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.tk-fm-file-button {
  display: inline-flex; align-items: center;
  padding: 7px 14px;
  background: var(--surface-secondary, #2a2b32);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  font-size: 13px; color: inherit; white-space: nowrap;
  transition: background 120ms ease, border-color 120ms ease;
}
.tk-fm-file-input:hover .tk-fm-file-button {
  background: var(--surface-tertiary, #353740);
  border-color: rgba(255, 255, 255, 0.2);
}
.tk-fm-file-name { font-size: 12px; opacity: 0.65; word-break: break-all; }

.tk-fm-help { margin: 8px 0 0; font-size: 12px; opacity: 0.55; line-height: 1.5; }

.tk-fm-disabled-section { opacity: 0.45; pointer-events: none; }

.tk-fm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.tk-fm-actions button {
  padding: 9px 18px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--surface-secondary, #2a2b32);
  color: inherit;
  cursor: pointer;
  font: inherit; font-size: 13px;
  display: inline-flex; align-items: center; gap: 8px;
}
.tk-fm-actions .tk-fm-primary {
  background: var(--brand-purple, #c8102e);
  border-color: transparent;
  color: white; font-weight: 500;
}
.tk-fm-actions .tk-fm-primary:hover:not(:disabled) { filter: brightness(1.1); }
.tk-fm-actions .tk-fm-primary:disabled { opacity: 0.45; cursor: not-allowed; }
.tk-fm-actions .tk-fm-secondary:hover { background: var(--surface-tertiary, #353740); }

.tk-fm-status {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--surface-secondary, #2a2b32);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 13px;
}
.tk-fm-status[hidden] { display: none; }
.tk-fm-status-success { background: rgba(46, 160, 67, 0.12); border-color: rgba(46, 160, 67, 0.35); }
.tk-fm-status-error { background: rgba(185, 28, 28, 0.15); border-color: rgba(185, 28, 28, 0.4); }

.tk-fm-progress { display: inline-flex; align-items: center; gap: 10px; opacity: 0.85; }

.tk-fm-error { color: #fecaca; }
.tk-fm-error-detail {
  margin-top: 6px;
  font-family: var(--font-mono, ui-monospace, "SFMono-Regular", Menlo, monospace);
  font-size: 12px;
  background: rgba(0, 0, 0, 0.35);
  padding: 8px 10px;
  border-radius: 6px;
  white-space: pre-wrap; word-break: break-word;
  user-select: text;
}

.tk-fm-download {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px;
  background: rgba(46, 160, 67, 0.18);
  border: 1px solid rgba(46, 160, 67, 0.5);
  color: #d6f5dd;
  border-radius: 8px;
  font-size: 13px; font-weight: 500;
  text-decoration: none;
  transition: background 120ms ease, transform 120ms ease;
}
.tk-fm-download:hover { background: rgba(46, 160, 67, 0.28); transform: translateY(-1px); }

.tk-fm-spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: tk-fm-spin 700ms linear infinite;
  flex-shrink: 0;
}
@keyframes tk-fm-spin { to { transform: rotate(360deg); } }
