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

:root {
  --primary: #4F46E5;
  --primary-hover: #4338CA;
  --primary-light: #EEF2FF;
  --bg: #F4F7FB;
  --surface: #FFFFFF;
  --text: #0F172A;
  --text-muted: #64748B;
  --text-lighter: #94A3B8;
  --border: #E2E8F0;
  --ring: rgba(79, 70, 229, 0.16);
  --sidebar-bg: linear-gradient(180deg, #0B1220 0%, #111827 100%);
  --sidebar-surface: rgba(255, 255, 255, 0.06);
  --sidebar-border: rgba(255, 255, 255, 0.08);
  --sidebar-text: rgba(226, 232, 240, 0.82);
  --sidebar-text-strong: #FFFFFF;
  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.06);
  --shadow-md: 0 12px 24px -12px rgba(15, 23, 42, 0.16);
  --shadow-lg: 0 30px 60px -28px rgba(15, 23, 42, 0.3);
  --radius-md: 12px;
  --radius-lg: 20px;
}

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

body {
  font-family: 'Manrope', sans-serif;
  background:
    radial-gradient(circle at top left, rgba(79, 70, 229, 0.09), transparent 30%),
    radial-gradient(circle at top right, rgba(14, 165, 233, 0.07), transparent 22%),
    radial-gradient(circle at bottom right, rgba(15, 23, 42, 0.05), transparent 28%),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}

h1, h2, h3, h4, h5, h6, .brand-logo {
  font-family: 'Outfit', sans-serif;
  letter-spacing: -0.02em;
}

/* Dashboard Layout */
.dashboard-wrapper { display: flex; min-height: 100vh; }
.sidebar {
  width: 300px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  border-right: 1px solid rgba(148, 163, 184, 0.12);
  display: flex;
  flex-direction: column;
  padding: 1.6rem 1.3rem;
  position: fixed;
  height: 100vh;
  z-index: 10;
  box-shadow: 30px 0 60px -56px rgba(15, 23, 42, 0.8);
}
.sidebar::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top left, rgba(99, 102, 241, 0.18), transparent 24%),
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: auto, 34px 34px, 34px 34px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.6), transparent 92%);
  pointer-events: none;
}
.sidebar > * { position: relative; z-index: 1; }
.sidebar .brand-logo {
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--sidebar-text-strong);
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 0.5rem; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.95rem 1rem;
  color: var(--sidebar-text);
  font-weight: 700;
  font-size: 0.95rem;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  background: transparent;
  width: 100%;
  text-align: left;
}
.nav-item:hover {
  background: var(--sidebar-surface);
  color: var(--sidebar-text-strong);
  border-color: var(--sidebar-border);
}
.nav-item.active {
  background: linear-gradient(145deg, rgba(79, 70, 229, 0.32), rgba(129, 140, 248, 0.16));
  color: #FFFFFF;
  border-color: rgba(165, 180, 252, 0.24);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.main-content {
  flex: 1;
  margin-left: 300px;
  padding: 3rem 4rem;
  overflow-y: auto;
  min-height: 100vh;
}
.header-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 3rem; }
.header-top h1 { font-size: clamp(2rem, 2vw + 1rem, 2.6rem); color: var(--text); }

