/* ==========================================================================
   PII Redaction Site — Minimal White Design
   ========================================================================== */

[hidden] { display: none !important; }

:root {
  --bg: #ffffff;
  --bg-alt: #fafafa;
  --text: #111111;
  --text-muted: #666666;
  --text-faint: #999999;
  --border: #e5e5e5;
  --accent: #111111;
  --accent-hover: #333333;
  --danger: #dc2626;
  --success: #16a34a;
  --radius: 6px;
  --transition: 0.15s ease;
  --pii-bg: #fff3cd;
  --pii-text: #856404;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-radius: 2px; }
:focus:not(:focus-visible) { outline: none; }
button { cursor: pointer; font: inherit; }

/* Accessibility */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* Skip Link */
.skip-link {
  position: fixed; top: -100%; left: 50%; transform: translateX(-50%);
  z-index: 10000; padding: 8px 16px; background: var(--accent); color: #fff;
  font-size: 0.8125rem; font-weight: 500; text-decoration: none;
  border-radius: 0 0 var(--radius) var(--radius); transition: top var(--transition);
}
.skip-link:focus { top: 0; }

/* Header */
.header {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; padding: 10px 24px;
  background: var(--bg); border-bottom: 1px solid var(--border);
}
.header__title { font-size: 0.875rem; font-weight: 600; letter-spacing: -0.01em; }

/* Consent Screen */
.consent-screen {
  display: flex; align-items: center; justify-content: center;
  min-height: calc(100vh - 42px); padding: 24px;
}
.consent-card {
  width: 100%; max-width: 480px; padding: 40px 32px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); text-align: center;
}
.consent-card h2 { font-size: 1.125rem; font-weight: 600; margin-bottom: 6px; }
.consent-card p { color: var(--text-muted); font-size: 0.8125rem; margin-bottom: 24px; }
.consent-card .btn { display: block; width: 100%; margin-bottom: 20px; }

.trust-indicators { list-style: none; text-align: left; }
.trust-indicators li {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 4px 0; font-size: 0.75rem; color: var(--text-muted);
}
.trust-indicators li::before {
  content: "\2713"; flex-shrink: 0; display: inline-flex;
  align-items: center; justify-content: center; width: 16px; height: 16px;
  font-size: 0.625rem; font-weight: 600; color: var(--success);
  background: rgba(22,163,74,0.08); border-radius: 50%;
}

/* App Container */
.app-container {
  display: none; flex-direction: column;
  height: calc(100vh - 42px); max-width: 960px;
  margin: 0 auto; padding: 24px;
}
.app-container.visible { display: flex; }

/* Panel Layout */
.panel-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; flex: 1; }
.panel {
  display: flex; flex-direction: column;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.panel__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--bg-alt);
}
.panel__title {
  font-size: 0.6875rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-faint);
}
.panel__body { flex: 1; display: flex; flex-direction: column; padding: 12px; }

/* Textarea */
.textarea {
  width: 100%; min-height: 200px; flex: 1; padding: 10px 12px;
  font-family: inherit; font-size: 16px; line-height: 1.5;
  color: var(--text); background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); resize: vertical; transition: border-color var(--transition);
}
.textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 2px rgba(17,17,17,0.06); }
.textarea::placeholder { color: var(--text-faint); }

.char-counter { font-size: 0.6875rem; color: var(--text-faint); }
.char-counter.warning { color: var(--danger); font-weight: 500; }

/* Output Area */
.output-area {
  flex: 1; min-height: 200px; padding: 10px 12px;
  font-family: inherit; font-size: 0.8125rem; line-height: 1.5;
  color: var(--text); background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: var(--radius); overflow-y: auto; white-space: pre-wrap;
  word-break: break-word; user-select: text;
}
.output-placeholder { color: var(--text-faint); font-style: italic; }

