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

:root {
  --bg: #1a1a2e;
  --surface: #16213e;
  --text: #f0f0f0;
  --text-muted: #b8b8c8;
  --primary: #0f3460;
  --accent: #e94560;
  --radius: 10px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 18px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 2rem;
}

header {
  text-align: center;
  padding: 1.5rem 1rem 0.5rem;
}

header h1 {
  font-size: 2.2rem;
  color: var(--accent);
  letter-spacing: 2px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 0.4rem;
}

.ai-badge {
  display: inline-block;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.2);
  color: #a8d8ff;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.25rem 0.85rem;
  border-radius: 2rem;
  margin-bottom: 1rem;
  letter-spacing: 0.5px;
}

nav {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.nav-btn {
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid #444;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 1rem;
  min-width: 80px;
}

.nav-btn.active {
  background: var(--primary);
  color: var(--text);
  border-color: #2a6090;
}

main {
  max-width: 600px;
  margin: 0 auto;
  padding: 1rem;
}

.view { display: block; }
.view.hidden { display: none; }

/* Scan form */
label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

#source-input {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 1px solid #444;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  margin-bottom: 1rem;
}

textarea {
  width: 100%;
  padding: 0.9rem 1rem;
  border: 1px solid #444;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  line-height: 1.6;
  resize: vertical;
  font-family: inherit;
}

textarea::placeholder { color: #666; }

#scan-btn {
  display: block;
  width: 100%;
  margin-top: 1rem;
  padding: 1rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.5px;
}

#scan-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* Results */
.result { margin-top: 1rem; }

.result-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.75rem;
}

.result-card.error {
  border-left: 4px solid var(--accent);
  color: var(--accent);
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.risk-badge {
  display: inline-block;
  padding: 0.35rem 0.9rem;
  border-radius: 1rem;
  color: white;
  font-weight: 700;
  font-size: 1rem;
}

.risk-badge.small { font-size: 0.9rem; padding: 0.25rem 0.65rem; }

.risk-score {
  font-size: 1.3rem;
  font-weight: 700;
}

.explanation { margin-bottom: 0.75rem; line-height: 1.6; font-size: 1rem; }

.patterns { margin-bottom: 0.75rem; }

.pattern-tag {
  display: inline-block;
  background: var(--primary);
  padding: 0.25rem 0.65rem;
  border-radius: 4px;
  font-size: 0.9rem;
  margin: 0.2rem;
}

.action { color: var(--text-muted); font-size: 1rem; line-height: 1.5; }

.btn-report-inline {
  display: block;
  width: 100%;
  margin-top: 0.85rem;
  padding: 0.75rem 1rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.5px;
}

.ai-attribution {
  font-size: 0.85rem;
  color: #7ab8e8;
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255,255,255,0.07);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* AI source badges */
.ai-source {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 1rem;
  font-size: 0.8rem;
  font-weight: 600;
}
.ai-source--edge  { background: rgba(34,197,94,0.15); color: #4ade80; border: 1px solid rgba(34,197,94,0.3); }
.ai-source--cloud { background: rgba(96,165,250,0.15); color: #7ab8e8; border: 1px solid rgba(96,165,250,0.3); }

/* "Verify with Cloud AI" button — shown for SAFE/LOW edge results */
.btn-verify-cloud {
  display: inline-block;
  padding: 0.2rem 0.75rem;
  background: transparent;
  color: #7ab8e8;
  border: 1px solid rgba(96,165,250,0.4);
  border-radius: 1rem;
  font-size: 0.8rem;
  cursor: pointer;
}

/* Scan counter in the header, below nav */
.scan-counter {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
  min-height: 1em;
  letter-spacing: 0.3px;
}

/* Stats card in About view */
.stats-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1.25rem;
}
.stats-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--text);
}
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
  padding: 0.6rem 0.5rem;
}
.stat-number {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.1;
}
.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  text-align: center;
}

