/* --- Global Variables & Theme Core --- */
:root {
  --bg-app: #08080a;
  --bg-surface: #101014;
  --bg-glass: rgba(16, 16, 22, 0.7);
  --border-glass: rgba(255, 255, 255, 0.05);
  --border-glass-hover: rgba(255, 255, 255, 0.12);
  
  /* Color Accents (HSL Tailored) */
  --primary: #8b5cf6;       /* Neon Violet */
  --primary-rgb: 139, 92, 246;
  --primary-hover: #a78bfa;
  --secondary: #6366f1;     /* Indigo Glow */
  --secondary-hover: #818cf8;
  
  --success: #10b981;       /* Emerald */
  --success-rgb: 16, 185, 129;
  --warning: #f59e0b;       /* Amber Amber */
  --warning-rgb: 245, 158, 11;
  --danger: #ef4444;        /* Rose Red */
  
  --text-main: #f4f4f5;
  --text-muted: #9ca3af;
  --text-dark: #1f2937;
  
  /* Layout Metrics */
  --header-height: 70px;
  --sidebar-width: 290px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-glow: 0 0 20px rgba(139, 92, 246, 0.15);
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Base Reset & Typography --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  letter-spacing: -0.02em;
}

a {
  color: var(--primary-hover);
  text-decoration: none;
  transition: var(--transition-fast);
}
a:hover {
  text-decoration: underline;
}

/* --- App Structure Layout --- */
#app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
}

/* --- Header Styling --- */
#app-header {
  height: var(--header-height);
  background-color: rgba(8, 8, 10, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.logo-icon i {
  color: #fff;
  font-size: 18px;
}

.logo-text h1 {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.1;
  background: linear-gradient(90deg, #fff, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-text span {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Header Controls & Status */
.header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-normal);
  border: 1px solid transparent;
}

.primary-btn {
  background-color: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(139, 92, 246, 0.25);
}

.primary-btn:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}

.secondary-btn {
  background-color: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  border: 1px solid var(--border-glass);
}

.secondary-btn:hover {
  background-color: rgba(255, 255, 255, 0.08);
  border-color: var(--border-glass-hover);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  transition: var(--transition-normal);
}

.simulation-badge {
  background-color: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--warning);
}

.proxy-badge {
  background-color: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: var(--primary-hover);
}

.gemini-badge {
  background-color: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--success);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  animation: pulse-kf 1.5s infinite;
}

.simulation-badge .pulse-dot { background-color: var(--warning); }
.proxy-badge .pulse-dot { background-color: var(--primary); }
.gemini-badge .pulse-dot { background-color: var(--success); }

@keyframes pulse-kf {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.2); opacity: 1; box-shadow: 0 0 10px currentColor; }
  100% { transform: scale(0.9); opacity: 0.6; }
}

/* --- Main Workspace --- */
#app-workspace {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr 1.15fr;
  height: calc(100vh - var(--header-height));
  width: 100vw;
  overflow: hidden;
}

/* --- 1. Left Sidebar: Progress --- */
#sidebar-progress {
  background-color: #0b0b0e;
  border-right: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  overflow-y: auto;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}

.sidebar-header h3 {
  font-size: 14px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#global-progress-percent {
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-hover);
}

.progress-bar-container {
  height: 6px;
  background-color: rgba(255, 255, 255, 0.04);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 24px;
}

#global-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 3px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#sections-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-grow: 1;
}

.section-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background-color: rgba(255, 255, 255, 0.01);
  border: 1px solid rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition: var(--transition-normal);
}

.section-status {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Outfit', sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  transition: var(--transition-normal);
}

.section-status .check {
  display: none;
}

.section-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.section-title {
  font-family: 'Outfit', sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.section-subtitle {
  font-size: 10.5px;
  color: rgba(156, 163, 175, 0.6);
}

/* Section Item States */
.section-item.active {
  background-color: rgba(139, 92, 246, 0.06);
  border-color: rgba(139, 92, 246, 0.25);
}

.section-item.active .section-status {
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.2);
}

.section-item.active .section-title {
  color: #fff;
}

.section-item.completed {
  background-color: rgba(16, 185, 129, 0.04);
  border-color: rgba(16, 185, 129, 0.15);
}

.section-item.completed .section-status {
  background-color: var(--success);
  border-color: var(--success);
  color: #fff;
}

.section-item.completed .section-status .index {
  display: none;
}

.section-item.completed .section-status .check {
  display: block;
}

