/* ==========================================================================
   BotForge Design System — VS Code Inspired Dark Theme
   ========================================================================== */

/* --- Fonts & Reset --- */
@import url('https://fonts.googleapis.com/css2?family=Segoe+UI:wght@400;500;600;700&family=Fira+Code:wght@400;500&display=swap');

:root {
  /* True Dark Theme Base */
  --bg-deep: #0e1621;
  --bg-card: #1c2431;
  --bg-card-hover: #242f3d;
  --bg-input: #0f172a;
  --bg-focus: #1e293b;

  --primary: #38bdf8;
  --primary-hover: #0284c7;
  --primary-glow: rgba(56, 189, 248, 0.15);

  --accent: #818cf8;
  --accent-glow: rgba(129, 140, 248, 0.15);

  --text-primary: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dark: #cbd5e1;

  --border-color: rgba(255, 255, 255, 0.1);
  --border-focus: #38bdf8;
  --border-highlight: rgba(56, 189, 248, 0.15);
  --border-shadow: rgba(0, 0, 0, 0.2);
  --border-dark-shadow: rgba(0, 0, 0, 0.3);

  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #3b82f6;

  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --transition-smooth: all 0.2s ease;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-deep);
  color: var(--text-primary);
  font-family: 'Segoe UI', 'Helvetica Neue', sans-serif;
  font-size: 13px;
  overflow-x: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
}

/* --- Typographical Overrides --- */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Segoe UI', sans-serif;
  font-weight: 600;
  line-height: 1.4;
}

/* --- Custom Scrollbar --- */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  border: 3px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255, 255, 255, 0.2);
  background-clip: padding-box;
}

/* --- Layouts & Containers --- */
.hidden {
  display: none !important;
}

.glow-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: transparent;
  z-index: -1;
  pointer-events: none;
}

/* --- Modern Clean Card Style --- */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.glass-card:hover {
  background-color: var(--bg-card-hover);
  transform: translateY(-1px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.3);
}

/* --- Form Fields & Buttons --- */
.input-group {
  margin-bottom: 16px;
}

.input-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.text-input {
  width: 100%;
  padding: 10px 14px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  transition: var(--transition-smooth);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

.text-input::placeholder {
  color: var(--text-muted);
}

.text-input:focus {
  outline: none;
  background-color: var(--bg-focus);
  border-color: var(--border-focus);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  font-family: inherit;
}

.btn-primary, .btn-accent {
  background-color: #2c3545 !important;
  color: #d1d5db !important;
  border: 1px solid #374151 !important;
  box-shadow: none !important;
}

.btn-primary:hover, .btn-accent:hover {
  background-color: #374151 !important;
  color: #ffffff !important;
  border-color: #4b5563 !important;
  filter: none;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #d1d5db;
}

.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.btn-danger {
  background-color: transparent;
  color: var(--error);
  border-color: var(--error);
}

.btn-danger:hover {
  background-color: rgba(239, 68, 68, 0.1);
  border-color: var(--error);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

/* --- Auth Page Style --- */
.auth-container {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 10;
  overflow: hidden;
}

.auth-container .btn {
  color: #ffffff !important;
}

.auth-left-pane {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background-color: #111827;
  color: white;
  position: relative;
  overflow: hidden;
}

.auth-bg-shapes {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}

.auth-bg-shapes .shape {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
}

.auth-bg-shapes .shape-1 {
  width: 400px;
  height: 400px;
  top: -100px;
  left: -100px;
  animation: float 10s ease-in-out infinite;
}

.auth-bg-shapes .shape-2 {
  width: 300px;
  height: 300px;
  bottom: -50px;
  right: -50px;
  animation: float 12s ease-in-out infinite reverse;
}

@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-20px) scale(1.05); }
}

.auth-hero {
  max-width: 450px;
  z-index: 2;
}

.typing-container {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 20px;
  line-height: 1.2;
  font-family: 'Segoe UI', sans-serif;
  color: white;
}

.typing-text {
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  border-right: 4px solid white;
  animation: typing 2s steps(20, end), blink-cursor 0.75s step-end infinite;
}

