:root {
  --bg-main: #090b10;
  --bg-sidebar: #0f121a;
  --bg-card: rgba(22, 27, 38, 0.75);
  --bg-card-hover: rgba(30, 37, 52, 0.85);
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-active: rgba(0, 210, 255, 0.3);
  
  --accent-cyan: #00d2ff;
  --accent-indigo: #6366f1;
  --accent-purple: #a855f7;
  --accent-emerald: #10b981;
  --accent-glow: rgba(0, 210, 255, 0.15);

  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --font-main: 'Outfit', -apple-system, sans-serif;
  --font-code: 'JetBrains Mono', monospace;
}

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

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-main);
  min-height: 100vh;
  overflow: hidden;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(0, 210, 255, 0.06) 0%, transparent 40%);
}

.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* --- SIDEBAR --- */
.sidebar {
  width: 320px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 24px 20px;
  gap: 28px;
  backdrop-filter: blur(20px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent-indigo), var(--accent-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(0, 210, 255, 0.35);
  position: relative;
}

.logo-core {
  width: 14px;
  height: 14px;
  background-color: #fff;
  border-radius: 4px;
  transform: rotate(45deg);
  box-shadow: 0 0 10px #fff;
}

.brand-text h2 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
}

.brand-tag {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent-cyan);
  background: rgba(0, 210, 255, 0.1);
  padding: 2px 7px;
  border-radius: 6px;
  display: inline-block;
  margin-top: 2px;
}

.section-title-wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.section-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}

.badge-count {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.12);
  padding: 2px 8px;
  border-radius: 20px;
}

.worker-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 14px;
  transition: all 0.25s ease;
}

.worker-card:hover {
  border-color: var(--border-active);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.worker-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.pulse-green {
  width: 9px;
  height: 9px;
  background-color: var(--accent-emerald);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse 2s infinite;
}

.pulse-yellow {
  width: 9px;
  height: 9px;
  background-color: #f59e0b;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
  animation: pulse-yellow-anim 2s infinite;
}

@keyframes pulse-yellow-anim {
  0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(245, 158, 11, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

.pulse-red {
  width: 9px;
  height: 9px;
  background-color: #ef4444;
  border-radius: 50%;
}

.worker-card.selected {
  border-color: #00d2ff;
  background: rgba(0, 210, 255, 0.06);
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.worker-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: #fff;
  flex: 1;
}

.worker-pill {
  font-size: 0.65rem;
  font-weight: 600;
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  padding: 2px 6px;
  border-radius: 4px;
}

.worker-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.worker-specs span {
  background: rgba(255, 255, 255, 0.04);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.copy-url-card {
  background: rgba(0, 0, 0, 0.35);
  border: 1px dashed var(--border-subtle);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.copy-url-card:hover {
  border-color: var(--accent-cyan);
  background: rgba(0, 210, 255, 0.04);
}

.copy-url-card code {
  font-family: var(--font-code);
  font-size: 0.8rem;
  color: var(--accent-cyan);
}

.copy-icon {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-dim);
}

.endpoint-desc {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 8px;
  line-height: 1.4;
}

.sidebar-footer {
  margin-top: auto;
}

.engine-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(0, 210, 255, 0.05));
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 12px;
  padding: 12px;
}

.engine-badge .icon {
  font-size: 1.3rem;
}

.badge-info strong {
  display: block;
  font-size: 0.8rem;
  color: #fff;
}

.badge-info small {
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* --- CHAT WORKSPACE --- */
.chat-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
}

.workspace-header {
  height: 65px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: rgba(15, 18, 26, 0.4);
  backdrop-filter: blur(16px);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-emerald);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-emerald);
}

.status-text {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.action-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* --- MESSAGES CONTAINER --- */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 32px 32px 140px 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.messages-container::-webkit-scrollbar {
  width: 6px;
}
.messages-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

/* Welcome Card */
.welcome-card {
  max-width: 720px;
  margin: 20px auto 40px auto;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 36px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(16px);
  animation: fadeIn 0.4s ease;
}

.welcome-avatar {
  font-size: 2.8rem;
  margin-bottom: 12px;
  display: inline-block;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.welcome-card h3 {
  font-size: 1.45rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 10px;
}

.welcome-card p {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 24px;
}

.preset-title {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 8px 16px;
  border-radius: 24px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chip:hover {
  background: rgba(0, 210, 255, 0.1);
  border-color: var(--accent-cyan);
  color: #fff;
  transform: translateY(-2px);
}

/* Message Rows */
.message-row {
  display: flex;
  gap: 14px;
  max-width: 820px;
  animation: fadeIn 0.3s ease;
}

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

.message-row.assistant {
  margin-right: auto;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.avatar.user-avatar {
  background: linear-gradient(135deg, #3b82f6, #6366f1);
}

.avatar.bot-avatar {
  background: linear-gradient(135deg, var(--accent-indigo), var(--accent-cyan));
  box-shadow: 0 0 16px rgba(0, 210, 255, 0.3);
}

.message-bubble {
  padding: 16px 20px;
  border-radius: 18px;
  font-size: 0.94rem;
  line-height: 1.6;
}

.message-row.user .message-bubble {
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.3);
}

.message-row.assistant .message-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-bottom-left-radius: 4px;
  color: var(--text-main);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(12px);
}

.message-bubble p {
  margin-bottom: 0.75rem;
}
.message-bubble p:last-child {
  margin-bottom: 0;
}
.message-bubble h1, .message-bubble h2, .message-bubble h3 {
  color: #fff;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  font-weight: 700;
}
.message-bubble ul, .message-bubble ol {
  padding-left: 1.4rem;
  margin-bottom: 0.75rem;
}
.message-bubble li {
  margin-bottom: 0.35rem;
}
.message-bubble pre {
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 12px 16px;
  overflow-x: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  margin: 0.85rem 0;
}
.message-bubble code {
  font-family: 'JetBrains Mono', monospace;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.88em;
  color: #00d2ff;
}
.message-bubble pre code {
  background: transparent;
  padding: 0;
  color: #f1f5f9;
}
.message-bubble table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.88rem;
}
.message-bubble th, .message-bubble td {
  border: 1px solid var(--border-subtle);
  padding: 8px 12px;
  text-align: left;
}
.message-bubble th {
  background: rgba(255, 255, 255, 0.05);
  color: #00d2ff;
}

.file-cards-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.file-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(0, 210, 255, 0.25);
  padding: 12px 16px;
  border-radius: 12px;
  transition: all 0.2s ease;
}

.file-badge:hover {
  background: rgba(0, 210, 255, 0.08);
  border-color: var(--accent-cyan);
  transform: translateX(4px);
}

.file-icon {
  font-size: 1.5rem;
}

.file-details {
  display: flex;
  flex-direction: column;
}

.file-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: #fff;
}

