/*
 * Toolbox Pro unified modal pattern.
 *
 * Decision (2026-05-12 parity audit): web surfaces use a centered modal
 * with backdrop blur; mobile (RN) uses platform-native full-screen
 * <Modal>. Web variant is defined here.
 *
 * Usage:
 *   <div class="tbp-modal-backdrop" data-tbp-modal-open id="my-modal">
 *     <div class="tbp-modal" role="dialog" aria-modal="true" aria-labelledby="my-modal-title">
 *       <div class="tbp-modal-head">
 *         <h2 id="my-modal-title">Title</h2>
 *         <button class="tbp-modal-close" aria-label="Close">✕</button>
 *       </div>
 *       <div class="tbp-modal-body">…content…</div>
 *     </div>
 *   </div>
 *
 * Open: add `data-tbp-modal-open` attr OR style.display = 'flex'.
 * Close: backdrop click, ✕ button click, Esc key — all handled by the
 *        modal_init.js partial.
 */

.tbp-modal-backdrop {
  display: none;                          /* hidden until opened */
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  z-index: 1000;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 16px 16px;
  overflow-y: auto;
}
.tbp-modal-backdrop[data-tbp-modal-open],
.tbp-modal-backdrop.open {
  display: flex;
}

.tbp-modal {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  width: min(720px, 100%);
  max-width: 100%;
  max-height: calc(100vh - 16vh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: tbpModalIn 0.18s ease-out;
}
@keyframes tbpModalIn {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0);   opacity: 1; }
}

.tbp-modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid #e2e8f0;
}
.tbp-modal-head h1,
.tbp-modal-head h2,
.tbp-modal-head h3 {
  margin: 0;
  flex: 1;
  font-size: 1.05rem;
  line-height: 1.3;
  color: #0f172a;
}

.tbp-modal-close {
  background: none;
  border: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.1rem;
  color: #64748b;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}
.tbp-modal-close:hover,
.tbp-modal-close:focus-visible {
  background: #f1f5f9;
  color: #0f172a;
  outline: none;
}

.tbp-modal-body {
  padding: 16px 18px;
  overflow-y: auto;
  flex: 1;
}

.tbp-modal-foot {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 18px;
  border-top: 1px solid #e2e8f0;
  background: #fafbfc;
}

/* Small phone breakpoint — full-width sheet that slides from bottom. */
@media (max-width: 540px) {
  .tbp-modal-backdrop { padding: 0; align-items: flex-end; }
  .tbp-modal {
    width: 100%;
    max-height: 92vh;
    border-radius: 14px 14px 0 0;
    animation: tbpModalSheetIn 0.22s ease-out;
  }
  @keyframes tbpModalSheetIn {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }
}