@keyframes typing {
  from { width: 0 }
  to { width: 100% }
}

@keyframes blink-cursor {
  from, to { border-color: transparent }
  50% { border-color: white; }
}

.auth-pitch {
  font-size: 1.1rem; line-height: 1.6;
  color: rgba(255, 255, 255, 0.9);
}

.fade-in-up {
  animation: fadeInUp 1s ease-out forwards;
  opacity: 0;
  transform: translateY(20px);
  animation-delay: 2.2s;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.auth-right-pane {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background-color: var(--bg-deep);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 40px;
}

.auth-header {
  padding: 4px;
  margin-bottom: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.logo-container {
  display: inline-flex;
  align-items: center; gap: 8px; margin-bottom: 16px;
}

.brand-logo-image {
  display: block;
  width: min(190px, 100%);
  height: auto;
  object-fit: contain;
}

.auth-logo-image {
  width: min(250px, 100%);
}

.dashboard-logo-image {
  width: 172px;
  max-width: 100%;
}

.logo-icon {
  width: 32px; height: 32px; background: var(--primary); border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center; color: white; font-size: 1.1rem;
}

.logo-text { font-family: 'Segoe UI', sans-serif; font-size: 18px; font-weight: 700; color: var(--text-primary); }

#auth-title { font-size: 20px; margin-bottom: 8px; color: var(--text-primary); padding: 4px; }

.auth-subtitle { color: var(--text-muted); font-size: 13px; line-height: 1.5; }

.auth-footer { margin-top: 24px; text-align: center; font-size: 13px; color: var(--text-muted); }

.auth-link { color: var(--primary); text-decoration: none; font-weight: 500; margin-left: 4px; }
.auth-link:hover { color: var(--primary-hover); text-decoration: underline; }


/* --- App Main Dashboard Layout --- */
.app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 250px;
  background-color: #1c2431;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  padding: 16px 0;
  flex-shrink: 0;
  z-index: 50;
}

.sidebar-header {
  padding: 6px 12px;
  margin: 4px 8px 16px;
  background-color: transparent;
  color: #ffffff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-header .logo-container {
  width: 100%;
  justify-content: center;
  margin-bottom: 10px;
}

.sidebar-header .logo-text {
  color: #ffffff;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-grow: 1;
  padding: 0 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  color: #94a3b8;
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 13px;
  transition: var(--transition-smooth);
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  width: calc(100% - 16px);
  text-align: left;
}

.nav-item:hover {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.03);
}

.nav-item.active {
  color: #38bdf8;
  background-color: rgba(56, 189, 248, 0.1);
  border-left: 2px solid #38bdf8;
  padding-left: 10px;
}

.nav-item i {
  font-size: 16px;
  width: 16px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border-color);
  margin: 0 8px;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  background-color: var(--primary);
  color: white;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-family: 'Segoe UI', sans-serif;
  font-size: 12px;
}

.user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  font-size: 12px;
}

.user-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #ffffff;
}

.user-tier {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: #38bdf8;
  letter-spacing: 0.05em;
}

.user-credits {
  width: fit-content;
  margin-top: 4px;
  padding: 2px 7px;
  border: 1px solid rgba(56, 189, 248, 0.24);
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.08);
  color: #bae6fd;
  font-size: 11px;
  font-weight: 700;
  font-family: 'Share Tech Mono', monospace;
}

/* Fix Logo text in dashboard */
.logo-text {
  color: #ffffff !important;
}

/* Analytics & Settings Contrast */
.section-card {
  background: rgba(30, 41, 59, 0.5) !important;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.05) !important;
}

.section-title span {
  color: #ffffff !important;
}

.section-card p, .section-card li span {
  color: #94a3b8 !important;
}

.custom-table th {
  background-color: #1c2431 !important;
  color: #94a3b8 !important;
  border-bottom-color: rgba(255, 255, 255, 0.05) !important;
}

.custom-table td {
  color: #f1f5f9 !important;
  border-bottom-color: rgba(255, 255, 255, 0.05) !important;
}

.custom-table tr:hover td {
  background-color: rgba(255, 255, 255, 0.02) !important;
}

.stat-card {
  background: rgba(30, 41, 59, 0.5) !important;
  border: 1px solid rgba(255, 255, 255, 0.05) !important;
}

.stat-data .value {
  color: #ffffff !important;
}

/* Main Container */
.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: #0e1621; /* Dark Dashboard Bg */
  background-image: url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png');
  background-size: 400px;
  background-repeat: repeat;
  background-blend-mode: soft-light;
  position: relative;
}

.header-bar {
  height: 64px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  flex-shrink: 0;
  background-color: #1c2431;
  z-index: 40;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.view-title {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.02em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Matte uniform styling for header buttons */
.header-actions .btn {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  background-color: #2c3545 !important; /* Matte dark grey/blue */
  color: #d1d5db !important; /* Matte light grey text */
  border: 1px solid #374151 !important;
  box-shadow: none !important;
  min-width: 90px;
}

.header-actions .btn:hover:not(:disabled) {
  background-color: #374151 !important;
  color: #ffffff !important;
  border-color: #4b5563 !important;
  filter: none;
}

.header-actions .btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background-color: #1f2937 !important;
  border-color: #374151 !important;
}

.header-actions .btn i {
  width: 14px;
  height: 14px;
  opacity: 0.8;
}

#btn-create-bot-header {
  padding: 6px 14px;
  font-size: 12px;
}

#btn-studio-add-credit {
  min-width: 104px;
}

#btn-save-code {
  margin-right: 8px;
}

.view-container {
  flex-grow: 1;
  overflow: hidden;
  padding: 0;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* --- Dashboard Overview View --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.studio-guide-card {
  padding: 20px;
  margin: 0 0 20px;
}

.guide-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.step-number {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: white;
  font-weight: 700;
  flex-shrink: 0;
}

.guide-step strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 6px;
}

.guide-step p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.stat-card {
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-data h4 {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 8px;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.stat-data .value {
  font-size: 28px;
  font-weight: 700;
  font-family: 'Segoe UI', sans-serif;
  color: var(--text-primary);
  line-height: 1;
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-card:nth-child(1) .stat-icon { background: rgba(14, 99, 156, 0.15); color: var(--primary); }
.stat-card:nth-child(2) .stat-icon { background: rgba(78, 201, 176, 0.15); color: var(--success); }
.stat-card:nth-child(3) .stat-icon { background: rgba(133, 133, 133, 0.15); color: var(--text-muted); }
.stat-card:nth-child(4) .stat-icon { background: rgba(244, 135, 113, 0.15); color: var(--error); }

.dashboard-sections {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

.section-card {
  padding: 20px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Tables */
.table-container {
  overflow-x: auto;
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.custom-table th {
  padding: 10px 12px;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
  background-color: rgba(0, 0, 0, 0.2);
}

.custom-table td {
  padding: 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  color: var(--text-primary);
}

.custom-table tr:last-child td {
  border-bottom: none;
}

.custom-table tr:hover td {
  background-color: rgba(0, 122, 204, 0.05);
}

.bot-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-running { background-color: rgba(78, 201, 176, 0.2); color: var(--success); }
.badge-stopped { background-color: rgba(133, 133, 133, 0.15); color: var(--text-muted); }
.badge-deploying { background-color: rgba(206, 145, 120, 0.2); color: var(--warning); }
.badge-error { background-color: rgba(244, 135, 113, 0.2); color: var(--error); }

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.badge-running .pulse-dot {
  background-color: var(--success);
  animation: pulse-animation 2s infinite;
}

.badge-deploying .pulse-dot {
  background-color: var(--warning);
  animation: pulse-animation 1.5s infinite;
}

@keyframes pulse-animation {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.2); }
}

/* --- Bot Studio View (AI Chat & Code Editor) --- */
.studio-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(280px, 1fr);
  gap: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  flex-grow: 1;
  padding: 0;
}

.editor-workspace {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border-right: 1px solid var(--border-color);
}



/* Studio Actions & Controls */
.studio-controls {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: transparent;
  border-radius: 0;
}

.bot-selector-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bot-select {
  padding: 6px 10px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  min-width: 140px;
}

.action-buttons {
  display: flex;
  gap: 8px;
}

/* AI Assistant Chat Refactor */
.chat-container {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  height: 100%;
  overflow: hidden;
  min-height: 0;
  background: rgba(17, 24, 39, 0.4);
  backdrop-filter: blur(20px);
  border-radius: 0;
  box-shadow: none;
  border-left: 1px solid var(--border-color);
}

.chat-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #242f3d;
  color: white;
}

.chat-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 13px;
}

.chat-clear-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.chat-clear-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

.chat-messages {
  flex-grow: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0; /* Remove padding for edge-to-edge lines */
  display: flex;
  flex-direction: column;
}

.chat-bubble {
  max-width: 100%;
  padding: 16px 20px;
  border-radius: 0;
  box-shadow: none;
  background: transparent !important;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  line-height: 1.55;
  font-size: 13px;
  font-family: 'Segoe UI', 'Helvetica Neue', sans-serif;
  font-weight: 400;
  position: relative;
  color: #f1f5f9;
  word-wrap: break-word;
  animation: none;
  opacity: 1;
  transform: none;
}

.bubble-user {
  color: #38bdf8;
  font-weight: 400;
}

.bubble-user::before {
  content: "YOU";
  display: block;
  font-size: 10px;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
  opacity: 0.5;
}

.bubble-assistant {
  color: #f8fafc;
}

.bubble-assistant::before {
  content: "ASSISTANT";
  display: block;
  font-size: 10px;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
  color: #38bdf8;
  opacity: 0.8;
}

.chat-bubble code {
  background-color: rgba(255, 255, 255, 0.05);
  color: #38bdf8;
  padding: 2px 5px;
  border-radius: 4px;
}

.code-block-wrapper {
  margin: 12px 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: #0f172a;
}

.code-block-header {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 8px 7px 12px;
  background: #1c2431;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.code-block-lang {
  color: #94a3b8;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.code-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.code-btn {
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 9px;
  border: 1px solid #374151;
  border-radius: 6px;
  background: #2c3545;
  color: #d1d5db;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.code-btn:hover {
  background: #374151;
  border-color: #4b5563;
  color: #ffffff;
}

.code-btn i {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.btn-insert {
  border-color: rgba(56, 189, 248, 0.35);
  color: #bae6fd;
}

.btn-insert:hover {
  border-color: rgba(56, 189, 248, 0.55);
  color: #ffffff;
}

.chat-bubble pre {
  margin: 0;
  padding: 16px;
  background-color: transparent;
  border: none;
  border-radius: 0;
  overflow-x: auto;
}

.chat-bubble pre code {
  background: transparent;
  padding: 0;
  font-size: 12px;
  color: #dbeafe;
}

.chat-input-area {
  padding: 16px;
  background: #1c2431;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.chat-context-status {
  min-height: 28px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 7px 10px;
  border: 1px solid rgba(251, 191, 36, 0.2);
  border-radius: 8px;
  background: rgba(251, 191, 36, 0.06);
  color: #fbbf24;
  font-size: 12px;
  font-weight: 600;
}

.chat-context-status.is-ready {
  border-color: rgba(56, 189, 248, 0.22);
  background: rgba(56, 189, 248, 0.07);
  color: #38bdf8;
}

.chat-quota {
  margin-bottom: 10px;
  padding: 9px 10px;
  border: 1px solid rgba(56, 189, 248, 0.18);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.46);
}

.chat-quota[hidden] {
  display: none;
}

.chat-quota-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 600;
}

.chat-quota-row strong {
  color: #f8fafc;
  font-weight: 700;
  white-space: nowrap;
}

.chat-quota-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.chat-quota-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #38bdf8, #4ec9b0);
  transition: width 0.25s ease, background-color 0.25s ease;
}

.chat-quota.is-warning .chat-quota-fill {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.chat-quota.is-full .chat-quota-fill {
  background: linear-gradient(90deg, #ef4444, #f97316);
}

.chat-input {
  width: 100%;
  background-color: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #ffffff;
  padding: 12px 14px;
  font-family: 'Segoe UI', 'Fira Code', sans-serif;
  font-size: 13px;
  font-weight: 500;
  outline: none;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  resize: none;
  min-height: 44px;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.2);
}

.chat-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-input {
  flex-grow: 1;
  background-color: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #ffffff;
  padding: 12px 14px;
  font-family: inherit;
  outline: none;
  resize: none;
  min-height: 44px;
}

.chat-send-btn {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: #2c3545;
  color: #d1d5db;
  border: 1px solid #374151;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.chat-send-btn:hover:not(:disabled) {
  background-color: #374151;
  border-color: #4b5563;
  color: #ffffff;
}

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



.editor-tabs {
  background-color: #1c2431;
  display: flex;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  align-items: center;
  border-radius: 0;
}

.editor-tab {
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #94a3b8;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition-smooth);
}

.editor-tab:hover {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.05);
}

.editor-tab.active {
  color: #ffffff;
  background-color: rgba(56, 189, 248, 0.1);
  border-color: #38bdf8;
}

.editor-container {
  flex-grow: 1;
  overflow: hidden;
  position: relative;
  background-color: #0f172a;
  border-radius: 0;
}

.CodeMirror {
  height: 100% !important;
  font-family: 'Fira Code', monospace;
  font-size: 13px;
  background: #0f172a !important;
  color: #ffffff !important;
}

.CodeMirror-gutters {
  background: #1c2431 !important;
  border-right: 1px solid rgba(255, 255, 255, 0.05) !important;
}

.CodeMirror-linenumber {
  color: #64748b !important;
}

/* Console/Terminal Window */
.terminal-window {
  height: 210px;
  background-color: #0f172a;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-radius: 0;
  overflow: hidden;
}

.terminal-header {
  padding: 12px 16px;
  background-color: #1c2431;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
}

.terminal-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.04em;
}

.terminal-actions {
  display: flex;
  gap: 12px;
}

.terminal-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.terminal-action-btn:hover {
  background: rgba(56, 189, 248, 0.1);
  border-color: #38bdf8;
  color: #38bdf8;
}

.terminal-content {
  flex-grow: 1;
  padding: 12px 16px;
  overflow-y: auto;
  font-family: 'Fira Code', monospace;
  font-size: 12px;
  line-height: 1.5;
  color: #f1f5f9;
  white-space: pre-wrap;
  word-wrap: break-word;
  background-color: #0e1621;
}

.log-line {
  display: flex;
  align-items: flex-start;
  padding: 2px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.studio-left, .studio-right {
  background: transparent !important;
}

.input-label {
  color: #94a3b8 !important;
}

.text-input, .bot-select {
  background-color: #0f172a !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  color: #ffffff !important;
}

.log-line:last-child {
  border-bottom: none;
}

.log-line .spinner {
  margin-top: 3px;
  border-top-color: var(--accent);
}

/* Modals & Dialogs */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: 100%;
  max-width: 480px;
  padding: 24px;
  transform: scale(0.95);
  transition: transform 0.2s ease;
  background: #1c2431;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border-radius: 16px;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.6);
}

.modal-overlay.active .modal-card {
  transform: scale(1);
}

.topup-card {
  max-width: 620px;
  width: calc(100% - 32px);
  max-height: calc(100vh - 48px);
  padding: 20px;
  overflow-y: auto;
}

.topup-header {
  margin-bottom: 16px;
}

.topup-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.15rem;
}

.topup-title i {
  width: 18px;
  height: 18px;
  color: #4ec9b0;
}

.topup-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.topup-amount-panel,
.topup-payment-panel {
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.42);
}

.topup-amount-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 0.75fr);
  gap: 12px;
  align-items: end;
}

.topup-input-group {
  margin-bottom: 0;
}

.topup-credit-group {
  margin-bottom: 0;
}

.topup-amount-input {
  min-height: 46px;
  padding: 10px 12px;
  font-size: 20px;
  font-weight: 800;
  text-align: center;
  background: rgba(0, 0, 0, 0.2) !important;
}

.topup-credit-preview {
  height: 46px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8px 12px;
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 8px;
  background: rgba(56, 189, 248, 0.06);
}

.topup-credit-preview strong {
  color: #38bdf8;
  font-family: 'Share Tech Mono', monospace;
  font-size: 20px;
  line-height: 1.2;
}

.topup-generate-btn {
  width: 100%;
  margin-top: 12px;
  min-height: 40px;
}

.topup-payment-main {
  display: grid;
  grid-template-columns: 138px minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}

.topup-qr-wrap {
  display: grid;
  place-items: center;
  align-self: stretch;
  padding: 10px;
  border-radius: 8px;
  background: #ffffff;
}

.topup-qr-wrap img {
  width: 118px;
  height: 118px;
  display: block;
}

.topup-payment-details {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.topup-copy-row {
  display: flex;
  gap: 8px;
  min-width: 0;
}

.topup-copy-value,
.topup-wallet-input {
  min-width: 0;
  flex: 1;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  color: #4ec9b0;
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topup-wallet-input {
  text-align: center;
}

.topup-icon-btn {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  padding: 0;
}

.topup-note {
  margin-top: 3px;
  padding: 8px 10px;
  border: 1px solid rgba(251, 191, 36, 0.18);
  border-radius: 8px;
  background: rgba(251, 191, 36, 0.07);
  color: #fbbf24;
  font-size: 12px;
  font-weight: 600;
}

.topup-status-row {
  margin-top: 12px;
  padding: 10px;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  color: #94a3b8;
  font-size: 13px;
  font-weight: 600;
}

.topup-status-row .monitoring-progress-bar {
  grid-column: 1 / -1;
  margin-top: 2px;
}

.topup-paid-btn {
  width: 100%;
  margin-top: 12px;
  min-height: 40px;
}

@media (max-width: 640px) {
  .topup-amount-grid,
  .topup-payment-main {
    grid-template-columns: 1fr;
  }

  .topup-qr-wrap {
    width: fit-content;
    margin: 0 auto;
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.modal-close-btn:hover {
  color: var(--text-primary);
}

.modal-footer {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* --- Upgrade Plans / Pricing --- */
.plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  margin-top: 20px;
}

.plan-card {
  padding: 28px;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.plan-card.popular {
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(0, 122, 204, 0.15);
}

.popular-badge {
  position: absolute;
  top: 10px;
  right: -28px;
  background: var(--accent);
  color: white;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 3px 24px;
  transform: rotate(45deg);
  letter-spacing: 0.04em;
}

.plan-name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.plan-price {
  margin-bottom: 20px;
  display: flex;
  align-items: baseline;
}

.plan-price .currency {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-muted);
}

.plan-price .amount {
  font-size: 32px;
  font-weight: 700;
  font-family: 'Segoe UI', sans-serif;
  color: var(--text-primary);
}

.plan-price .period {
  font-size: 13px;
  color: var(--text-muted);
  margin-left: 4px;
}

.plan-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
  flex-grow: 1;
}

.plan-features li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.plan-features li i {
  color: var(--accent);
  font-size: 12px;
}

/* Notifications */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
}

.toast {
  padding: 12px 16px;
  background-color: #1c2431;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-left: 3px solid var(--info);
  border-radius: var(--radius-md);
  color: #ffffff;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateX(400px);
  opacity: 0;
  animation: toast-slide 0.25s forwards;
}

/* Spinner Rotation Animation */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.spinner {
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top: 2px solid #38bdf8;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  animation: spin 1s linear infinite;
  display: inline-block;
}

/* Glowing Progress Bar for Blockchain Monitoring */
.monitoring-progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
  margin-top: 12px;
}

.monitoring-progress-bar::after {
  content: '';
  display: block;
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, transparent, #38bdf8, transparent);
  position: absolute;
  left: -40%;
  animation: scan 1.5s linear infinite;
}

@keyframes scan {
  0% { left: -40%; }
  100% { left: 100%; }
}