/* History */
.history-item {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 0.75rem;
  margin-bottom: 0.5rem;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.history-header time { color: var(--text-muted); font-size: 0.9rem; }

.history-explanation {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.empty { color: var(--text-muted); text-align: center; padding: 2rem; }

/* About */
#view-about h2 { margin-bottom: 0.75rem; font-size: 1.4rem; }
#view-about h3 { margin: 1.25rem 0 0.5rem; color: var(--text-muted); font-size: 1.1rem; }
#view-about p, #view-about li { line-height: 1.7; margin-bottom: 0.4rem; }
#view-about ol, #view-about ul { padding-left: 1.5rem; }

.about-ai-box {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: rgba(100,180,255,0.07);
  border: 1px solid rgba(100,180,255,0.25);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 1rem 0;
}

.about-ai-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
  line-height: 1;
}

.about-ai-box strong {
  display: block;
  color: #a8d8ff;
  font-size: 1rem;
  margin-bottom: 0.4rem;
}

.about-ai-box p {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
}

.disclaimer { font-size: 0.9rem; color: var(--text-muted); margin-top: 1.5rem; font-style: italic; }

/* Alert banner */
.alert-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.75rem;
  text-align: center;
  color: white;
  font-weight: 600;
  z-index: 100;
  transition: transform 0.3s;
}

.alert-banner.hidden { transform: translateY(100%); }

.hidden { display: none; }
.alert-banner.hidden { display: block; }

/* =====================
   SCAM ALERT OVERLAY
   ===================== */

.scam-overlay {
  position: fixed;
  inset: 0;
  background: #8b0000;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: scam-bg-pulse 0.6s ease-in-out infinite alternate;
  overflow-y: auto;
}

.scam-overlay.hidden { display: none; }