/* PII Highlight — single color for all categories */
.pii-highlight {
  background: var(--pii-bg); color: var(--pii-text);
  padding: 1px 3px; border-radius: 2px; font-weight: 500;
  border-bottom: 1px solid rgba(133,100,4,0.3);
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 7px 14px; font-size: 0.75rem; font-weight: 500;
  border: 1px solid transparent; border-radius: var(--radius);
  transition: background var(--transition), border-color var(--transition);
  white-space: nowrap; touch-action: manipulation;
}
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn--primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.btn--primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn--secondary { color: var(--text); background: var(--bg); border-color: var(--border); }
.btn--secondary:hover:not(:disabled) { background: var(--bg-alt); border-color: var(--text-faint); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

.button-row { display: flex; align-items: center; gap: 6px; padding: 10px 0 0; }

/* Status Bar */
.status-bar {
  order: 1;
  position: sticky; bottom: 0; z-index: 50;
  display: flex; align-items: center; gap: 12px;
  padding: 6px 12px calc(6px + env(safe-area-inset-bottom, 0px)); background: var(--bg-alt);
  border-top: 1px solid var(--border); font-size: 0.6875rem; color: var(--text-faint);
}

/* Loading Overlay */
.loading-overlay {
  position: fixed; inset: 0; z-index: 500;
  display: none; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.4); backdrop-filter: blur(2px);
}
.loading-overlay:not([hidden]) { display: flex; }
.loading-overlay__content {
  width: 90%; max-width: 360px; padding: 28px 24px;
  margin: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); text-align: center;
}
.loading-overlay__title { font-size: 0.875rem; font-weight: 600; margin-bottom: 8px; }
.loading-overlay__eta { font-size: 0.75rem; color: var(--text-faint); margin-bottom: 16px; }

.progress-bar {
  position: relative; width: 100%; height: 3px;
  background: var(--border); border-radius: 999px; overflow: hidden; margin-bottom: 6px;
}
.progress-bar__fill {
  height: 100%; width: 0%; background: var(--accent);
  border-radius: 999px; transition: width 0.4s ease;
}

/* Error Banner */
.error-banner {
  background: #fef2f2; color: var(--danger); padding: 10px 14px;
  border: 1px solid #fecaca; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 10px; font-size: 0.8125rem;
  animation: slideDown 0.25s ease;
}
.error-banner .error-message { flex: 1; font-weight: 500; }
.error-banner .error-action {
  background: transparent; border: 1px solid #fecaca; color: var(--danger);
  padding: 3px 10px; border-radius: var(--radius); cursor: pointer;
  white-space: nowrap; font-size: 0.75rem; font-weight: 500;
}
.error-banner .error-action:hover { background: rgba(220,38,38,0.06); }
.error-banner .error-dismiss {
  background: none; border: none; color: var(--danger);
  font-size: 1rem; cursor: pointer; padding: 2px; opacity: 0.6;
}
.error-banner .error-dismiss:hover { opacity: 1; }

/* Footer */
footer {
  padding: 12px 24px; border-top: 1px solid var(--border);
  background: var(--bg); text-align: center; font-size: 0.6875rem; color: var(--text-faint);
}
footer a { color: var(--text-muted); text-decoration: none; }
footer a:hover { color: var(--text); text-decoration: underline; }

/* Animations */
@keyframes slideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
/* Responsive — Mobile */
@media (max-width: 767px) {
  body { font-size: 15px; min-height: 100dvh; height: 100dvh; overflow: hidden; }
  .header { position: sticky; top: 0; z-index: 100; padding: 8px 16px; }
  .header__title { font-size: 16px; }
  .app-container {
    height: calc(100dvh - 42px);
    padding: 10px 10px 0;
    overflow: hidden;
  }
  .panel-layout {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
    overflow: hidden;
    gap: 8px;
  }
  .panel { flex: 1; min-height: 0; overflow: hidden; }
  .panel__body { min-height: 0; padding: 8px; overflow: hidden; }
  .textarea { min-height: 0; flex: 1; padding: 8px; font-size: 16px; resize: none; }
  .output-area { min-height: 0; flex: 1; padding: 8px; font-size: 14px; overflow-y: auto; }
  .button-row { padding: 8px 0 0; gap: 8px; }
  .btn { width: 100%; justify-content: center; padding: 8px 12px; font-size: 14px; min-height: 44px; }
  .status-bar { order: 1; flex-shrink: 0; padding: 4px 10px calc(4px + env(safe-area-inset-bottom, 0px)); font-size: 12px; }
  .panel__title, .char-counter { font-size: 12px; }
  .consent-card { padding: 28px 20px; }
  .consent-card p { font-size: 14px; }
  .trust-indicators li { font-size: 13px; }
  footer { display: none; }
  .error-banner .error-dismiss { min-width: 44px; min-height: 44px; padding: 6px; }
  .error-banner .error-action { min-height: 44px; padding: 8px 12px; }
}
