/* Secure Email Share — viewer styles (self-contained, no CDN) */

:root {
  --brand-50: #f0f9ff;
  --brand-100: #e0f2fe;
  --brand-500: #0ea5e9;
  --brand-600: #0284c7;
  --brand-700: #0369a1;
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  --red-500: #ef4444;
  --red-600: #dc2626;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--slate-800);
  -webkit-font-smoothing: antialiased;
  background-color: var(--slate-50);
  background-image:
    radial-gradient(at 0% 0%, rgba(224, 242, 254, 0.6) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(238, 242, 255, 0.6) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(224, 231, 255, 0.6) 0px, transparent 50%);
  background-attachment: fixed;
  min-height: 100vh;
  padding-bottom: 5rem;
}

.hidden { display: none !important; }

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-6px); }
  40%, 60% { transform: translateX(6px); }
}

.animate-in { animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both; }
.shake { animation: shake 0.5s ease-in-out; }

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  max-width: 72rem;
  margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 0.6rem; }
.brand-icon {
  display: flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; border-radius: 9999px;
  background: var(--brand-100); color: var(--brand-600);
}
.brand-icon svg { width: 1rem; height: 1rem; }
.brand-name { font-weight: 600; font-size: 0.875rem; letter-spacing: -0.01em; color: var(--slate-700); }
.header-badge {
  font-size: 0.72rem; font-weight: 500; color: var(--slate-500);
  background: rgba(255, 255, 255, 0.6); backdrop-filter: blur(6px);
  padding: 0.4rem 0.85rem; border-radius: 9999px; border: 1px solid var(--slate-200);
}

main { max-width: 72rem; margin: 1.5rem auto 0; padding: 0 1rem; }

/* Glass panel */
.glass-panel {
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 1);
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.02),
    0 10px 15px -3px rgba(0, 0, 0, 0.03),
    0 25px 50px -12px rgba(0, 0, 0, 0.05);
  border-radius: 1.5rem;
}

/* Loading */
.loading-wrap {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 8rem 0;
}
.spinner {
  width: 3.5rem; height: 3.5rem; border-radius: 9999px;
  border: 4px solid var(--slate-100);
  border-top-color: var(--brand-500);
  animation: spin 0.9s linear infinite;
}
.loading-title { margin-top: 1.5rem; font-size: 1.1rem; font-weight: 500; color: var(--slate-700); }
.loading-sub { margin-top: 0.4rem; font-size: 0.85rem; color: var(--slate-500); }

/* Password prompt */
.password-card {
  max-width: 26rem; margin: 5rem auto; padding: 2.5rem;
  text-align: center; position: relative; overflow: hidden;
}
.password-icon {
  width: 4rem; height: 4rem; margin: 0 auto 1.5rem;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--brand-50), var(--brand-100));
  color: var(--brand-600); border-radius: 1rem;
  box-shadow: inset 0 2px 4px rgba(2, 132, 199, 0.08);
}
.password-icon svg { width: 2rem; height: 2rem; }
.password-card h2 { font-size: 1.4rem; letter-spacing: -0.02em; color: var(--slate-900); margin-bottom: 0.5rem; }
.password-card .hint { font-size: 0.85rem; color: var(--slate-500); line-height: 1.55; margin-bottom: 1.75rem; }

.password-input {
  width: 100%; padding: 1rem 1.25rem; border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.7); border: 1px solid var(--slate-200);
  font-size: 0.95rem; color: var(--slate-900);
  transition: box-shadow 0.2s, border-color 0.2s, background 0.2s;
  outline: none;
}
.password-input::placeholder { color: var(--slate-400); }
.password-input:focus {
  border-color: var(--brand-500);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.25);
}

.field-error {
  display: flex; align-items: center; gap: 0.4rem;
  margin-top: 0.75rem; font-size: 0.82rem; font-weight: 500; color: var(--red-500);
  text-align: left;
}
.field-error svg { width: 1rem; height: 1rem; flex-shrink: 0; }

.btn-primary {
  margin-top: 1.5rem; width: 100%; padding: 0.95rem 1.25rem;
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  background: var(--slate-900); color: #fff;
  font-size: 0.95rem; font-weight: 600;
  border: none; border-radius: 0.85rem; cursor: pointer;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.2);
  transition: background 0.2s, transform 0.1s;
}
.btn-primary:hover { background: var(--slate-700); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.6; cursor: wait; }
.btn-primary .btn-spinner {
  width: 1rem; height: 1rem; border-radius: 9999px;
  border: 2px solid rgba(255, 255, 255, 0.35); border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}

