/* ==========================================================================
   OFP Demo — Custom styles & animations
   Tailwind handles utility classes; this file handles bespoke effects.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Root & background
   -------------------------------------------------------------------------- */

:root {
  --brand:      #6366f1;
  --brand-glow: rgba(99, 102, 241, 0.35);
  --found-glow: rgba(239, 68, 68, 0.35);
  --safe-glow:  rgba(34, 197, 94, 0.3);
  --void:       #05050f;
}

.bg-void { background-color: var(--void); }

/* Animated mesh background */
.mesh-bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.mesh-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.18;
  animation: drift 20s ease-in-out infinite alternate;
}

.mesh-orb-1 {
  width: 700px; height: 700px;
  background: radial-gradient(circle, #6366f1 0%, transparent 70%);
  top: -200px; left: -200px;
  animation-duration: 22s;
}

.mesh-orb-2 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, #8b5cf6 0%, transparent 70%);
  bottom: -150px; right: -100px;
  animation-duration: 18s;
  animation-delay: -8s;
}

.mesh-orb-3 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, #06b6d4 0%, transparent 70%);
  top: 40%; left: 55%;
  opacity: 0.10;
  animation-duration: 26s;
  animation-delay: -4s;
}

@keyframes drift {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(40px, 30px) scale(1.05); }
  100% { transform: translate(-30px, 50px) scale(0.95); }
}

/* --------------------------------------------------------------------------
   Typography helpers
   -------------------------------------------------------------------------- */

.gradient-text {
  background: linear-gradient(135deg, #818cf8 0%, #c084fc 50%, #67e8f9 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* --------------------------------------------------------------------------
   Glass card
   -------------------------------------------------------------------------- */

.glass-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: border-color 0.2s;
}

/* --------------------------------------------------------------------------
   Form elements
   -------------------------------------------------------------------------- */

.field-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  margin-bottom: 0.4rem;
}

.field-input {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.5rem;
  color: #f1f5f9;
  font-size: 0.9rem;
  padding: 0.625rem 0.875rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}

.field-input::placeholder { color: #475569; }

.field-input:focus {
  border-color: rgba(99, 102, 241, 0.6);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.65rem 1.5rem;
  border-radius: 0.5rem;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
}

.btn-primary:hover  { opacity: 0.9; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-launch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #06b6d4 100%);
  background-size: 200% 200%;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  padding: 0.875rem 2.5rem;
  border-radius: 0.75rem;
  border: none;
  cursor: pointer;
  box-shadow: 0 0 30px rgba(99, 102, 241, 0.4);
  transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
  animation: gradient-shift 4s ease infinite;
}

.btn-launch:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 0 50px rgba(99, 102, 241, 0.6);
}

.btn-launch:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
  animation: none;
}

.btn-primary {
  background: linear-gradient(135deg, #6366f1, #818cf8);
  color: #fff;
  font-weight: 600;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.85; }

/* --------------------------------------------------------------------------
   Sites dialog (modal)
   -------------------------------------------------------------------------- */
.sites-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  animation: dialog-fade-in 0.2s ease-out;
}
.sites-dialog-backdrop.hidden {
  display: none !important;
}
.sites-dialog {
  width: 94vw;
  max-width: 960px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 1.5rem 2rem;
  animation: dialog-pop-in 0.25s ease-out;
  display: flex;
  flex-direction: column;
}
.sites-dialog #sites-grid {
  flex: 1;
  min-height: 0;
}
@keyframes dialog-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes dialog-pop-in {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes gradient-shift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* --------------------------------------------------------------------------
   Site selection toggles
   -------------------------------------------------------------------------- */

.site-toggle {
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.5rem;
  padding: 0.5rem 0.65rem;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.03);
  transition: all 0.18s;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.375rem;
  min-width: 0;
}

.site-toggle:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(99, 102, 241, 0.35);
}

.site-toggle.selected {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.15);
}

.site-toggle .check-icon {
  width: 1.125rem;
  height: 1.125rem;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.25rem;
  background: transparent;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.site-toggle.selected .check-icon {
  background: #6366f1;
  border-color: #6366f1;
}

.site-toggle .check-icon svg { display: none; }
.site-toggle.selected .check-icon svg { display: block; }

.site-mode-pill {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.4rem;
  border-radius: 9999px;
  flex-shrink: 0;
}

.site-mode-pill.quicksearch {
  background: rgba(6, 182, 212, 0.15);
  color: #67e8f9;
  border: 1px solid rgba(6, 182, 212, 0.25);
}

.site-mode-pill.fullai {
  background: rgba(139, 92, 246, 0.15);
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.25);
}

/* --------------------------------------------------------------------------
   Result cards
   -------------------------------------------------------------------------- */