.section-item.completed .section-title {
  color: var(--text-muted);
  text-decoration: none;
}

.section-item.locked {
  opacity: 0.5;
  cursor: not-allowed;
}

.section-item:hover:not(.locked) {
  background-color: rgba(255, 255, 255, 0.04);
  border-color: var(--border-glass-hover);
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px;
  border-radius: var(--radius-sm);
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-glass);
}

.sidebar-footer p {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

.sidebar-footer i {
  color: var(--primary-hover);
  margin-right: 4px;
}

/* --- Panel Header UI Helper --- */
.panel-header {
  height: 54px;
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background-color: rgba(16, 16, 22, 0.3);
}

.panel-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-header-title i {
  color: var(--primary-hover);
  font-size: 15px;
}

.panel-header-title h2 {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
}

/* --- 2. Center Panel: Chat Dialogue --- */
#chat-workspace {
  background-color: #0d0d11;
  border-right: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.question-tracker {
  font-size: 11px;
  color: var(--text-muted);
  background-color: rgba(255, 255, 255, 0.04);
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid var(--border-glass);
}

.chat-history {
  flex-grow: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Chat Bubbles */
.chat-message {
  display: flex;
  gap: 14px;
  max-width: 85%;
  animation: message-slide-up 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes message-slide-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.assistant-message {
  align-self: flex-start;
}

.user-message {
  align-self: flex-end;
  flex-direction: row-reverse;
  max-width: 75%;
}

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(99, 102, 241, 0.2));
  border: 1px solid rgba(139, 92, 246, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-message .message-avatar {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

.message-avatar i {
  font-size: 14px;
  color: var(--primary-hover);
}

.user-message .message-avatar i {
  color: #fff;
}

.message-bubble {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  line-height: 1.55;
}

.assistant-message .message-bubble {
  background-color: rgba(22, 22, 28, 0.7);
  border: 1px solid var(--border-glass);
  color: #fff;
  border-top-left-radius: 2px;
}

.user-message .message-bubble {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(99, 102, 241, 0.1));
  border: 1px solid rgba(139, 92, 246, 0.25);
  color: var(--text-main);
  border-top-right-radius: 2px;
}

/* Embedded interactive elements inside chat bubbles */
.message-bubble p {
  margin-bottom: 8px;
}

.message-bubble p:last-child {
  margin-bottom: 0;
}

.message-bubble strong {
  color: var(--primary-hover);
}

.message-bubble code {
  font-family: 'Fira Code', monospace;
  font-size: 12px;
  background-color: rgba(255, 255, 255, 0.05);
  padding: 2px 5px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.message-bubble ul {
  margin: 8px 0;
  padding-left: 18px;
}

.message-bubble li {
  margin-bottom: 4px;
}

.message-bubble blockquote {
  border-left: 3px solid var(--primary);
  background-color: rgba(255, 255, 255, 0.02);
  padding: 6px 12px;
  margin: 8px 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

.chat-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 16px;
  background-color: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

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

/* Drilling Critique Box in AI Bubble */
.critique-box {
  background-color: rgba(245, 158, 11, 0.05);
  border-left: 3px solid var(--warning);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 10px 14px;
  margin: 10px 0;
  font-size: 12.5px;
}

.critique-box-title {
  color: var(--warning);
  font-weight: 600;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Typing Indicator */
.typing-indicator-container {
  display: flex;
  gap: 14px;
  padding: 0 20px 20px 20px;
  align-self: flex-start;
}

.typing-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.typing-avatar i {
  font-size: 13px;
  color: var(--primary-hover);
}

.typing-bubble {
  padding: 12px 18px;
  background-color: rgba(22, 22, 28, 0.7);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  border-top-left-radius: 2px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.typing-bubble .dot {
  width: 6px;
  height: 6px;
  background-color: var(--text-muted);
  border-radius: 50%;
  animation: typing-bounce 1.4s infinite ease-in-out;
}

.typing-bubble .dot:nth-child(1) { animation-delay: 0s; }
.typing-bubble .dot:nth-child(2) { animation-delay: 0.2s; }
.typing-bubble .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-6px); }
}

/* Input Area */
.chat-input-area {
  background-color: rgba(16, 16, 22, 0.4);
  border-top: 1px solid var(--border-glass);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: var(--transition-normal);
}

.chat-input-area.disabled {
  opacity: 0.4;
  pointer-events: none;
}

.input-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.voice-mic-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-normal);
}

.voice-mic-btn:hover {
  border-color: var(--primary);
  color: var(--primary-hover);
  background-color: rgba(139, 92, 246, 0.05);
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.15);
}

.voice-mic-btn.recording {
  background-color: rgba(239, 68, 68, 0.12);
  border-color: var(--danger);
  color: var(--danger);
  animation: mic-pulse 1.8s infinite cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes mic-pulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.textarea-wrapper {
  flex-grow: 1;
  position: relative;
  background-color: #121217;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  transition: var(--transition-normal);
}

.textarea-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 14px rgba(139, 92, 246, 0.15);
}

textarea#chat-message-input {
  width: 100%;
  background-color: transparent;
  border: none;
  color: #fff;
  resize: none;
  font-family: 'Inter', sans-serif;
  font-size: 13.5px;
  outline: none;
}

