:root {
  --bg-dark: #0f172a;
  --bg-card: rgba(30, 41, 59, 0.85);
  --bg-card-border: rgba(255, 255, 255, 0.1);
  --text-primary: #f8fafc;
  --text-muted: #94a3b8;
  --primary-color: #6366f1;
  --primary-hover: #4f46e5;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --danger-hover: #dc2626;
  --secondary-bg: #334155;
  --secondary-hover: #475569;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
  background: radial-gradient(circle at top, #1e1b4b 0%, #0f172a 60%);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 92%;
  max-width: 1000px;
  margin: 20px auto 0;
  padding: 14px 24px;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.15rem;
  color: #818cf8;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.container {
  width: 92%;
  max-width: 1000px;
  margin: 24px auto 40px;
  flex: 1;
}

.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.user-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--bg-card-border);
}

.user-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-size: 0.85rem;
  font-weight: 600;
}

.user-text {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
}

.badge-neutral {
  background: rgba(148, 163, 184, 0.15);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.85rem;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--secondary-bg);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--secondary-hover);
}

.btn-danger {
  background: var(--danger-color);
  color: white;
}

.btn-danger:hover {
  background: var(--danger-hover);
}

.btn-block {
  width: 100%;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: #cbd5e1;
}

.input-control {
  width: 100%;
  padding: 10px 14px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.input-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}

/* Alerts */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

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

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

/* Table */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.table th, .table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--bg-card-border);
}

.table th {
  background: rgba(15, 23, 42, 0.5);
  color: var(--text-muted);
  font-weight: 600;

}

.table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.tab-btn {
  padding: 10px 20px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

.tab-btn.active {
  color: #818cf8;
  border-bottom-color: #818cf8;
}

/* Markdown Rendering Container */
.markdown-body {
  line-height: 1.7;
  color: #e2e8f0;
}

.markdown-body h1, .markdown-body h2, .markdown-body h3 {
  color: #f8fafc;
  margin-top: 1.5em;
  margin-bottom: 0.6em;
}

.markdown-body h1 {
  font-size: 1.8rem;
  border-bottom: 1px solid var(--bg-card-border);
  padding-bottom: 10px;
}

.markdown-body p {
  margin-bottom: 1em;
}

.markdown-body a {
  color: #818cf8;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.markdown-body img {
  max-width: 100%;
  border-radius: var(--radius-md);
  margin: 16px 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.markdown-body code {
  background: rgba(15, 23, 42, 0.8);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.9em;
  color: #f472b6;
}

.markdown-body pre {
  background: #0f172a;
  padding: 16px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: 16px 0;
  border: 1px solid var(--bg-card-border);
}

.markdown-body blockquote {
  border-left: 4px solid #6366f1;
  padding-left: 16px;
  margin: 16px 0;
  color: #94a3b8;
  background: rgba(99, 102, 241, 0.05);
  padding-top: 8px;
  padding-bottom: 8px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Loading Spinner */
.loading-spinner {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(99, 102, 241, 0.2);
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Login Wrapper */
.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  margin: 0;
}

.logo-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.card-header {
  text-align: center;
  margin-bottom: 24px;
}

.card-title {
  font-size: 1.5rem;
  font-weight: 700;
}

.card-subtitle {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 6px;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: #1e293b;
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  padding: 24px;
  box-shadow: var(--shadow);
}

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

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

.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.close-btn:hover {
  color: white;
}

.footer {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.hidden {
  display: none !important;
}

.token-code {
  font-family: monospace;
  background: rgba(0, 0, 0, 0.3);
  padding: 3px 8px;
  border-radius: 4px;
  color: #a5b4fc;
  font-size: 0.85rem;
  user-select: all;
}
