/* SMS Threat Reporter — Mobile-first CSS */

:root {
  --bg: #0f0f1a;
  --bg-card: #1a1a2e;
  --bg-input: #16213e;
  --border: #2a2a4a;
  --text: #e8e8f0;
  --text-muted: #9090b0;
  --accent: #6c63ff;
  --accent-hover: #7c73ff;
  --danger: #ff4757;
  --warning: #ffa502;
  --success: #2ed573;
  --gray: #57606f;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  --radius: 8px;
  --radius-sm: 4px;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
  --max-w: 760px;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ── */

.site-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-logo {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.nav-link {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.nav-link:hover { color: var(--text); }

.main-content {
  max-width: var(--max-w);
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
  flex: 1;
}

.site-footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}

/* ── Language picker ── */

.lang-picker { position: relative; }

.lang-btn {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.lang-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 140px;
  z-index: 200;
  box-shadow: var(--shadow);
}

.lang-option {
  display: block;
  padding: 0.5rem 1rem;
  color: var(--text);
  font-size: 0.9rem;
}

.lang-option:hover { background: var(--border); text-decoration: none; }

/* ── Cards ── */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

/* ── Hero ── */

.hero {
  margin-bottom: 1.5rem;
  text-align: center;
}

.hero h1 {
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.hero-desc { color: var(--text-muted); }

/* ── Form elements ── */

.field { margin-bottom: 1.25rem; }

.field-label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
}

.required { color: var(--danger); margin-left: 2px; }

.input, .textarea, .select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  padding: 0.6rem 0.75rem;
  transition: border-color 0.15s;
}

.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--accent);
}

.input::placeholder, .textarea::placeholder { color: var(--text-muted); }

.textarea { resize: vertical; min-height: 120px; }
.textarea-sm { min-height: 60px; }

.input-sm { font-size: 0.9rem; padding: 0.4rem 0.6rem; }

.select option { background: var(--bg-card); }

.textarea-wrapper { position: relative; }

.char-count {
  text-align: right;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.char-count.warn { color: var(--warning); }

/* ── Buttons ── */

.btn-primary, .btn-secondary, .btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 500;
  padding: 0.65rem 1.25rem;
  transition: opacity 0.15s, background 0.15s;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  width: 100%;
  margin-top: 0.5rem;
}

.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.btn-secondary:hover { background: rgba(108, 99, 255, 0.1); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  padding: 0.4rem 0.75rem;
}

.btn-ghost:hover { color: var(--text); border-color: var(--text-muted); }

.btn-paste {
  display: block;
  background: var(--bg-input);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  width: 100%;
  margin-bottom: 0.5rem;
  transition: border-color 0.15s, color 0.15s;
}

.btn-paste:hover { border-color: var(--accent); color: var(--text); }

/* .paste-hint replaced by .paste-hint-box */

/* ── Badges ── */

.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 0.25em 0.6em;
  border-radius: 999px;
  text-transform: uppercase;
}

