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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0a0a1a;
  color: #f0f0f0;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Screens ── */
.screen { display: none; min-height: 100vh; flex-direction: column; }
.screen.active { display: flex; }

/* ── Splash ── */
#screen-splash {
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #1a1a3e 0%, #0a0a1a 70%);
}
.splash-center { text-align: center; }
.app-name { font-size: 2.4rem; font-weight: 700; margin-top: 1rem; letter-spacing: 2px; }
.tagline { color: #8888bb; margin-top: 0.4rem; font-size: 1rem; }

/* ── Halo Logo (splash) ── */
.halo-logo { position: relative; width: 100px; height: 100px; margin: 0 auto; }
.halo-ring {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: #6c63ff;
  border-right-color: #6c63ff;
  animation: spin 2s linear infinite;
  box-shadow: 0 0 20px #6c63ff88;
}
.halo-inner {
  position: absolute; inset: 10px;
  background: #1a1a3e;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Halo Status Bar ── */
.halo-bar {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.6rem 1rem;
  background: #12122a;
  border-bottom: 1px solid #2a2a4a;
  position: sticky; top: 0; z-index: 100;
}
.halo-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}
.pulse-blue  { background: #6c63ff; animation: pulse 2s ease-in-out infinite; box-shadow: 0 0 8px #6c63ff; }
.solid-green { background: #22c55e; box-shadow: 0 0 8px #22c55e; }
.flash-red   { background: #ef4444; animation: flash 0.5s ease-in-out infinite; box-shadow: 0 0 8px #ef4444; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
@keyframes flash { 0%,100% { opacity: 1; } 50% { opacity: 0.2; } }

#halo-status-text { flex: 1; font-size: 0.85rem; color: #aaaacc; }
.halo-settings-btn { background: none; border: none; color: #aaaacc; font-size: 1.1rem; cursor: pointer; padding: 0.2rem; }

/* ── Welcome ── */
#screen-welcome {
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  background: radial-gradient(ellipse at center, #1a1a3e 0%, #0a0a1a 70%);
}
.welcome-center { display: flex; flex-direction: column; gap: 1.2rem; max-width: 400px; width: 100%; }
.welcome-title { font-size: 1.8rem; font-weight: 700; text-align: center; }
.welcome-body { color: #b0b0cc; font-size: 1rem; line-height: 1.7; text-align: center; }
.welcome-body.warm { color: #a78bfa; font-style: italic; }

/* ── Onboarding ── */
#screen-onboarding { padding: 1.5rem; gap: 1rem; }
.onboard-header { display: flex; flex-direction: column; gap: 0.4rem; }
.progress-bar { height: 6px; background: #2a2a4a; border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #6c63ff, #a78bfa); border-radius: 3px; transition: width 0.4s ease; }
.step-label { font-size: 0.8rem; color: #8888bb; }

.onboard-body { flex: 1; display: flex; flex-direction: column; gap: 0.8rem; padding-top: 1rem; }
.question-text { font-size: 1.5rem; font-weight: 700; line-height: 1.3; }
.question-sub  { color: #8888bb; font-size: 0.95rem; }

.options-container { display: flex; flex-direction: column; gap: 0.7rem; margin-top: 0.5rem; }
.option-btn {
  background: #16163a;
  border: 2px solid #2a2a4a;
  color: #f0f0f0;
  border-radius: 12px;
  padding: 1rem 1.2rem;
  font-size: 1rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
}
.option-btn:active { transform: scale(0.98); }
.option-btn.selected {
  border-color: #6c63ff;
  background: #1e1a4e;
  box-shadow: 0 0 12px #6c63ff44;
}

.onboard-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 1rem;
  border-top: 1px solid #2a2a4a;
}

/* ── Buttons ── */
.btn-primary {
  background: linear-gradient(135deg, #6c63ff, #a78bfa);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 0.9rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn-primary:disabled { opacity: 0.3; cursor: not-allowed; }
.btn-primary:not(:disabled):active { opacity: 0.8; }
.btn-primary.full-width { width: 100%; }

.btn-ghost {
  background: none;
  border: 2px solid #2a2a4a;
  color: #aaaacc;
  border-radius: 12px;
  padding: 0.9rem 1.5rem;
  font-size: 1rem;
  cursor: pointer;
}
.btn-ghost:active { background: #2a2a4a; }

.btn-danger {
  background: #7f1d1d;
  border: none;
  color: #fca5a5;
  border-radius: 12px;
  padding: 0.9rem 1.5rem;
  font-size: 1rem;
  cursor: pointer;
}
.btn-danger.full-width { width: 100%; }

/* ── Settings Screen ── */
.settings-header { text-align: center; padding: 2rem 1.5rem 1rem; }
.settings-header h2 { font-size: 1.5rem; margin-top: 1rem; }
.settings-header p { color: #8888bb; margin-top: 0.5rem; font-size: 0.95rem; }

.settings-body { padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem; flex: 1; }
.settings-footer { padding: 1.5rem; }
.settings-top {
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #2a2a4a;
}
.settings-top h3 { font-size: 1.1rem; }

.input-group { display: flex; flex-direction: column; gap: 0.4rem; }
.input-group label { font-size: 0.85rem; color: #aaaacc; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.input-group input {
  background: #16163a;
  border: 2px solid #2a2a4a;
  color: #f0f0f0;
  border-radius: 10px;
  padding: 0.9rem 1rem;
  font-size: 1rem;
  width: 100%;
}
.input-group input:focus { outline: none; border-color: #6c63ff; }
.input-group small { color: #666699; font-size: 0.8rem; }

.security-note {
  display: flex; gap: 0.6rem; align-items: flex-start;
  background: #0f2a1a;
  border: 1px solid #166534;
  border-radius: 10px;
  padding: 0.8rem 1rem;
  font-size: 0.85rem;
  color: #86efac;
}

.divider { border: none; border-top: 1px solid #2a2a4a; margin: 0.5rem 0; }

/* ── Dashboard ── */
#screen-dashboard { padding-bottom: 5rem; }
.dashboard-greeting { padding: 1.2rem 1.5rem 0.5rem; }
.dashboard-greeting h2 { font-size: 1.6rem; font-weight: 700; }
.dashboard-greeting p  { color: #8888bb; margin-top: 0.2rem; }

/* ── Quick Action Tiles ── */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  padding: 1rem 1rem 0.5rem;
}
.tile {
  background: #16163a;
  border: 1px solid #2a2a4a;
  border-radius: 12px;
  padding: 0.8rem 0.4rem;
  display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
  font-size: 0.75rem; color: #c0c0e0; cursor: pointer;
  transition: all 0.2s;
}
.tile:active { background: #1e1a4e; border-color: #6c63ff; transform: scale(0.96); }
.tile-icon { font-size: 1.4rem; }

/* ── Chat ── */
.chat-container { flex: 1; padding: 0.5rem 1rem; overflow-y: auto; }
.chat-messages  { display: flex; flex-direction: column; gap: 0.8rem; padding-bottom: 1rem; }

.msg { max-width: 85%; padding: 0.8rem 1rem; border-radius: 16px; font-size: 0.95rem; line-height: 1.5; word-break: break-word; }
.msg-user      { align-self: flex-end; background: linear-gradient(135deg, #6c63ff, #a78bfa); color: white; border-bottom-right-radius: 4px; }
.msg-assistant { align-self: flex-start; background: #16163a; border: 1px solid #2a2a4a; border-bottom-left-radius: 4px; }
.msg-error     { align-self: flex-start; background: #7f1d1d; border: 1px solid #ef4444; color: #fca5a5; }
.msg-thinking  { align-self: flex-start; background: #16163a; border: 1px solid #2a2a4a; border-radius: 16px; padding: 1rem 1.2rem; display: flex; gap: 0.3rem; align-items: center; }
.msg-thinking .dot { width: 8px; height: 8px; background: #6c63ff; border-radius: 50%; animation: bounce 1.2s infinite; }
.msg-thinking .dot:nth-child(2) { animation-delay: 0.2s; }
.msg-thinking .dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce { 0%,80%,100% { transform: translateY(0); } 40% { transform: translateY(-6px); } }

/* ── Chat Input Bar ── */
.chat-input-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; gap: 0.6rem; align-items: flex-end;
  padding: 0.8rem 1rem;
  background: #0a0a1a;
  border-top: 1px solid #2a2a4a;
}
.chat-input {
  flex: 1;
  background: #16163a;
  border: 2px solid #2a2a4a;
  color: #f0f0f0;
  border-radius: 12px;
  padding: 0.7rem 1rem;
  font-size: 1rem;
  resize: none;
  max-height: 120px;
  line-height: 1.4;
}
.chat-input:focus { outline: none; border-color: #6c63ff; }
.send-btn {
  background: linear-gradient(135deg, #6c63ff, #a78bfa);
  border: none;
  color: white;
  border-radius: 12px;
  width: 46px; height: 46px;
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}

/* ── Fraud Alert Overlay ── */
.fraud-alert {
  position: fixed; inset: 0;
  background: #000000cc;
  display: flex; align-items: center; justify-content: center;
  z-index: 999; padding: 1.5rem;
}
.fraud-alert.hidden { display: none; }
.fraud-alert-box {
  background: #1a0000;
  border: 2px solid #ef4444;
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
  max-width: 360px;
  width: 100%;
}
.fraud-icon { font-size: 3rem; margin-bottom: 0.5rem; }
.fraud-alert-box h3 { color: #ef4444; font-size: 1.3rem; margin-bottom: 0.8rem; }
.fraud-alert-box p  { color: #fca5a5; margin-bottom: 1.5rem; line-height: 1.5; }
.fraud-actions { display: flex; flex-direction: column; gap: 0.6rem; }

/* ── Settings Panel (overlay) ── */
.settings-panel {
  position: fixed; inset: 0;
  background: #0a0a1a;
  z-index: 200;
  flex-direction: column;
}

/* ── Tab Bar ── */
.tab-bar {
  display: flex;
  border-bottom: 1px solid #2a2a4a;
  background: #0a0a1a;
  position: sticky;
  top: 44px;
  z-index: 50;
}
.tab {
  flex: 1;
  background: none;
  border: none;
  color: #8888bb;
  padding: 0.7rem 0.4rem;
  font-size: 0.8rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}
.tab.active { color: #a78bfa; border-bottom-color: #6c63ff; }

.tab-content { display: none; flex: 1; }
.tab-content.active { display: flex; flex-direction: column; }

/* ── Check This Tab ── */
.check-panel { padding: 1.2rem; display: flex; flex-direction: column; gap: 1rem; }
.check-intro { text-align: center; padding: 0.5rem 0; }
.check-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.check-intro h3 { font-size: 1.1rem; margin-bottom: 0.4rem; }
.check-intro p { color: #8888bb; font-size: 0.9rem; line-height: 1.6; }
.check-textarea {
  background: #16163a;
  border: 2px solid #2a2a4a;
  color: #f0f0f0;
  border-radius: 12px;
  padding: 1rem;
  font-size: 0.95rem;
  resize: none;
  width: 100%;
  line-height: 1.5;
}
.check-textarea:focus { outline: none; border-color: #6c63ff; }
.check-btn { margin-top: 0.2rem; }
.check-result {
  border-radius: 12px;
  padding: 1rem;
  font-size: 0.9rem;
  line-height: 1.6;
}
.check-result.safe { background: #0f2a1a; border: 1px solid #166534; color: #86efac; }
.check-result.danger { background: #2a0a0a; border: 1px solid #7f1d1d; color: #fca5a5; }
.check-result.hidden { display: none; }

/* ── Scam Log Tab ── */
.log-panel { padding: 1.2rem; display: flex; flex-direction: column; gap: 0.8rem; }
.log-header-row { display: flex; justify-content: space-between; align-items: center; }
.log-header-row h3 { font-size: 1.1rem; }
.log-sub { color: #8888bb; font-size: 0.85rem; }
.btn-ghost-sm {
  background: none; border: 1px solid #2a2a4a; color: #8888bb;
  border-radius: 8px; padding: 0.3rem 0.8rem; font-size: 0.8rem; cursor: pointer;
}
.scam-log-list { display: flex; flex-direction: column; gap: 0.6rem; }
.log-entry {
  background: #16163a;
  border: 1px solid #2a2a4a;
  border-radius: 10px;
  padding: 0.8rem 1rem;
}
.log-entry.danger { border-color: #7f1d1d; background: #1a0a0a; }
.log-entry.safe  { border-color: #166534; background: #0a1a0f; }
.log-entry-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.3rem; }
.log-badge { font-size: 0.75rem; font-weight: 700; padding: 0.2rem 0.5rem; border-radius: 6px; }
.log-badge.danger { background: #7f1d1d; color: #fca5a5; }
.log-badge.safe  { background: #166534; color: #86efac; }
.log-time { font-size: 0.75rem; color: #8888bb; }
.log-text { font-size: 0.85rem; color: #c0c0e0; word-break: break-all; }
.log-empty { color: #8888bb; font-size: 0.9rem; text-align: center; padding: 2rem 0; }

/* ── Halo small ── */
.halo-small { position: relative; width: 60px; height: 60px; margin: 0 auto; }
.halo-ring-sm {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: #6c63ff;
  border-right-color: #6c63ff;
  animation: spin 2s linear infinite;
}
.shield-icon-sm { position: absolute; inset: 6px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; }