.file-type {
  font-size: 0.72rem;
  color: var(--accent-cyan);
  text-transform: uppercase;
  font-weight: 600;
}

/* --- INPUT CONTAINER --- */
.input-container {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 20px 32px 24px 32px;
  background: linear-gradient(to top, var(--bg-main) 65%, transparent);
}

.input-box-wrapper {
  max-width: 820px;
  margin: 0 auto;
  background: rgba(18, 22, 32, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(20px);
  transition: all 0.25s ease;
}

.input-box-wrapper:focus-within {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 25px rgba(0, 210, 255, 0.25);
}

textarea#promptInput {
  flex: 1;
  background: transparent;
  border: none;
  color: #fff;
  font-family: var(--font-main);
  font-size: 0.95rem;
  outline: none;
  resize: none;
  max-height: 140px;
  line-height: 1.5;
}

textarea#promptInput::placeholder {
  color: var(--text-dim);
}

.send-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-indigo), var(--accent-cyan));
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 15px rgba(0, 210, 255, 0.4);
}

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

.input-footer {
  max-width: 820px;
  margin: 8px auto 0 auto;
  display: flex;
  justify-content: space-between;
  font-size: 0.73rem;
  color: var(--text-dim);
}

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

/* --- IMAGE GALLERY & VISUAL RENDERS --- */
.image-gallery {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.generated-image-card {
  background: rgba(12, 16, 24, 0.9);
  border: 1px solid rgba(0, 210, 255, 0.3);
  border-radius: 14px;
  overflow: hidden;
  max-width: 520px;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6);
  transition: all 0.25s ease;
}

.generated-image-card:hover {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 30px rgba(0, 210, 255, 0.35);
}

.image-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  background: rgba(0, 0, 0, 0.5);
  border-bottom: 1px solid var(--border-subtle);
}

.hd-badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #00d2ff;
  background: rgba(0, 210, 255, 0.12);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(0, 210, 255, 0.2);
}

.download-link {
  font-size: 0.72rem;
  font-weight: 600;
  color: #f1f5f9;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.08);
  padding: 3px 10px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.download-link:hover {
  background: var(--accent-cyan);
  color: #000;
}

.image-preview-wrapper {
  position: relative;
  cursor: pointer;
  overflow: hidden;
}

.image-preview-wrapper img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.image-preview-wrapper:hover img {
  transform: scale(1.02);
}

.image-overlay-hint {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px 12px;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 100%);
  font-size: 0.72rem;
  color: #cbd5e1;
  opacity: 0.9;
  transition: opacity 0.2s ease;
}

.image-preview-wrapper:hover .image-overlay-hint {
  opacity: 1;
  color: #00d2ff;
}

/* --- FILE & DOCUMENT ATTACHMENTS --- */
.file-cards-container {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.file-card-box {
  background: rgba(18, 24, 38, 0.95);
  border: 1px solid rgba(0, 163, 255, 0.35);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  transition: all 0.25s ease;
}

.file-card-box:hover {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 25px rgba(0, 210, 255, 0.25);
  transform: translateY(-1px);
}

.file-card-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.file-icon-box {
  font-size: 1.8rem;
  width: 44px;
  height: 44px;
  background: rgba(0, 163, 255, 0.12);
  border: 1px solid rgba(0, 163, 255, 0.25);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.file-info-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.file-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-subtitle {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #00d2ff;
}

.file-download-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #0072ff 0%, #00d2ff 100%);
  color: #fff;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  flex-shrink: 0;
  box-shadow: 0 4px 15px rgba(0, 114, 255, 0.35);
  transition: all 0.2s ease;
}

.file-download-action-btn:hover {
  background: linear-gradient(135deg, #0056cc 0%, #00b4db 100%);
  transform: scale(1.03);
  box-shadow: 0 6px 20px rgba(0, 210, 255, 0.5);
}


