/* ============================================================
   Redwood Privacy — ToS;DR Page Styles
   Light steel theme
   ============================================================ */

/* ── Page Shell ──────────────────────────────────────────────── */
.tosdr-main {
  padding-top: 80px;
  min-height: 100vh;
  padding-bottom: var(--space-16);
  box-sizing: border-box;
  overflow-x: hidden;
}

/* ── Page Header ─────────────────────────────────────────────── */
.tosdr-header {
  padding: var(--space-10) 0 var(--space-8);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--space-8);
}

.tosdr-header-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-6);
  flex-wrap: wrap;
}

.tosdr-eyebrow {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--blue-600);
  margin-bottom: var(--space-2);
}

.tosdr-title {
  font-size: var(--text-3xl);
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  line-height: 1.15;
  margin-bottom: var(--space-3);
}

.tosdr-subtitle {
  font-size: var(--text-base);
  color: var(--text-secondary);
  max-width: 520px;
  line-height: 1.65;
}

/* ── Search Bar ──────────────────────────────────────────────── */
.tosdr-search-wrap {
  position: relative;
  width: 280px;
  flex-shrink: 0;
}

.tosdr-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.tosdr-search {
  width: 100%;
  padding: 10px 14px 10px 36px;
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  font-size: var(--text-sm);
  font-family: inherit;
  color: var(--text-primary);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.tosdr-search:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

/* ── Grade Legend ────────────────────────────────────────────── */
.grade-legend {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: var(--space-6);
}

.grade-legend-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: var(--space-1);
}

.grade-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all var(--transition-fast);
  user-select: none;
}