.badge-red    { background: rgba(255, 71, 87, 0.2);   color: #ff6b78; }
.badge-orange { background: rgba(255, 165, 2, 0.2);   color: #ffa502; }
.badge-yellow { background: rgba(255, 220, 50, 0.15); color: #ffd700; }
.badge-green  { background: rgba(46, 213, 115, 0.2);  color: #2ed573; }
.badge-blue   { background: rgba(108, 99, 255, 0.2);  color: #a29bfe; }
.badge-gray   { background: rgba(87, 96, 111, 0.3);   color: #a4b0be; }
/* Used inside coloured hero banners — white-on-transparent so it reads on any bg */
.badge-hero-type { background: rgba(255,255,255,0.18); color: #fff; border: 1px solid rgba(255,255,255,0.35); }

.verdict-badge { font-size: 0.9rem; padding: 0.3em 0.8em; }

/* ── Result page ── */

.result-section h1 { margin-bottom: 1rem; font-size: 1.5rem; }

.dedup-banner {
  background: rgba(108, 99, 255, 0.1);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.submission-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
  min-width: 0;
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.card-time { font-size: 0.8rem; color: var(--text-muted); margin-left: auto; }

.sender-info {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.confidence-bar {
  position: relative;
  background: var(--border);
  border-radius: 999px;
  height: 8px;
  margin-top: 0.5rem;
  overflow: hidden;
}

.confidence-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.5s ease;
}

.confidence-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* url-table replaced by .url-section / .url-row */

/* ── SMS bubble ── */

.sms-bubble-wrap { margin-top: 0.75rem; }

.sms-bubble-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
  padding-left: 0.1rem;
}

.sms-bubble-icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  color: var(--text-muted);
}

.sms-bubble {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 0 var(--radius) var(--radius) var(--radius); /* flat top-left = incoming message */
  padding: 0.65rem 0.75rem 0;
  position: relative;
}

/* little tail on the top-left corner — classic received bubble */
.sms-bubble::before {
  content: '';
  position: absolute;
  top: 0;
  left: -8px;
  border: 8px solid transparent;
  border-top-color: var(--border);
  border-right-color: var(--border);
  border-top-left-radius: 2px;
}

.sms-bubble::after {
  content: '';
  position: absolute;
  top: 1px;
  left: -6px;
  border: 7px solid transparent;
  border-top-color: var(--bg-input);
  border-right-color: var(--bg-input);
}

.sms-pre {
  font-family: var(--font);   /* readable font, not mono — SMS is prose */
  font-size: 0.9rem;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  color: var(--text);
  line-height: 1.55;
  padding-bottom: 0.65rem;
}

.sms-pre--collapsed {
  max-height: 4.65em;  /* ~3 lines at 1.55 line-height */
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
  mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
}

.sms-expand-btn {
  display: block;
  width: 100%;
  background: none;
  border: none;
  border-top: 1px solid var(--border);
  color: var(--accent);
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.8rem;
  padding: 0.4rem 0;
  text-align: center;
}

/* ── Analyzing state ── */

.analyzing-state {
  text-align: center;
  padding: 2rem 1rem;
}

.analyzing-state p { color: var(--text-muted); margin: 0.75rem 0; }

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

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

/* ── Feedback ── */

.feedback-widget { margin-top: 1.5rem; }
.feedback-toggle { margin-bottom: 0.75rem; }
.feedback-form-body { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }

.radio-group { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.75rem; }
.radio-label { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; font-size: 0.9rem; }
.radio-label input { accent-color: var(--accent); }

.feedback-thanks { color: var(--success); margin-top: 0.5rem; }

/* ── Share bar ── */

.share-bar { margin-top: 1rem; }

/* ── Search ── */

.search-section h1 { margin-bottom: 1rem; font-size: 1.5rem; }

.search-form { margin-bottom: 1.5rem; }

.search-input-wrap { margin-bottom: 0.75rem; }

.search-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  padding: 0.7rem 0.9rem;
}

.search-input:focus { outline: none; border-color: var(--accent); }
.search-input::placeholder { color: var(--text-muted); }

.advanced-toggle { margin-bottom: 0.5rem; }

.advanced-filters {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.filter-row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.filter-row .field-label { min-width: 80px; margin: 0; }

.search-result-link { display: block; text-decoration: none; }

.search-result-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.75rem;
  transition: border-color 0.15s;
}

.search-result-item:hover { border-color: var(--accent); }

.result-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.result-time { font-size: 0.8rem; color: var(--text-muted); margin-left: auto; }

.result-preview { font-size: 0.9rem; color: var(--text-muted); }

.result-sender { font-size: 0.8rem; color: var(--text-muted); display: block; margin-top: 0.25rem; }

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

/* ── Phone reputation ── */

.phone-rep-section h1 { margin-bottom: 0.75rem; }
.phone-display { margin-bottom: 1rem; font-size: 1.1rem; }
.phone-display code { font-family: var(--mono); background: var(--bg-input); padding: 0.2em 0.5em; border-radius: var(--radius-sm); }

.phone-report-list { list-style: none; padding: 0; }
.phone-report-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 0.9rem;
  flex-wrap: wrap;
}

.phone-report-item time { font-size: 0.8rem; color: var(--text-muted); }

/* ── Pagination ── */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

/* ── Error page ── */

.error-page {
  text-align: center;
  padding: 4rem 1rem;
}

.error-page h1 { font-size: 1.8rem; margin-bottom: 1rem; }

/* ── Verdict hero banner ── */

.verdict-hero {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  margin-bottom: 0.75rem;
}

.verdict-hero-safe {
  background: rgba(46, 213, 115, 0.12);
  border: 1px solid rgba(46, 213, 115, 0.4);
}

.verdict-hero-danger {
  background: rgba(255, 71, 87, 0.12);
  border: 1px solid rgba(255, 71, 87, 0.4);
}

.verdict-hero-icon {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
}

.verdict-hero-safe .verdict-hero-icon { color: var(--success); }
.verdict-hero-danger .verdict-hero-icon { color: var(--danger); }

.verdict-hero-body { flex: 1; min-width: 0; }

.verdict-hero-headline {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.1;
  margin-bottom: 0.3rem;
}

.verdict-hero-safe .verdict-hero-headline { color: var(--success); }
.verdict-hero-danger .verdict-hero-headline { color: var(--danger); }

.verdict-hero-sub {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
}

.verdict-type-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin-top: 0.3rem;
}

.verdict-type-badge { font-size: 0.75rem; }

/* ── Indicators section (below hero, on card bg) ── */

.indicators-section {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.indicators-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  padding-top: 0.2em;
  white-space: nowrap;
  flex-shrink: 0;
}

.indicators-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-width: 0;
}

.badge-indicator {
  background: rgba(108, 99, 255, 0.12);
  color: #a29bfe;
  border: 1px solid rgba(108, 99, 255, 0.25);
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  padding: 0.2em 0.6em;
}

/* ── URL section ── */

.url-section { margin-bottom: 1.25rem; }
.url-section h3 { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.5rem; text-transform: uppercase; letter-spacing: 0.05em; }

.url-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

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

.url-text {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  word-break: break-all;
  overflow-wrap: anywhere;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.url-status-pill { cursor: default; }
.url-pill-link { text-decoration: none; }
.url-pill-link:hover .badge { opacity: 0.85; }

/* ── Card meta / timestamp ── */

.card-meta {
  margin-top: 0.75rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ── Paste hint (improved) ── */

.paste-hint-box {
  background: rgba(255, 165, 2, 0.1);
  border: 1px solid rgba(255, 165, 2, 0.35);
  border-radius: var(--radius-sm);
  color: var(--warning);
  font-size: 0.82rem;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
  line-height: 1.5;
}

.textarea.paste-focus {
  border-color: var(--warning);
  box-shadow: 0 0 0 2px rgba(255, 165, 2, 0.15);
}

/* ── Recent reports (home page) ── */

.recent-reports {
  margin-top: 2rem;
}

.recent-reports h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.75rem;
}

.recent-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.recent-item {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}

.recent-item:hover { background: var(--bg-input); text-decoration: none; }

.recent-item-safe    { border-left-color: var(--success); }
.recent-item-smishing,
.recent-item-unknown { border-left-color: var(--danger); }
.recent-item-scam    { border-left-color: var(--warning); }
.recent-item-unsafe  { border-left-color: #ffd700; }

.recent-item-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
}

.recent-item-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: auto;
}

.recent-item-preview {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Utilities ── */

[x-cloak] { display: none !important; }

/* ── Responsive tweaks ── */

@media (min-width: 600px) {
  .submit-card { padding: 2rem; }
  .advanced-filters { flex-direction: row; flex-wrap: wrap; }
  .filter-row { flex: 1; min-width: 200px; }
}