/* Error card */
.error-card {
  max-width: 32rem; margin: 4rem auto; padding: 1.75rem;
  display: flex; gap: 1rem; align-items: flex-start; text-align: left;
}
.error-icon {
  flex-shrink: 0; width: 2.5rem; height: 2.5rem; border-radius: 9999px;
  background: #fee2e2; color: var(--red-600);
  display: flex; align-items: center; justify-content: center;
}
.error-icon svg { width: 1.4rem; height: 1.4rem; }
.error-card h3 { font-size: 1rem; color: var(--slate-900); }
.error-card p { margin-top: 0.3rem; font-size: 0.875rem; color: var(--slate-600); line-height: 1.55; }

/* Email content */
.meta-card { padding: 2rem; }
@media (min-width: 640px) { .meta-card { padding: 2.5rem; } }

.badge-secure {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: var(--brand-50); color: var(--brand-700);
  border: 1px solid var(--brand-100);
  padding: 0.4rem 0.8rem; border-radius: 9999px;
  font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 1.5rem;
}
.badge-secure svg { width: 0.85rem; height: 0.85rem; }

.subject {
  font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em;
  color: var(--slate-900); line-height: 1.35; margin-bottom: 2rem;
  overflow-wrap: anywhere;
}
@media (min-width: 1024px) { .subject { font-size: 1.85rem; } }

.participants {
  display: flex; flex-direction: column; gap: 1.25rem;
  padding: 1.25rem; border-radius: 1rem;
  background: rgba(255, 255, 255, 0.55); border: 1px solid rgba(226, 232, 240, 0.7);
}
@media (min-width: 640px) {
  .participants { flex-direction: row; align-items: center; }
  .participants .divider { width: 1px; height: 2.5rem; background: var(--slate-200); }
}
.participant { display: flex; align-items: center; gap: 0.85rem; min-width: 0; flex: 1; }
.avatar {
  flex-shrink: 0; width: 2.85rem; height: 2.85rem; border-radius: 9999px;
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.05rem;
  background: linear-gradient(135deg, #6366f1, #9333ea);
}
.avatar.locked { background: var(--slate-100); border: 1px solid var(--slate-200); color: var(--slate-400); }
.p-field { display: flex; flex-direction: column; min-width: 0; }
.p-label {
  font-size: 0.6rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--slate-400); margin-bottom: 0.15rem;
}
.p-value { font-size: 0.875rem; font-weight: 600; color: var(--slate-800); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-value.muted { font-weight: 500; color: var(--slate-600); }

/* Body */
.body-card {
  margin-top: 1.5rem; background: #fff; border-radius: 1.5rem;
  border: 1px solid rgba(226, 232, 240, 0.7); overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.body-scroll { overflow-x: auto; padding: 2rem; }
@media (min-width: 1024px) { .body-scroll { padding: 2.5rem; } }
#email-body { font-family: Arial, Helvetica, sans-serif; color: #1a1a1a; line-height: 1.6; }
#email-body img, #email-body table { max-width: 100%; height: auto; }

/* Privacy footer */
.privacy-note {
  margin: 2.5rem auto 0; max-width: 40rem; text-align: center;
  font-size: 0.78rem; color: var(--slate-400); line-height: 1.7;
}
.privacy-note strong { color: var(--slate-500); }
.privacy-note a { color: var(--brand-600); text-decoration: none; }
.privacy-note a:hover { text-decoration: underline; }
.privacy-lock {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-weight: 600; color: var(--slate-500);
}
.privacy-lock svg { width: 0.9rem; height: 0.9rem; }

/* Static content pages (landing + privacy) */
.page-card { max-width: 42rem; margin: 3rem auto; padding: 2.5rem; }
.page-card h1 { font-size: 1.6rem; letter-spacing: -0.02em; color: var(--slate-900); margin-bottom: 1rem; }
.page-card h2 { font-size: 1.05rem; color: var(--slate-800); margin: 1.75rem 0 0.5rem; }
.page-card p, .page-card li { font-size: 0.92rem; color: var(--slate-600); line-height: 1.7; }
.page-card ul { padding-left: 1.25rem; margin-top: 0.5rem; }
.page-card .status-pill {
  display: inline-block; margin-top: 1.25rem; padding: 0.5rem 1rem;
  background: #dcfce7; color: #15803d; font-weight: 600; font-size: 0.85rem;
  border-radius: 0.6rem;
}