.grade-pill-a { background: rgba(34,197,94,0.1);  color: #15803d; border-color: rgba(34,197,94,0.25); }
.grade-pill-b { background: rgba(132,204,22,0.1); color: #3f6212; border-color: rgba(132,204,22,0.25); }
.grade-pill-c { background: rgba(245,158,11,0.1); color: #92400e; border-color: rgba(245,158,11,0.25); }
.grade-pill-d { background: rgba(249,115,22,0.1); color: #c2410c; border-color: rgba(249,115,22,0.25); }
.grade-pill-f { background: rgba(239,68,68,0.1);  color: #991b1b; border-color: rgba(239,68,68,0.25); }

.grade-pill.active,
.grade-pill:hover {
  filter: brightness(0.92);
  transform: translateY(-1px);
}

.grade-pill.active {
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

/* ── Grid ────────────────────────────────────────────────────── */
.tosdr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-5);
}

/* ── Platform Card ───────────────────────────────────────────── */
.tosdr-card {
  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base), transform var(--transition-base), border-color var(--transition-fast);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.tosdr-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--blue-border);
}

.tosdr-card:focus-visible {
  outline: 2px solid var(--blue-500);
  outline-offset: 2px;
}

.tosdr-card-top {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.tosdr-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 900;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: -0.02em;
}

.tosdr-card-meta {
  flex: 1;
  min-width: 0;
}

.tosdr-card-name {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 3px;
}

.tosdr-card-cat {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 500;
}

/* ── Overall Grade Badge ─────────────────────────────────────── */
.tosdr-grade-badge {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xl);
  font-weight: 900;
  flex-shrink: 0;
}

.grade-badge-a { background: rgba(34,197,94,0.12);  color: #15803d; }
.grade-badge-b { background: rgba(132,204,22,0.12); color: #3f6212; }
.grade-badge-c { background: rgba(245,158,11,0.12); color: #92400e; }
.grade-badge-d { background: rgba(249,115,22,0.12); color: #c2410c; }
.grade-badge-f { background: rgba(239,68,68,0.1);   color: #991b1b; }

/* ── Section Mini Grades ─────────────────────────────────────── */
.tosdr-sections {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.tosdr-section-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px solid var(--bg-elevated);
}

.tosdr-section-row:last-child { border-bottom: none; }

.tosdr-section-name {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  font-weight: 500;
}

.tosdr-section-grade {
  font-size: 11px;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: var(--radius-full);
}

.section-grade-a { background: rgba(34,197,94,0.1);  color: #15803d; }
.section-grade-b { background: rgba(132,204,22,0.1); color: #3f6212; }
.section-grade-c { background: rgba(245,158,11,0.1); color: #92400e; }
.section-grade-d { background: rgba(249,115,22,0.1); color: #c2410c; }
.section-grade-f { background: rgba(239,68,68,0.08); color: #991b1b; }

.tosdr-card-summary {
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tosdr-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--space-2);
  border-top: 1px solid var(--border-subtle);
}

.tosdr-reviewed {
  font-size: 10px;
  color: var(--text-muted);
}

.tosdr-cta {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--blue-600);
}

/* ── Empty State ─────────────────────────────────────────────── */
.tosdr-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-16) var(--space-8);
  text-align: center;
  color: var(--text-muted);
  gap: var(--space-3);
}

.tosdr-empty-icon {
  font-size: 2.5rem;
  margin-bottom: var(--space-2);
}

/* ── Detail Modal ────────────────────────────────────────────── */
.tosdr-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 30, 60, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: var(--z-modal);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.tosdr-modal-backdrop.open {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

.tosdr-modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-2xl);
  width: 100%;
  max-width: 720px;
  max-height: 86vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: scale(0.97) translateY(8px);
  transition: transform var(--transition-base);
}

.tosdr-modal-backdrop.open .tosdr-modal {
  transform: scale(1) translateY(0);
}

.tosdr-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  background: var(--bg-surface);
  z-index: 1;
  gap: var(--space-4);
}

.tosdr-modal-title-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.tosdr-modal-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 900;
  color: #fff;
  flex-shrink: 0;
}

.tosdr-modal-name {
  font-size: var(--text-xl);
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.tosdr-modal-meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.tosdr-modal-grade {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

.tosdr-modal-grade-big {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-2xl);
  font-weight: 900;
}

.tosdr-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  width: 44px; height: 44px; padding: 4px; display: flex; align-items: center; justify-content: center;
  line-height: 1;
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
  flex-shrink: 0;
  align-self: flex-start;
}

.tosdr-modal-close:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

/* ── Modal Content ───────────────────────────────────────────── */
.tosdr-modal-body {
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.tosdr-modal-summary {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.7;
  padding: var(--space-4);
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  border-left: 3px solid var(--blue-500);
}

.tosdr-modal-sections {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.tosdr-section-card {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.tosdr-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  background: var(--bg-elevated);
  cursor: pointer;
  user-select: none;
  gap: var(--space-3);
}

.tosdr-section-header:hover { background: var(--bg-hover); }

.tosdr-section-header-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}

.tosdr-section-toggle {
  font-size: var(--text-xs);
  color: var(--text-muted);
  transition: transform var(--transition-fast);
}

.tosdr-section-toggle.open { transform: rotate(180deg); }

.tosdr-section-body {
  padding: var(--space-4) var(--space-5) var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.tosdr-section-summary-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.65;
}

.tosdr-clauses-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}

.tosdr-clause-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.tosdr-clause {
  display: flex;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  line-height: 1.55;
}

.tosdr-clause::before {
  content: "→";
  color: var(--blue-500);
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

.tosdr-optout {
  padding: var(--space-3) var(--space-4);
  background: rgba(34,197,94,0.05);
  border: 1px solid rgba(34,197,94,0.2);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  color: #15803d;
  line-height: 1.6;
}

.tosdr-optout strong {
  font-weight: 700;
}

.tosdr-modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.tosdr-policy-link {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--blue-600);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tosdr-policy-link:hover { color: var(--blue-700); }

.tosdr-reviewed-at {
  font-size: 10px;
  color: var(--text-muted);
}

/* ── Footer ──────────────────────────────────────────────────── */
.page-footer {
  border-top: 1px solid var(--border-subtle);
  padding: var(--space-6) 0;
  text-align: center;
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-8);
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 700px) {
  .tosdr-header-inner { flex-direction: column; }
  .tosdr-search-wrap  { width: 100%; }
  .tosdr-grid         { grid-template-columns: 1fr; }
  .tosdr-modal-header { flex-wrap: wrap; }
}
