/* Design System: Premium Dark Glassmorphism */
@import url('/cf-shared/assets/fonts/fonts.css');

:root {
  --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #020617 100%);
  --glass-bg: rgba(30, 41, 59, 0.45);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent-blue: #38bdf8;
  --accent-purple: #c084fc;
  --accent-green: #34d399;
  --accent-red: #f87171;
  --sidebar-width: 280px;
}

body {
  background: var(--bg-gradient);
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Glassmorphic Cards & Panels */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: var(--glass-shadow);
}

.glass-card {
  background: rgba(30, 41, 59, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

/* Layout */
.app-wrapper {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.sidebar-panel {
  width: var(--sidebar-width);
  flex-shrink: 0;
  border-right: 1px solid var(--glass-border);
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  padding: 24px;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Form Styles */
.form-control, .form-select {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  border-radius: 10px;
  padding: 10px 14px;
  transition: all 0.2s ease;
}

.form-control:focus, .form-select:focus {
  background: rgba(15, 23, 42, 0.8);
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
  color: var(--text-primary);
}

.form-control:disabled, .form-control[readonly],
.form-select:disabled, .form-select[readonly] {
  background-color: rgba(15, 23, 42, 0.35) !important;
  color: rgba(255, 255, 255, 0.4) !important;
  border-color: rgba(255, 255, 255, 0.04) !important;
  opacity: 0.8;
}

.form-control::placeholder {
  color: var(--text-secondary);
  opacity: 0.6;
}

/* Buttons */
.btn-premium {
  background: linear-gradient(90deg, #38bdf8 0%, #c084fc 100%);
  border: none;
  color: #0f172a;
  font-weight: 600;
  border-radius: 10px;
  padding: 10px 20px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(56, 189, 248, 0.3);
}

.btn-premium:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(56, 189, 248, 0.5);
  background: linear-gradient(90deg, #5ecaff 0%, #cc9cff 100%);
  color: #0f172a;
}

.btn-glass {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  border-radius: 10px;
  padding: 10px 20px;
  transition: all 0.2s ease;
}

.btn-glass:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Chat Layout & Bubbles */
.chat-container {
  flex-grow: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.chat-bubble {
  max-width: 80%;
  border-radius: 16px;
  padding: 14px 20px;
  line-height: 1.6;
  animation: fadeInUp 0.3s ease;
}

.chat-bubble-user {
  align-self: flex-end;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 15px rgba(2, 132, 199, 0.2);
}

.chat-bubble-agent {
  align-self: flex-start;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
  box-shadow: var(--glass-shadow);
}

/* Intermediate Execution Steps (Thoughts / Tool Runs) */
.agent-step-container {
  margin-bottom: 12px;
  border-left: 2px solid var(--accent-purple);
  padding-left: 14px;
  font-size: 0.9em;
}

.agent-step-header {
  font-weight: 600;
  color: var(--accent-purple);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.agent-step-thought {
  font-style: italic;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.02);
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 8px;
}

.agent-step-tool-call {
  font-family: 'Fira Code', monospace;
  background: #090d16;
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--accent-blue);
  font-size: 0.85em;
  overflow-x: auto;
  margin-bottom: 4px;
}

.agent-step-tool-response {
  font-family: 'Fira Code', monospace;
  background: #04060b;
  border-left: 2px solid var(--accent-green);
  padding: 8px 12px;
  border-radius: 0 6px 6px 0;
  color: var(--accent-green);
  font-size: 0.85em;
  overflow-x: auto;
  margin-bottom: 8px;
  max-height: 200px;
}

/* Code blocks in markdown */
.chat-bubble-agent pre {
  background: #090d16 !important;
  border: 1px solid rgba(255, 255, 255, 0.05) !important;
  border-radius: 8px;
  padding: 12px;
  overflow-x: auto;
  margin: 10px 0;
}

.chat-bubble-agent code {
  font-family: 'Fira Code', monospace;
  font-size: 0.9em;
  color: #e2e8f0;
}

/* Loader Animation */
.agent-thinking {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  padding: 10px;
}

.thinking-dot {
  width: 8px;
  height: 8px;
  background-color: var(--accent-blue);
  border-radius: 50%;
  animation: thinkingBounce 1.4s infinite ease-in-out both;
}

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

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

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

/* Custom list-group transitions */
.list-group-item-premium {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.list-group-item-premium:hover, .list-group-item-premium.active {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.list-group-item-premium.active {
  border-left: 3px solid var(--accent-blue);
  border-radius: 0 8px 8px 0;
  padding-left: 13px;
}

/* Upload zone */
.upload-zone {
  border: 2px dashed rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  background: rgba(255, 255, 255, 0.01);
  transition: all 0.3s ease;
  cursor: pointer;
}

.upload-zone:hover {
  border-color: var(--accent-blue);
  background: rgba(56, 189, 248, 0.02);
}

/* Bootstrap Dark Mode Overrides */
.text-secondary {
  color: var(--text-secondary) !important;
}

.text-muted {
  color: var(--text-secondary) !important;
}

.form-text {
  color: var(--text-secondary) !important;
  opacity: 0.85;
}

.content-container {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  height: 100%;
  overflow: hidden;
  position: relative;
}

