@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  --bg-dark: #020617;
  --sidebar-bg: rgba(15, 23, 42, 0.8);
  --card-bg: rgba(30, 41, 59, 0.4);
  --primary: #6366f1;
  --primary-glow: rgba(99, 102, 241, 0.3);
  --secondary: #10b981;
  --accent: #f59e0b;
  --danger: #ef4444;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --border: rgba(255, 255, 255, 0.08);
  --glass-effect: blur(16px) saturate(180%);
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-primary);
  height: 100vh;
  display: flex;
  overflow: hidden;
  background-image: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.1) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.05) 0px, transparent 50%);
}

/* Sidebar Navigation */
.sidebar {
  width: 280px;
  background: var(--sidebar-bg);
  backdrop-filter: var(--glass-effect);
  border-right: 1px solid var(--border);
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.logo {
  font-family: 'Outfit', sans-serif;
  font-size: 1.75rem;
  font-weight: 800;
  background: linear-gradient(to right, #818cf8, #34d399);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 3rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.nav-item i {
  width: 20px;
  height: 20px;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 20px var(--primary-glow);
}

.badge {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 6px;
  margin-left: auto;
  font-weight: 700;
  text-transform: uppercase;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #1e293b;
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 10px 25px rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 1000;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Main Content */
.main-content {
  flex-grow: 1;
  padding: 2.5rem;
  overflow-y: auto;
  position: relative;
}

header {
  margin-bottom: 2.5rem;
}

h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 2.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* Tab Panels */
.tab-panel {
  display: none;
  animation: slideUp 0.5s ease-out;
}

.tab-panel.active {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Cards & Components */
.card {
  background: var(--card-bg);
  backdrop-filter: var(--glass-effect);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 2rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  transition: border-color 0.3s;
}

.card:hover {
  border-color: rgba(99, 102, 241, 0.3);
}

h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Form Styling */
.form-group {
  margin-bottom: 1.5rem;
}

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

input, select, textarea {
  width: 100%;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.875rem 1rem;
  color: white;
  font-size: 1rem;
  transition: all 0.3s;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(15, 23, 42, 0.8);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: white;
  border: none;
  padding: 1rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px var(--primary-glow);
}

.btn-icon {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: white;
  padding: 0.5rem;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-top-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

/* RESPONSIVE DESIGN */
@media (max-width: 1024px) {
  body {
    flex-direction: column;
    overflow-y: auto;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transform: translateX(-100%);
    box-shadow: 20px 0 50px rgba(0,0,0,0.5);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    padding: 1.5rem;
    overflow-y: visible;
  }

  .mobile-top-bar {
    display: flex;
  }

  header h1 {
    font-size: 1.75rem;
  }

  .chat-window {
    height: 500px;
  }

  .card {
    padding: 1.5rem;
  }
}

@media (max-width: 640px) {
  .tab-panel.active {
    grid-template-columns: 1fr;
  }

  .msg {
    max-width: 90%;
  }

  .risk-circle {
    width: 120px;
    height: 120px;
  }

  .risk-value {
    font-size: 1.75rem;
  }
}

/* Fraud Results */
.risk-container {
  text-align: center;
  padding: 2rem 0;
}

.risk-circle {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  margin: 0 auto 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 8px solid rgba(255, 255, 255, 0.05);
  position: relative;
}

.risk-value {
  font-family: 'Outfit', sans-serif;
  font-size: 2.5rem;
  font-weight: 800;
}

.risk-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Chat UI */
.chat-window {
  display: flex;
  flex-direction: column;
  height: 600px;
  background: rgba(15, 23, 42, 0.3);
  border-radius: 20px;
  overflow: hidden;
}

.chat-messages {
  flex-grow: 1;
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.msg {
  max-width: 80%;
  padding: 1rem 1.25rem;
  border-radius: 18px;
  font-size: 0.95rem;
  line-height: 1.5;
  position: relative;
}

.msg.user {
  align-self: flex-end;
  background: var(--primary);
  color: white;
  border-bottom-right-radius: 4px;
}

.msg.bot {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.msg .sources {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.chat-input-area {
  padding: 1.5rem;
  background: rgba(15, 23, 42, 0.6);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 1rem;
}

/* Typing Indicator */
.typing {
  display: flex;
  gap: 4px;
  padding: 0.5rem;
}

.typing span {
  width: 6px;
  height: 6px;
  background: var(--text-secondary);
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out both;
}

.typing span:nth-child(1) { animation-delay: -0.32s; }
.typing span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1.0); }
}

/* Json Output */
.json-view {
  background: #000;
  border-radius: 12px;
  padding: 1rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: #6ee7b7;
  overflow-x: auto;
  max-height: 300px;
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }
