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

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #0f0f1a;
  --bg-card: #12121f;
  --bg-card-hover: #16162a;
  --bg-input: #0d0d1a;
  --border: rgba(99, 102, 241, 0.15);
  --border-hover: rgba(99, 102, 241, 0.4);
  --accent: #6366f1;
  --accent-light: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.3);
  --accent-2: #a78bfa;
  --text-primary: #f0f0ff;
  --text-secondary: #8b8ba8;
  --text-muted: #55556a;
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.1);
  --warning: #f59e0b;
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.1);
  --gradient-1: linear-gradient(135deg, #6366f1, #a78bfa);
  --gradient-2: linear-gradient(135deg, #0f0f1a, #1a1a3e);
  --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.2);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* BACKGROUND MESH */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: 
    radial-gradient(ellipse 60% 50% at 20% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 80% 80%, rgba(167, 139, 250, 0.06) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* TYPOGRAPHY */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
}

a { color: var(--accent-light); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent-2); }

/* NAVBAR */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 0 2rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(10, 10, 15, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 800;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

/* NAVBAR INNER STRUCTURE (logo left, user info right) */
.navbar-inner {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--gradient-1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 16px var(--accent-glow);
}

.navbar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gradient-1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.navbar-username {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

@media (max-width: 600px) {
  .navbar-username { display: none; }
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  list-style: none;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  transition: var(--transition);
}

.nav-links a:hover {
  color: var(--text-primary);
  background: rgba(99, 102, 241, 0.1);
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.5rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
  outline: none;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--gradient-1);
  color: #fff;
  box-shadow: 0 0 20px var(--accent-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 30px rgba(99, 102, 241, 0.5);
  color: #fff;
}

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

.btn-secondary:hover {
  border-color: var(--border-hover);
  background: rgba(99, 102, 241, 0.05);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
  color: var(--danger);
}

.btn-success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.btn-sm {
  padding: 0.375rem 0.875rem;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 0.875rem 2rem;
  font-size: 1rem;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* CARDS */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-1);
  opacity: 0;
  transition: var(--transition);
  pointer-events: none; /* KRİTİK: bu olmadan görünmez katman kartın içindeki
                            tüm input/textarea/button'ların tıklanmasını ve
                            yazı yazılmasını engelliyordu (site genelinde
                            "butonlar çalışmıyor" sorununun asıl kaynağı). */
}

.card-hover:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

/* FORM ELEMENTS */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.form-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input, .form-select, .form-textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  padding: 0.75rem 1rem;
  transition: var(--transition);
  width: 100%;
  outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

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

.form-textarea { resize: vertical; min-height: 100px; }

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b8ba8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  cursor: pointer;
}

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

/* ALERTS */
.alert {
  padding: 0.875rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
}

.alert-error {
  background: var(--danger-bg);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

.alert-success {
  background: var(--success-bg);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
}

/* BADGES */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.625rem;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-active { background: var(--success-bg); color: var(--success); }
.badge-inactive { background: var(--danger-bg); color: var(--danger); }
.badge-purple { background: rgba(99, 102, 241, 0.15); color: var(--accent-light); }

/* STAT CARDS */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-1);
  pointer-events: none;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: 0.375rem;
}

.stat-label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* PROGRESS BAR */
.progress-bar-wrap {
  background: rgba(99, 102, 241, 0.1);
  border-radius: 100px;
  height: 6px;
  overflow: hidden;
  margin-top: 0.75rem;
}

.progress-bar-fill {
  height: 100%;
  background: var(--gradient-1);
  border-radius: 100px;
  transition: width 0.5s ease;
}

/* TABLES */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead {
  background: rgba(99, 102, 241, 0.05);
  border-bottom: 1px solid var(--border);
}

th {
  padding: 0.875rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

td {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr:hover td { background: rgba(99, 102, 241, 0.03); }

/* LAYOUT */
.page-wrapper {
  min-height: 100vh;
  padding-top: 64px;
  position: relative;
  z-index: 1;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

.container-narrow {
  max-width: 500px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.page-content {
  padding: 2.5rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

/* GRID */
.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

/* PAGE HEADER */
.page-header {
  margin-bottom: 2rem;
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.375rem;
}

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

/* DIVIDER */
.divider {
  height: 1px;
  background: var(--border);
  margin: 1.5rem 0;
}

/* CODE/KEY DISPLAY */
.key-display {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.625rem 1rem;
  font-family: 'Courier New', monospace;
  font-size: 0.8125rem;
  color: var(--accent-light);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  word-break: break-all;
}

.key-display code { flex: 1; }

/* ANIMATIONS */
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes glow {
  0%, 100% { box-shadow: 0 0 20px var(--accent-glow); }
  50% { box-shadow: 0 0 40px rgba(99, 102, 241, 0.5); }
}

.fade-in { animation: fadeIn 0.18s ease both; }

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(99, 102, 241, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

/* AUTH PAGES */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--bg-primary);
  position: relative;
}

.auth-wrapper::before {
  content: '';
  position: fixed;
  inset: 0;
  background: 
    radial-gradient(ellipse 70% 60% at 30% 30%, rgba(99, 102, 241, 0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 70% 70%, rgba(167, 139, 250, 0.08) 0%, transparent 60%);
  pointer-events: none;
}

/* auth-page / auth-container: alternate markup used by login & register pages */
.auth-page {
  min-height: 100vh;
  background: var(--bg-primary);
  position: relative;
}

.auth-page::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 60% at 30% 30%, rgba(99, 102, 241, 0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 70% 70%, rgba(167, 139, 250, 0.08) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.auth-container {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  width: 100%;
  max-width: 440px;
  position: relative;
  box-shadow: var(--shadow-card);
  animation: fadeIn 0.5s ease;
}

.auth-brand {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-brand .brand-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  margin: 0 auto 1.1rem;
  box-shadow: 0 0 28px var(--accent-glow);
}

.auth-brand .auth-title {
  text-align: center;
  margin-bottom: 0.375rem;
}

.auth-brand .auth-subtitle {
  margin-bottom: 0;
}

.auth-logo {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.03em;
  text-align: center;
  margin-bottom: 0.5rem;
}

.auth-subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

.auth-title {
  font-size: 1.375rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.auth-footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* TOAST */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.875rem 1.25rem;
  font-size: 0.875rem;
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 280px;
  animation: fadeIn 0.3s ease;
  color: var(--text-primary);
}

.toast-success { border-left: 3px solid var(--success); }
.toast-error { border-left: 3px solid var(--danger); }
.toast-info { border-left: 3px solid var(--accent); }

/* SIDEBAR LAYOUT */
.dashboard-layout {
  display: flex;
  min-height: calc(100vh - 64px);
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  overflow-y: auto;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6875rem 1rem;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.sidebar-item:hover {
  background: rgba(99, 102, 241, 0.08);
  color: var(--text-primary);
}

.sidebar-item.active {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-light);
}

.sidebar-item svg { flex-shrink: 0; }

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.sidebar-section {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0.5rem 1rem 0.25rem;
  margin-top: 0.5rem;
}

.dashboard-main {
  flex: 1;
  min-width: 0;
  padding: 2rem;
  overflow-y: auto;
}

/* CHAT */
.chat-layout {
  display: flex;
  height: calc(100vh - 64px);
}

.chat-sidebar {
  width: 280px;
  flex-shrink: 0;
  min-height: 0;
  overflow-y: auto;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--bg-primary);
}

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

.message {
  display: flex;
  gap: 1rem;
  animation: fadeIn 0.3s ease;
  max-width: 800px;
}

.message.user { flex-direction: row-reverse; margin-left: auto; }

.msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 700;
  flex-shrink: 0;
}

.msg-avatar.ai {
  background: var(--gradient-1);
  color: #fff;
}

.msg-avatar.user {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-light);
  border: 1px solid var(--border);
}

.msg-bubble {
  padding: 0.875rem 1.125rem;
  border-radius: var(--radius-lg);
  font-size: 0.9375rem;
  line-height: 1.7;
  max-width: calc(100% - 52px);
}

.message.ai .msg-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-top-left-radius: 4px;
}

.message.user .msg-bubble {
  background: var(--gradient-1);
  color: #fff;
  border-top-right-radius: 4px;
}

.msg-bubble pre {
  background: rgba(0,0,0,0.3);
  border-radius: 8px;
  padding: 1rem;
  overflow-x: auto;
  margin: 0.75rem 0;
  font-size: 0.8125rem;
}

.msg-bubble code {
  font-family: 'Courier New', monospace;
  font-size: 0.875em;
  background: rgba(99, 102, 241, 0.15);
  padding: 0.1em 0.4em;
  border-radius: 4px;
}

.msg-bubble pre code { background: none; padding: 0; }

.chat-input-area {
  padding: 1rem 1.5rem 1.5rem;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
}

.chat-input-wrap {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.75rem 1rem;
  transition: var(--transition);
}

.chat-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

#chat-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  resize: none;
  max-height: 150px;
  line-height: 1.6;
}

#chat-input::placeholder { color: var(--text-muted); }

.chat-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--gradient-1);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
}

