/* ===== MODAL BACKDROP ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: backdropIn 0.25s ease-out;
}

.modal-backdrop.hidden { display: none; }

.modal-backdrop.removing {
  animation: backdropOut 0.2s ease-in forwards;
}

@keyframes backdropIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes backdropOut {
  to { opacity: 0; }
}

/* ===== MODAL ===== */
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 650px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
  animation: modalIn 0.3s ease-out;
}

.modal-backdrop.removing .modal {
  animation: modalOut 0.2s ease-in forwards;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes modalOut {
  to { opacity: 0; transform: scale(0.95) translateY(10px); }
}

.modal-share { max-width: 700px; }

/* ===== MODAL HEADER ===== */
.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1.25rem 1.5rem 0.75rem;
  gap: 1rem;
}

.modal-badges {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.severity-badge {
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.severity-badge.critical { background: rgba(220,38,38,0.15); color: #f87171; }
.severity-badge.high { background: rgba(234,88,12,0.15); color: #fb923c; }
.severity-badge.medium { background: rgba(217,119,6,0.15); color: #fbbf24; }
.severity-badge.low { background: rgba(22,163,106,0.15); color: #4ade80; }

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.75rem;
  line-height: 1;
  padding: 0 0.25rem;
  transition: color 0.2s;
  flex-shrink: 0;
}

.modal-close:hover { color: var(--text-primary); }

/* ===== MODAL TITLE ===== */
.modal-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  padding: 0 1.5rem;
  line-height: 1.3;
}

/* ===== MODAL QUOTE ===== */
.modal-quote {
  margin: 0.75rem 1.5rem;
  padding: 0.75rem 1rem;
  background: rgba(0,0,0,0.3);
  border-left: 2px solid var(--border);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ===== MODAL BODY ===== */
.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Loading */
.modal-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 3rem 0;
  color: var(--text-muted);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== DETAIL SECTIONS ===== */
.detail-section {
  padding-left: 1rem;
  border-left: 3px solid var(--border);
}

.detail-section h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.detail-section p, .detail-section li {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.detail-section ul {
  list-style: disc;
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.section-why { border-left-color: var(--accent); }
.section-legal { border-left-color: #a855f7; }
.section-cases { border-left-color: var(--medium); }
.section-actions { border-left-color: var(--safe); }
.section-comparison { border-left-color: #3b82f6; }

/* Opt-out box */
.optout-box {
  padding: 1rem;
  border-radius: 10px;
  font-size: 0.9rem;
  line-height: 1.6;
}

.optout-box.available {
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.3);
  color: var(--safe);
}

.optout-box.unavailable {
  background: rgba(220,38,38,0.1);
  border: 1px solid rgba(220,38,38,0.3);
  color: #f87171;
}

.optout-box h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.optout-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

.optout-badge.no {
  background: rgba(220,38,38,0.15);
  color: #f87171;
}

/* ===== MODAL FOOTER ===== */
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
}

/* ===== RESPONSIVE MODAL ===== */
@media (max-width: 768px) {
  .modal {
    max-height: 100vh;
    border-radius: 12px 12px 0 0;
    max-width: 100%;
    margin-top: auto;
  }

  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .modal-title { font-size: 1.15rem; }
}
