/* ============================================================
   anonymity-modal.css
   Shared chrome for the SSO-aware anonymity assurance modal
   and the inline trigger badge/chip used across all surveys.
   ES5/jQuery-friendly. No build step.
   ============================================================ */

/* ---------- Inline trigger link ---------- */
.ts-anon-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  color: #2563eb;
  text-decoration: none;
  cursor: pointer;
  margin-left: 6px;
  font-size: 0.92em;
  white-space: nowrap;
  padding: 4px 0; /* ensures ≥36px touch target on mobile */
}
.ts-anon-link:hover { text-decoration: underline; color: #1d4ed8; }

/* ---------- Inline strip (My Surveys, login, etc.) ---------- */
.ts-anon-strip {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: linear-gradient(90deg, rgba(143,235,213,.18), rgba(55,114,255,.10));
  border: 1px solid rgba(55,114,255,.22);
  border-radius: 10px;
  font-size: 14px; color: #0f172a;
  margin: 12px 0;
}
.ts-anon-strip .ts-anon-strip-icon { font-size: 18px; color: #2563eb; }
.ts-anon-strip strong { color: #0f172a; }

/* PEval identity-forward chip */
.ts-idfwd-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: #92400e;
  font-size: 13px; font-weight: 600;
}
.ts-idfwd-chip .bi { color: #b45309; }
.ts-idfwd-chip .ts-anon-link { color: #b45309; }
.ts-idfwd-chip .ts-anon-link:hover { color: #78350f; }

/* ---------- Modal ---------- */
.ts-anon-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 99998;
  display: none;
}
.ts-anon-overlay.is-open { display: block; }

.ts-anon-modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(640px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 24px 60px -12px rgba(0,0,0,0.35);
  z-index: 99999;
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: #0f172a;
}
.ts-anon-modal.is-open { display: flex; }

/* Mobile grabber (only visible on small screens; static markup is fine on desktop) */
.ts-anon-grabber { display: none; }

.ts-anon-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(135deg, #8FEBD5 0%, #3772FF 100%);
  color: #fff;
  cursor: move;
  user-select: none;
}
.ts-anon-modal-header.is-peval {
  background: linear-gradient(135deg, #f59e0b 0%, #b45309 100%);
}
.ts-anon-modal-header h3 {
  margin: 0; font-size: 17px; font-weight: 700;
  display: flex; align-items: center; gap: 10px;
}
.ts-anon-modal-close {
  background: rgba(255,255,255,0.18);
  border: none; color: #fff;
  width: 30px; height: 30px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.ts-anon-modal-close:hover { background: rgba(255,255,255,0.32); }

.ts-anon-modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.55;
  flex: 1 1 auto;
}
.ts-anon-modal-body h4 {
  margin: 18px 0 6px; font-size: 14px; font-weight: 700; color: #0f172a;
}
.ts-anon-modal-body h4:first-child { margin-top: 0; }
.ts-anon-modal-body ul { padding-left: 20px; margin: 6px 0 12px; }
.ts-anon-modal-body li { margin-bottom: 4px; }
.ts-anon-modal-body table {
  width: 100%; border-collapse: collapse; margin: 8px 0 14px;
  font-size: 13px;
}
.ts-anon-modal-body th, .ts-anon-modal-body td {
  border: 1px solid #e2e8f0; padding: 8px 10px; text-align: left; vertical-align: top;
}
.ts-anon-modal-body th { background: #f8fafc; font-weight: 600; }
.ts-anon-modal-body .ts-anon-callout {
  background: #f0fdf4; border-left: 3px solid #16a34a;
  padding: 10px 12px; border-radius: 6px; margin: 10px 0;
}
.ts-anon-modal-body .ts-anon-warn {
  background: #fef3c7; border-left: 3px solid #f59e0b;
  padding: 10px 12px; border-radius: 6px; margin: 10px 0;
}
.ts-anon-modal-footer {
  padding: 12px 20px;
  border-top: 1px solid #e2e8f0;
  display: flex; justify-content: flex-end; gap: 10px;
  background: #f8fafc;
}
.ts-anon-modal-footer .ts-btn {
  padding: 8px 16px; border-radius: 8px;
  border: 1px solid transparent; font-weight: 600; cursor: pointer; font-size: 13px;
}
.ts-anon-modal-footer .ts-btn-primary {
  background: #2563eb; color: #fff;
}
.ts-anon-modal-footer .ts-btn-primary:hover { background: #1d4ed8; }

/* ---------- Mobile bottom-sheet (≤600px) ---------- */
@media (max-width: 600px) {
  .ts-anon-overlay.is-open { background: rgba(15,23,42,0.6); }

  .ts-anon-modal {
    width: 100vw;
    max-width: 100vw;
    max-height: 92vh;
    max-height: 92dvh;
    height: 92vh;
    height: 92dvh;
    top: auto;
    bottom: 0;
    left: 0;
    transform: none !important;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.35);
    animation: tsAnonSlideUp 220ms ease-out;
  }
  .ts-anon-grabber {
    display: none;
  }
  .ts-anon-modal-header {
    padding: 10px 14px;
    cursor: default;
    flex: 0 0 auto;
  }
  .ts-anon-modal-header h3 {
    font-size: 15px;
    line-height: 1.25;
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
  }
  .ts-anon-modal-header h3 [data-anon-title] {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    max-width: 100%;
    vertical-align: bottom;
  }
  .ts-anon-modal-close {
    width: 40px; height: 40px; font-size: 18px;
    flex: 0 0 auto;
  }
  .ts-anon-modal-body {
    padding: 14px 16px 20px;
    font-size: 13.5px;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
    flex: 1 1 auto;
  }
  .ts-anon-modal-body table {
    display: block;
    overflow-x: auto;
    white-space: normal;
  }
  .ts-anon-modal-body th, .ts-anon-modal-body td {
    font-size: 12.5px; padding: 6px 8px;
  }
  .ts-anon-modal-footer {
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    flex: 0 0 auto;
  }
  .ts-anon-modal-footer .ts-btn-primary {
    width: 100%;
    padding: 12px 16px;
    min-height: 44px;
    font-size: 14px;
    border-radius: 10px;
  }
}
@keyframes tsAnonSlideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

/* ---------- Strip / chip wrapping at very narrow widths ---------- */
@media (max-width: 380px) {
  .ts-anon-strip { flex-wrap: wrap; font-size: 13px; padding: 10px 12px; }
  .ts-anon-strip .ts-anon-link { margin-left: 0; }
  .ts-idfwd-chip { flex-wrap: wrap; font-size: 12.5px; padding: 8px 10px; border-radius: 14px; }
  .ts-anon-modal-header h3 { font-size: 14px; }
  .ts-anon-modal-body { padding: 12px 14px 16px; }
}