.chat-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 16px var(--accent-glow);
}

.chat-send-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.chat-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-secondary);
}

.model-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 100px;
  padding: 0.375rem 0.875rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-light);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2s ease infinite;
}

.token-meter {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.token-meter-bar {
  flex: 1;
  height: 4px;
  background: rgba(99, 102, 241, 0.1);
  border-radius: 100px;
  overflow: hidden;
}

.token-meter-fill {
  height: 100%;
  background: var(--gradient-1);
  border-radius: 100px;
  transition: width 0.5s ease;
}

/* KEY SELECTOR */
.key-selector {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}

.key-selector select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.8125rem;
  padding: 0.625rem 0.875rem;
  outline: none;
  transition: var(--transition);
  font-family: var(--font-body);
}

.key-selector select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* MODAL */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-card), var(--shadow-glow);
  animation: fadeIn 0.3s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 6px;
  transition: var(--transition);
  display: flex;
  align-items: center;
}

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

/* THINKING DOTS */
.thinking-dots span {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin: 0 2px;
  animation: pulse 1.4s ease infinite;
}
.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }

/* STREAM CURSOR (canlı token akışı göstergesi) */
.stream-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--accent-light);
  margin-left: 2px;
  vertical-align: text-bottom;
  border-radius: 1px;
  animation: blink .7s step-end infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }

/* RESPONSIVE */
@media (max-width: 900px) {
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .chat-sidebar { width: 0; overflow: hidden; display: none; }
}

/* GPT-5.6 enhanced spatial depth */
body::after {
  content: '';
  position: fixed;
  width: 42vw;
  height: 42vw;
  min-width: 420px;
  min-height: 420px;
  right: -18vw;
  bottom: -24vw;
  border-radius: 50%;
  pointer-events: none;
  background: conic-gradient(from 120deg, rgba(34,211,238,.16), rgba(99,102,241,.04), rgba(168,85,247,.18), rgba(34,211,238,.16));
  filter: blur(70px);
  animation: spatialOrbit 18s linear infinite;
  z-index: 0;
}
@keyframes spatialOrbit { to { transform: rotate(360deg) scale(1.08); } }

.app-layout, .dashboard-layout, .home-wrapper, .admin-container, .page-container {
  position: relative;
  z-index: 1;
  perspective: 1400px;
}
.sidebar {
  background: linear-gradient(180deg, rgba(13,16,35,.96), rgba(6,8,20,.94));
  border-right: 1px solid rgba(139,92,246,.18);
  box-shadow: 18px 0 55px rgba(0,0,0,.30), inset -1px 0 rgba(255,255,255,.035);
  backdrop-filter: blur(22px);
}
.sidebar-item {
  position: relative;
  transform-style: preserve-3d;
}
.sidebar-item::before {
  content: '';
  position: absolute;
  inset: 5px auto 5px 0;
  width: 2px;
  border-radius: 999px;
  background: linear-gradient(var(--cyan), var(--violet));
  opacity: 0;
  box-shadow: 0 0 16px var(--cyan);
  transition: opacity .22s ease;
}
.sidebar-item.active::before, .sidebar-item:hover::before { opacity: 1; }

