/* ============================================================
   tcsavebar.css — Universal floating "Unsaved changes" save bar.
   Activated on any <form> by adding `data-save-bar` attribute.
   JS at /js/tcsavebar.js owns the show/hide + form serialization.
   ============================================================ */

.tc-save-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  opacity: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 10px 10px 20px;
  background: #1a1a2e;
  color: #fff;
  border-radius: 7px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.22), 0 4px 12px rgba(0, 0, 0, 0.12);
  z-index: 1100;
  /* Slide-up + fade-in. cubic-bezier gives a small overshoot for "spring". */
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.18s ease;
  font-family: var(--tc-font, 'Poppins', sans-serif);
  font-size: 14px;
  letter-spacing: -0.2px;
  max-width: calc(100vw - 24px);
}

.tc-save-bar.is-dirty {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.tc-save-bar-text {
  font-weight: 500;
  font-size: 12px;
  white-space: nowrap;
}

.tc-save-bar-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.tc-save-bar-btn {
  /* "Small" variant — matches the tc-btn-sm sizing used elsewhere. */
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 400;
  font-family: inherit;
  letter-spacing: -0.2px;
  border-radius: 7px;
  cursor: pointer;
  border: none;
  transition: background-color 0.12s ease, color 0.12s ease;
  white-space: nowrap;
}

.tc-save-bar-cancel {
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
}
.tc-save-bar-cancel:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.10);
}

.tc-save-bar-save {
  background: var(--tc-success, #22c55e);
  color: #fff;
}
.tc-save-bar-save:hover {
  background: #16a34a;
}
.tc-save-bar-save:disabled,
.tc-save-bar-save.is-saving {
  opacity: 0.7;
  cursor: progress;
}

/* Mobile: full-width pill with side margins; slide up from the bottom.
   Offset by the fixed bottom-nav height so the bar isn't hidden behind it.
   --tc-bn-h is set by tcbottomnavv2.css; fallback 58px if the bottom nav
   isn't on the page. Plus safe-area-inset-bottom for notched phones. [W4] */
@media (max-width: 767px) {
  .tc-save-bar {
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
    transform: translateX(0) translateY(120%);
    bottom: calc(var(--tc-bn-h, 58px) + env(safe-area-inset-bottom, 0px) + 12px);
    padding: 8px 8px 8px 16px;
    gap: 10px;
  }
  .tc-save-bar.is-dirty {
    transform: translateX(0) translateY(0);
  }
  .tc-save-bar-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13px;
  }
  .tc-save-bar-btn {
    padding: 8px 12px;
    font-size: 12px;
  }
}