.result-card {
  position: relative;
  border-radius: 1rem;
  padding: 1.25rem;
  overflow: hidden;
  transition: all 0.4s ease;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

/* Scanning state */
.result-card.scanning {
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.1);
}

/* Sweep animation for scanning state */
.scan-sweep {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(99, 102, 241, 0.06) 48%,
    rgba(99, 102, 241, 0.12) 50%,
    rgba(99, 102, 241, 0.06) 52%,
    transparent 100%
  );
  animation: sweep 2.4s ease-in-out infinite;
  pointer-events: none;
}

.result-card:not(.scanning) .scan-sweep { display: none; }

@keyframes sweep {
  0%   { transform: translateY(-100%); }
  100% { transform: translateY(200%); }
}

/* Found state */
.result-card.found {
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.06);
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.15);
  animation: found-pop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes found-pop {
  0%   { transform: scale(0.97); opacity: 0.7; }
  60%  { transform: scale(1.02); }
  100% { transform: scale(1);    opacity: 1; }
}

/* Not Found state */
.result-card.not-found {
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.04);
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.08);
  animation: fade-in 0.4s ease both;
}

/* Blocked state */
.result-card.blocked {
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.05);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.1);
}

/* Error state */
.result-card.error {
  border-color: rgba(107, 114, 128, 0.3);
  opacity: 0.7;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Status badges */
.status-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.scanning-badge {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.25);
}

.found-badge {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.safe-badge {
  background: rgba(34, 197, 94, 0.12);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.blocked-badge {
  background: rgba(245, 158, 11, 0.15);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.error-badge {
  background: rgba(107, 114, 128, 0.15);
  color: #9ca3af;
  border: 1px solid rgba(107, 114, 128, 0.25);
}

/* --------------------------------------------------------------------------
   Media preview hover overlay fix
   -------------------------------------------------------------------------- */

.media-wrap { position: relative; }

/* --------------------------------------------------------------------------
   Media modal
   -------------------------------------------------------------------------- */

#media-modal.open {
  display: flex;
}

/* --------------------------------------------------------------------------
   Scrollbar
   -------------------------------------------------------------------------- */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* --------------------------------------------------------------------------
   Fullscreen scan overlay
   -------------------------------------------------------------------------- */

#scan-overlay {
  background: radial-gradient(ellipse at 50% 45%, rgba(99, 102, 241, 0.07) 0%, rgba(5, 5, 15, 0.98) 65%);
  transition: opacity 0.65s ease, transform 0.65s ease;
}

#scan-overlay.exiting {
  opacity: 0;
  transform: scale(1.06);
  pointer-events: none;
}

/* Radar rings */
.radar-wrap {
  position: relative;
  width: 240px;
  height: 240px;
  flex-shrink: 0;
}

.radar-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(99, 102, 241, 0.45);
  animation: radar-expand 3.2s ease-out infinite;
}

.radar-ring:nth-child(1) { animation-delay: 0s; }
.radar-ring:nth-child(2) { animation-delay: -1.07s; }
.radar-ring:nth-child(3) { animation-delay: -2.13s; }

@keyframes radar-expand {
  0%   { transform: scale(0.15); opacity: 0; }
  12%  { opacity: 1; }
  80%  { opacity: 0.2; }
  100% { transform: scale(1.7); opacity: 0; }
}

.radar-core {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.radar-icon-ring {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 50px rgba(99, 102, 241, 0.3), inset 0 0 30px rgba(99, 102, 241, 0.08);
  animation: icon-breathe 2.4s ease-in-out infinite alternate;
}

@keyframes icon-breathe {
  0%   { box-shadow: 0 0 40px rgba(99, 102, 241, 0.25), inset 0 0 20px rgba(99, 102, 241, 0.06); }
  100% { box-shadow: 0 0 80px rgba(99, 102, 241, 0.55), inset 0 0 40px rgba(99, 102, 241, 0.12); }
}

/* --------------------------------------------------------------------------
   Main content reveal
   -------------------------------------------------------------------------- */

#results-main {
  transition: opacity 0.55s ease;
}

#results-main.main-hidden {
  opacity: 0;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Result card hidden state & flashy reveal
   -------------------------------------------------------------------------- */

.result-card.card-hidden {
  display: none;
}

/* Slam-in animation for newly revealed FOUND cards */
@keyframes card-slam {
  0%   { transform: scale(0.82) translateY(16px); opacity: 0; }
  65%  { transform: scale(1.03) translateY(-3px); }
  100% { transform: scale(1)    translateY(0);    opacity: 1; }
}

.result-card.card-revealed {
  animation: card-slam 0.55s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}