/* Auth Layout */
.auth-wrapper { display: flex; min-height: 100vh; }
.auth-left {
  flex: 1.1;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.12), transparent 28%),
    linear-gradient(145deg, #312E81 0%, #4338CA 45%, #0F172A 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4rem;
  color: white;
  position: relative;
  overflow: hidden;
}
.auth-left::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.55), transparent 85%);
  pointer-events: none;
}
.auth-left > * { position: relative; z-index: 1; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  width: fit-content;
  padding: 0.5rem 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1.5rem;
}
.auth-left h1 { font-size: clamp(3rem, 4vw, 4.6rem); margin-bottom: 1rem; line-height: 1.02; max-width: 760px; }
.auth-left p { font-size: 1.15rem; opacity: 0.9; max-width: 640px; line-height: 1.8; }
.hero-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: 2.5rem; max-width: 760px; }
.hero-item {
  padding: 1.1rem 1.2rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  backdrop-filter: blur(8px);
}
.hero-item strong { display: block; font-size: 1rem; margin-bottom: 0.35rem; }
.hero-item span { display: block; opacity: 0.82; font-size: 0.95rem; line-height: 1.6; }
.hero-stat-row { display: flex; gap: 1rem; margin-top: 2rem; flex-wrap: wrap; }
.hero-stat {
  min-width: 150px;
  padding: 1rem 1.2rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.hero-stat strong { display: block; font-size: 1.6rem; line-height: 1.1; }
.hero-stat span { display: block; font-size: 0.9rem; opacity: 0.78; margin-top: 0.35rem; }
.auth-right { flex: 0.9; display: flex; align-items: center; justify-content: center; padding: 2rem; }
.auth-card {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  padding: 3rem 3rem 2.5rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  border: 1px solid rgba(226, 232, 240, 0.8);
}
.auth-card h2 { font-size: 1.9rem; margin-bottom: 0.5rem; }
.auth-card p.subtitle { color: var(--text-muted); margin-bottom: 2rem; }
.auth-note {
  margin-top: 1.25rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: center;
}

/* Components */
.card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(226, 232, 240, 0.92);
  border-radius: 26px;
  padding: 2.25rem;
  box-shadow: 0 30px 60px -42px rgba(15, 23, 42, 0.35);
  margin-bottom: 2rem;
  backdrop-filter: blur(12px);
}
.card-header { margin-bottom: 1.75rem; }
.card-header h3 { font-size: 1.25rem; color: var(--text); margin-bottom: 0.25rem; }
.card-header p { color: var(--text-muted); font-size: 0.92rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.9rem 1.5rem;
  background: linear-gradient(145deg, var(--primary), var(--primary-hover));
  color: white;
  border: none;
  border-radius: 14px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 16px 28px -18px rgba(79, 70, 229, 0.75);
  text-decoration: none;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.03); }
.btn-outline {
  background: rgba(255, 255, 255, 0.04);
  color: var(--sidebar-text-strong);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: none;
}
.btn-outline:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: none;
  border-color: rgba(255, 255, 255, 0.2);
}

.input-group { margin-bottom: 1.5rem; }
.input-group label { display: block; font-weight: 700; font-size: 0.9rem; margin-bottom: 0.5rem; color: var(--text); }
.input-group input, .input-group textarea, .input-group select, select {
  width: 100%;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--surface);
  transition: all 0.2s ease;
  outline: none;
  box-shadow: var(--shadow-sm);
}
.input-group input:focus, .input-group textarea:focus, .input-group select:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--ring);
}
.input-group input::placeholder, .input-group textarea::placeholder { color: var(--text-lighter); }
.input-group textarea { resize: vertical; min-height: 120px; }

.code-block {
  background: #0F172A;
  color: #C4B5FD;
  padding: 1.5rem;
  border-radius: var(--radius-md);
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.875rem;
  white-space: pre-wrap;
  word-break: break-all;
  margin-bottom: 1.5rem;
  border: 1px solid #1E293B;
  line-height: 1.6;
}

code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace; }
hr { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }

/* History Viewer */
.history-session { background: rgba(255, 255, 255, 0.92); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 1.5rem; margin-bottom: 1.5rem; box-shadow: var(--shadow-sm); }
.history-date { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1rem; text-align: center; font-weight: 700; background: var(--bg); padding: 0.55rem 0.8rem; border-radius: 999px; display: inline-block; }
.msg { padding: 12px 16px; border-radius: 14px; font-size: 0.95rem; margin-bottom: 0.75rem; max-width: 80%; line-height: 1.6; white-space: pre-wrap; }
.msg-user { background: var(--bg); border: 1px solid var(--border); margin-right: auto; color: var(--text); border-bottom-left-radius: 6px; }
.msg-bot { background: var(--primary); color: white; margin-left: auto; border-bottom-right-radius: 6px; box-shadow: 0 8px 18px -12px rgba(79, 70, 229, 0.6); }

.tab-content { display: none; animation: fadeIn 0.3s ease; }
.tab-content.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* Mobile */
@media (max-width: 1180px) {
  .auth-wrapper { flex-direction: column; }
  .auth-left, .auth-right { flex: none; }
}

@media (max-width: 1024px) {
  .auth-left { padding: 3rem 2rem; }
  .auth-right { padding: 1.5rem; }
  .hero-list { grid-template-columns: 1fr; }
  .sidebar { width: 250px; }
  .main-content { margin-left: 250px; padding: 2rem; }
}

@media (max-width: 768px) {
  .dashboard-wrapper { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; padding: 1rem; border-right: none; border-bottom: 1px solid var(--border); }
  .sidebar .brand-logo { margin-bottom: 1rem; }
  .sidebar-nav { flex-direction: row; overflow-x: auto; padding-bottom: 0.5rem; }
  .nav-item { white-space: nowrap; }
  .main-content { margin-left: 0; padding: 1.5rem; min-height: auto; }
  .auth-left h1 { font-size: 2.6rem; }
  .auth-card { padding: 2rem 1.5rem; }
}