.realtime-transcript {
  display: block;
  font-size: 11px;
  color: var(--primary-hover);
  margin-top: 4px;
  font-style: italic;
  min-height: 12px;
}

.send-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: var(--primary);
  border: none;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-normal);
}

.send-btn:hover {
  background-color: var(--primary-hover);
  transform: scale(1.04);
}

.input-tip {
  font-size: 11px;
  color: rgba(156, 163, 175, 0.4);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Soundwave Audio Visualization Panel */
.soundwave-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 0;
  background-color: rgba(239, 68, 68, 0.03);
  border: 1px dashed rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  animation: pulse-wave 2s infinite ease-in-out;
}

@keyframes pulse-wave {
  0%, 100% { border-color: rgba(239, 68, 68, 0.1); }
  50% { border-color: rgba(239, 68, 68, 0.3); }
}

.voice-transcription-status {
  font-size: 12px;
  font-weight: 500;
  color: var(--danger);
  margin-left: 12px;
}

.wave-bar {
  width: 3px;
  height: 14px;
  background-color: var(--danger);
  border-radius: 2px;
}

.wave-bar.bar-1 { animation: wave-anim 0.6s infinite alternate ease-in-out; }
.wave-bar.bar-2 { animation: wave-anim 0.8s infinite alternate ease-in-out; }
.wave-bar.bar-3 { animation: wave-anim 0.5s infinite alternate ease-in-out; }
.wave-bar.bar-4 { animation: wave-anim 0.9s infinite alternate ease-in-out; }
.wave-bar.bar-5 { animation: wave-anim 0.7s infinite alternate ease-in-out; }
.wave-bar.bar-6 { animation: wave-anim 0.4s infinite alternate ease-in-out; }
.wave-bar.bar-7 { animation: wave-anim 0.85s infinite alternate ease-in-out; }
.wave-bar.bar-8 { animation: wave-anim 0.55s infinite alternate ease-in-out; }

@keyframes wave-anim {
  from { height: 4px; transform: scaleY(1); }
  to { height: 22px; transform: scaleY(1.3); }
}

/* --- 3. Right Panel: Document Preview --- */
#preview-workspace {
  background-color: #0b0b0e;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.preview-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background-color: rgba(255,255,255,0.02);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-fast);
}

.icon-toggle-btn:hover {
  background-color: rgba(255,255,255,0.05);
  color: #fff;
}

.icon-toggle-btn.active {
  background-color: rgba(139, 92, 246, 0.1);
  border-color: var(--primary);
  color: var(--primary-hover);
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
  border: 1px solid transparent;
}

/* Document Container Pane */
.brief-document-pane {
  flex-grow: 1;
  overflow-y: auto;
  padding: 30px;
  display: flex;
  flex-direction: column;
}

/* Rendered Preview Document styles (White sheet paper style) */
#rendered-brief-view {
  background-color: #121217;
  padding: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  margin: 20px;
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.02), 0 8px 30px rgba(0,0,0,0.4);
  max-width: 90%;
  align-self: center;
  width: calc(100% - 40px);
  position: relative;
}

/* Inside brief document styles */
#rendered-brief-view h1 {
  font-size: 24px;
  color: #fff;
  border-bottom: 2px solid var(--primary);
  padding-bottom: 8px;
  margin-bottom: 24px;
}

#rendered-brief-view h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary-hover);
  margin-top: 30px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding-bottom: 4px;
}

#rendered-brief-view h3 {
  font-size: 13.5px;
  font-weight: 600;
  color: #fff;
  margin-top: 20px;
  margin-bottom: 10px;
}

#rendered-brief-view p {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.6;
  margin-bottom: 14px;
}