.card, .stat-card, .guide-card, .redeem-card, .api-card, .auth-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}
.card::after, .stat-card::after, .guide-card::after, .redeem-card::after, .api-card::after, .auth-card::after {
  content: '';
  position: absolute;
  inset: -60% -80%;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 42%, rgba(255,255,255,.07) 49%, transparent 56%);
  transform: translateX(-35%) rotate(8deg);
  transition: transform .8s cubic-bezier(.2,.8,.2,1);
}
.card:hover::after, .stat-card:hover::after, .guide-card:hover::after, .redeem-card:hover::after, .api-card:hover::after, .auth-card:hover::after {
  transform: translateX(35%) rotate(8deg);
}
.stat-card { transform: translateZ(0); }
.stat-card:hover { transform: perspective(900px) translateY(-6px) rotateX(2deg) translateZ(12px); }

.message .msg-bubble {
  border: 1px solid rgba(255,255,255,.075);
  box-shadow: 0 14px 40px rgba(0,0,0,.22), inset 0 1px rgba(255,255,255,.04);
  backdrop-filter: blur(14px);
}
.message.ai .msg-bubble { background: linear-gradient(145deg, rgba(20,23,43,.88), rgba(11,13,29,.82)); }
.message.user .msg-bubble { box-shadow: 0 14px 42px rgba(99,102,241,.20), inset 0 1px rgba(255,255,255,.16); }

.progress-bar-fill, .live-status-dot { filter: saturate(1.2); }
@media (max-width: 760px), (prefers-reduced-motion: reduce) {
  body::after { animation: none; }
  .stat-card:hover { transform: none; }
}

@media (max-width: 600px) {
  .grid-4, .grid-2 { grid-template-columns: 1fr; }
  .dashboard-main { padding: 1rem; }
  .auth-card { padding: 1.5rem; }
}

/* EMPTY STATE */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-secondary);
}

.empty-state h3 {
  font-size: 1.125rem;
  color: var(--text-primary);
  margin: 1rem 0 0.5rem;
}

/* SCROLLBAR */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(99,102,241,0.3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(99,102,241,0.5); }

/* ===== EKLENTİ STİLLER ===== */
.badge-purple {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
  border: 1px solid rgba(139, 92, 246, 0.25);
}

.sidebar-footer {
  margin-top: auto;
  padding: 1rem;
  border-top: 1px solid var(--border);
}

/* Admin panel form-row */
.form-row {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
}
.form-row .form-group {
  flex: 1;
  min-width: 200px;
}

/* Table compact */
.compact-table td, .compact-table th {
  padding: .5rem .75rem;
  font-size: .8125rem;
}

/* Warning color */
:root {
  --warning: #f59e0b;
}

/* NAV LINKS ACTIVE & MOBILE RESPONSIVE NAV OVERRIDE */
.nav-links a.active {
  color: var(--text-primary);
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.25);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.05);
}

@media (max-width: 900px) {
  .navbar {
    height: auto;
    padding: 0.75rem 1rem;
  }
  .navbar-inner {
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.75rem;
  }
  .nav-links {
    width: 100%;
    justify-content: center;
    overflow-x: auto;
    white-space: nowrap;
    padding: 0.25rem 0;
  }
  .nav-links::-webkit-scrollbar {
    display: none;
  }
}

/* SSS / FAQ ACCORDION STYLES */
.faq-section {
  max-width: 800px;
  margin: 3.5rem auto;
  padding: 0 1.5rem;
}
.faq-title {
  text-align: center;
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 2rem;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.faq-container {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}
.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
}
.faq-item:hover {
  border-color: var(--border-hover);
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.04);
}
.faq-trigger {
  width: 100%;
  padding: 1.15rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  outline: none;
}
.faq-trigger svg {
  transition: var(--transition);
  color: var(--accent-light);
  flex-shrink: 0;
}
.faq-item.active .faq-trigger svg {
  transform: rotate(180deg);
  color: var(--accent-2);
}
.faq-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0, 1, 0, 1);
  background: rgba(10, 10, 15, 0.3);
}
.faq-content-inner {
  padding: 1.15rem 1.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.55;
  border-top: 1px solid var(--border);
}

/* TOKEN USAGE AND BADGES */
.msg-token-usage {
  margin-top: 0.50rem;
  font-size: 0.68rem;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 0.35rem;
  width: 100%;
  letter-spacing: 0.02em;
}
.msg-token-usage.local {
  color: var(--success);
  font-weight: 500;
}
.msg-token-usage svg {
  flex-shrink: 0;
}