@keyframes scam-bg-pulse {
  from { background: #8b0000; }
  to   { background: #cc0000; }
}

.scam-overlay-inner {
  text-align: center;
  padding: 2rem 1.5rem;
  max-width: 480px;
  width: 100%;
}

.scam-siren {
  font-size: 4rem;
  animation: siren-spin 0.5s linear infinite;
  display: inline-block;
}

@keyframes siren-spin {
  0%   { transform: rotate(-15deg) scale(1); }
  50%  { transform: rotate(15deg) scale(1.2); }
  100% { transform: rotate(-15deg) scale(1); }
}

.scam-title {
  font-size: 2.8rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: 4px;
  text-shadow: 0 0 20px rgba(255,255,255,0.8), 0 0 40px rgba(255,0,0,0.6);
  animation: scam-blink 0.4s step-start infinite;
  margin: 0.5rem 0 1rem;
}

@keyframes scam-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

.scam-score-ring {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 5px solid #fff;
  background: rgba(0,0,0,0.3);
  margin-bottom: 1.25rem;
  box-shadow: 0 0 0 4px rgba(255,255,255,0.3), 0 0 30px rgba(255,255,255,0.4);
}

.scam-score-ring span {
  font-size: 1.8rem;
  font-weight: 900;
  color: #fff;
  line-height: 1;
}

.scam-score-ring small {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.8);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.scam-source-block {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(0,0,0,0.3);
  border-radius: 6px;
  padding: 0.5rem 0.9rem;
  margin-bottom: 0.75rem;
  font-size: 1rem;
}

.scam-source-label {
  color: rgba(255,255,255,0.7);
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 1px;
  white-space: nowrap;
}

.scam-source-value {
  color: #ffd700;
  font-weight: 700;
  word-break: break-all;
}

.scam-message-quote {
  background: rgba(0,0,0,0.35);
  border-left: 4px solid rgba(255,255,255,0.5);
  border-radius: 0 6px 6px 0;
  padding: 0.85rem 1rem;
  margin: 0 0 1rem;
  font-size: 1rem;
  color: #ffe8e8;
  font-style: italic;
  line-height: 1.6;
  text-align: left;
  word-break: break-word;
  white-space: pre-wrap;
}

.scam-explanation {
  color: #fff;
  font-size: 1.05rem;
  line-height: 1.6;
  margin-bottom: 1rem;
  background: rgba(0,0,0,0.25);
  border-radius: 8px;
  padding: 0.85rem;
}

.scam-patterns {
  margin-bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
}

.scam-patterns .pattern-tag {
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.4);
  color: #fff;
  font-size: 0.9rem;
}

.scam-action {
  color: #ffe0e0;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}

.scam-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.scam-ai-credit {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.5px;
}

.btn-report {
  padding: 1rem;
  background: #fff;
  color: #8b0000;
  border: none;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.btn-dismiss {
  padding: 0.9rem;
  background: transparent;
  color: rgba(255,255,255,0.85);
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
}

/* =====================
   REPORT SHEET
   ===================== */

.report-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 10000;
  backdrop-filter: blur(2px);
}

.report-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 0.75rem 1.25rem 2rem;
  z-index: 10001;
  max-height: 90vh;
  overflow-y: auto;
}

.report-sheet-handle {
  width: 40px;
  height: 4px;
  background: #444;
  border-radius: 2px;
  margin: 0 auto 1rem;
}

.report-sheet-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.report-sheet-subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.report-options {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.report-option {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  width: 100%;
  background: var(--bg);
  border: 1px solid #2a2a4a;
  border-radius: 10px;
  padding: 1rem 1rem;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  transition: border-color 0.15s;
  min-height: 64px;
}

.report-option:active { border-color: var(--accent); }

.report-option-share { border-color: #1a4a2a; }
.report-option-share:active { border-color: #2ecc71; }

.report-icon { font-size: 1.8rem; flex-shrink: 0; }

.report-text { display: flex; flex-direction: column; gap: 0.2rem; }

.report-text strong { font-size: 1rem; }

.report-text small {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.report-cancel {
  display: block;
  width: 100%;
  padding: 0.9rem;
  background: transparent;
  border: 1px solid #333;
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
}

/* =====================
   SHARE SUB-SHEET
   ===================== */

.share-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 10002;
  backdrop-filter: blur(2px);
}

.share-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #1c2340;
  border-radius: 20px 20px 0 0;
  padding: 0.75rem 1.25rem 2rem;
  z-index: 10003;
  max-height: 90vh;
  overflow-y: auto;
}

.share-sheet-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

.share-back-btn {
  background: rgba(255,255,255,0.08);
  border: none;
  color: var(--text);
  font-size: 1.2rem;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.share-sheet-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}

.share-sheet-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  padding-left: 2.75rem;
}

.share-options-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 1rem;
}

.share-options-list > li:not(:first-child) {
  border-top: 1px solid rgba(255,255,255,0.07);
}

/* Non-featured options share a grouped card */
.share-options-list > li:nth-child(2) .share-option {
  border-radius: 14px 14px 0 0;
}
.share-options-list > li:last-child .share-option {
  border-radius: 0 0 14px 14px;
}

/* Group border for non-featured items */
.share-options-list > li:not(:first-child) {
  background: rgba(255,255,255,0.03);
}

.share-options-list > li:nth-child(2) {
  border-radius: 14px 14px 0 0;
  border: 1px solid rgba(255,255,255,0.1);
  border-bottom: none;
}
.share-options-list > li:not(:first-child):not(:nth-child(2)):not(:last-child) {
  border-left: 1px solid rgba(255,255,255,0.1);
  border-right: 1px solid rgba(255,255,255,0.1);
}
.share-options-list > li:last-child {
  border-radius: 0 0 14px 14px;
  border: 1px solid rgba(255,255,255,0.1);
  border-top: none;
}

.share-option {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  background: transparent;
  border: none;
  padding: 0.9rem 1rem;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  transition: background 0.12s;
  min-height: 60px;
}

.share-option:active {
  background: rgba(255,255,255,0.06);
}

.share-option--featured {
  background: rgba(24, 119, 242, 0.08);
  border: 2px solid #1877F2;
  border-radius: 12px;
  margin-bottom: 0.75rem;
}

.share-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.share-option-label {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
}

.share-cancel-btn {
  display: block;
  width: 100%;
  padding: 0.9rem;
  background: transparent;
  border: 1px solid #333;
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  font-family: inherit;
  margin-top: 0.25rem;
}

.report-option-chevron {
  margin-left: auto;
  font-size: 1.3rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* =====================
   CLIPBOARD PROMPT
   ===================== */

.clipboard-prompt {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  right: 1rem;
  background: #0f3460;
  border: 1px solid #1a5276;
  border-radius: 10px;
  padding: 1rem;
  z-index: 200;
  text-align: center;
}

.clipboard-prompt p {
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

.clipboard-prompt div {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.clipboard-prompt button {
  padding: 0.65rem 1.4rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
}

.clipboard-prompt button:first-of-type {
  background: var(--accent);
  color: white;
}

.clipboard-prompt button:last-of-type {
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid #333;
}