#rendered-brief-view blockquote {
  border-left: 3px solid var(--primary);
  background-color: rgba(255, 255, 255, 0.01);
  padding: 10px 16px;
  margin: 14px 0;
  font-size: 12.5px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-muted);
}

#rendered-brief-view ul {
  margin-bottom: 14px;
  padding-left: 20px;
}

#rendered-brief-view li {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.5;
  margin-bottom: 6px;
}

#rendered-brief-view code {
  font-family: 'Fira Code', monospace;
  font-size: 12px;
  color: #fff;
  background-color: rgba(255,255,255,0.05);
  padding: 2px 4px;
  border-radius: 4px;
}

#rendered-brief-view hr {
  border: 0;
  border-top: 1px dashed rgba(255,255,255,0.08);
  margin: 20px 0;
}

/* Custom Highlight States in Rendered Document */
.rendered-placeholder {
  color: #f59e0b !important;
  background-color: rgba(245, 158, 11, 0.05);
  border: 1px dashed rgba(245, 158, 11, 0.25);
  padding: 2px 6px;
  border-radius: 4px;
  font-style: italic;
  font-size: 12px;
}

.rendered-filled {
  color: var(--success) !important;
  background-color: rgba(16, 185, 129, 0.04);
  border: 1px solid rgba(16, 185, 129, 0.15);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
}

/* Raw Code view */
#raw-brief-view {
  padding: 20px;
  flex-grow: 1;
  display: flex;
}

#raw-markdown-textarea {
  width: 100%;
  height: 100%;
  background-color: #08080a;
  color: var(--primary-hover);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 20px;
  font-family: 'Fira Code', monospace;
  font-size: 12px;
  line-height: 1.6;
  resize: none;
  outline: none;
}

/* --- Modals (Glassmorphic Styles) --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(4, 4, 6, 0.65);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  transition: opacity 0.3s ease;
}

.modal-content {
  background-color: rgba(18, 18, 24, 0.85);
  border: 1px solid var(--border-glass);
  box-shadow: 0 20px 50px rgba(0,0,0,0.5), var(--shadow-glow);
  width: 500px;
  max-width: 90%;
  border-radius: var(--radius-lg);
  overflow: hidden;
  animation: modal-slide-in 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modal-slide-in {
  from { opacity: 0; transform: scale(0.95) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  font-size: 18px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-header h2 i {
  color: var(--primary-hover);
}

.close-modal-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 26px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.close-modal-btn:hover {
  color: #fff;
}

.modal-body {
  padding: 24px;
}

.modal-body p {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.form-group label {
  font-family: 'Outfit', sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  color: #fff;
}

.input-password-wrapper {
  display: flex;
  position: relative;
  align-items: center;
}

.input-password-wrapper input {
  width: 100%;
  background-color: rgba(255,255,255,0.03);
  border: 1px solid var(--border-glass);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 10px 44px 10px 14px;
  font-size: 13.5px;
  outline: none;
  transition: var(--transition-normal);
}

.input-password-wrapper input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.15);
}

.view-key-btn {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

.view-key-btn:hover {
  color: #fff;
}

.input-helper-text {
  font-size: 11px;
  color: rgba(156, 163, 175, 0.5);
}

select#gemini-model-select {
  background-color: #111116;
  border: 1px solid var(--border-glass);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13.5px;
  outline: none;
  cursor: pointer;
  transition: var(--transition-normal);
}

select#gemini-model-select:focus {
  border-color: var(--primary);
}

.modal-warning {
  background-color: rgba(245, 158, 11, 0.05);
  border: 1px solid rgba(245, 158, 11, 0.15);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  gap: 12px;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--text-muted);
}

.modal-warning i {
  color: var(--warning);
  font-size: 16px;
  margin-top: 2px;
}

.modal-warning strong {
  color: #fff;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-glass);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background-color: rgba(8, 8, 10, 0.2);
}

.modal-btn {
  padding: 8px 20px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: var(--transition-fast);
}

.modal-btn.primary-btn {
  background-color: var(--primary);
  color: #fff;
}

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

.modal-btn.secondary-btn {
  background-color: transparent;
  border-color: var(--border-glass);
  color: var(--text-muted);
}

.modal-btn.secondary-btn:hover {
  background-color: rgba(255,255,255,0.03);
  color: #fff;
}

/* Hide helper class */
.hidden {
  display: none !important;
  opacity: 0;
  pointer-events: none;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.1);
  border-radius: 4px;
  transition: var(--transition-fast);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 92, 246, 0.25);
}