/* 2026 spatial interface layer */
:root {
  --surface-glass: rgba(15, 18, 34, .72);
  --surface-highlight: rgba(255, 255, 255, .075);
  --cyan: #22d3ee;
  --violet: #8b5cf6;
  --depth-shadow: 0 28px 80px rgba(0, 0, 0, .42), 0 1px 0 rgba(255,255,255,.08) inset;
}

html { color-scheme: dark; scroll-behavior: smooth; }
body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 8%, rgba(34,211,238,.13), transparent 28rem),
    radial-gradient(circle at 88% 18%, rgba(139,92,246,.16), transparent 32rem),
    linear-gradient(155deg, #050711 0%, #090b18 46%, #070816 100%);
  background-attachment: fixed;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .18;
  background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, #000, transparent 82%);
  z-index: 0;
}

.navbar {
  background: rgba(6, 8, 20, .72);
  border-bottom: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 12px 40px rgba(0,0,0,.28);
  backdrop-filter: blur(22px) saturate(145%);
}
.brand-icon {
  position: relative;
  transform: perspective(260px) rotateX(8deg) rotateY(-10deg);
  box-shadow: -8px 12px 28px rgba(99,102,241,.38), inset 0 1px rgba(255,255,255,.32);
}
.brand-icon::after {
  content: '';
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: inherit;
}

.card, .stat-card, .guide-card, .redeem-card, .auth-card, .api-card, .pool-card, .chat-sidebar, .chat-main {
  background: linear-gradient(145deg, rgba(23,26,48,.80), rgba(10,12,27,.72));
  border: 1px solid rgba(255,255,255,.10);
  box-shadow: var(--depth-shadow);
  backdrop-filter: blur(18px) saturate(125%);
  transform-style: preserve-3d;
}
.tilt-3d {
  will-change: transform;
  transition: transform .18s ease, border-color .25s ease, box-shadow .25s ease;
}
.tilt-3d:hover {
  border-color: rgba(99,102,241,.4);
  box-shadow: 0 32px 90px rgba(0,0,0,.48), 0 0 35px rgba(99,102,241,.10), inset 0 1px rgba(255,255,255,.10);
}

.btn-primary {
  position: relative;
  overflow: hidden;
  background: linear-gradient(120deg, #6366f1, #8b5cf6 54%, #22d3ee);
  box-shadow: 0 10px 30px rgba(99,102,241,.30), inset 0 1px rgba(255,255,255,.30);
}
.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 25%, rgba(255,255,255,.28) 48%, transparent 70%);
  transform: translateX(-130%);
  transition: transform .65s ease;
}
.btn-primary:hover::before { transform: translateX(130%); }
.btn:hover { transform: translateY(-2px); }

.form-input, textarea.form-input, select.form-input {
  background: rgba(3,5,15,.62);
  border-color: rgba(255,255,255,.10);
  box-shadow: inset 0 2px 12px rgba(0,0,0,.24);
}
.form-input:focus {
  border-color: rgba(34,211,238,.62);
  box-shadow: 0 0 0 4px rgba(34,211,238,.09), inset 0 2px 12px rgba(0,0,0,.2);
}

.live-status {
  display: inline-flex;
  align-items: center;
  gap: .42rem;
  min-height: 31px;
  padding: .32rem .65rem;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 999px;
  background: rgba(255,255,255,.04);
  color: var(--text-secondary);
  font-size: .72rem;
  font-weight: 700;
}
.live-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f59e0b;
  box-shadow: 0 0 0 4px rgba(245,158,11,.10), 0 0 12px rgba(245,158,11,.5);
}
.live-status.online .live-status-dot { background: #34d399; box-shadow: 0 0 0 4px rgba(52,211,153,.10), 0 0 14px rgba(52,211,153,.65); animation: livePulse 1.8s infinite; }
.live-status.offline .live-status-dot { background: #fb7185; box-shadow: 0 0 0 4px rgba(251,113,133,.10); }
.live-status-latency { color: var(--cyan); font-variant-numeric: tabular-nums; }
@keyframes livePulse { 50% { transform: scale(.75); opacity: .72; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media (max-width: 900px) {
  .live-status-latency, .live-status-label { display: none; }
  .live-status { padding: .4rem; min-height: auto; }
}
