@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

* {
  box-sizing: border-box;
}

body {
  background-color: #f8fafc;
  background-image: 
    linear-gradient(#e2e8f0 1px, transparent 1px),
    linear-gradient(90deg, #e2e8f0 1px, transparent 1px);
  background-size: 24px 24px;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  margin: 0;
  padding: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

.page-container {
  background-color: #e5e7eb; /* Main container background */
  border: 3px solid #1e3a8a; /* Dark blue border around container */
  width: 95vw;
  max-width: 1440px;
  min-height: 85vh;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* Header container */
.header-row {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
}

@media (max-width: 768px) {
  .header-row {
    grid-template-columns: 1fr;
  }
}

/* Left header logo card */
.logo-card {
  background-color: white;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.logo-card img {
  width: 60px;
  height: 60px;
  object-fit: contain;
}

.logo-card .logo-text-group h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #111827;
}

.logo-card .logo-text-group p {
  margin: 2px 0 0 0;
  font-size: 10.5px;
  color: #6b7280;
  font-weight: 500;
  line-height: 1.3;
}

/* Right header title card */
.title-card {
  background-color: #d1d5db;
  border-left: 4px solid #9ca3af;
  padding: 16px 40px 16px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  position: relative;
}

.title-card h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: #111827;
}

.title-card p {
  margin: 0;
  font-size: 12px;
  color: #374151;
  line-height: 1.5;
}

/* Gear Settings Button */
.settings-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: white;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #4b5563;
  transition: all 0.2s ease;
}

.settings-btn:hover {
  background-color: #f3f4f6;
  color: #111827;
}

.settings-btn svg {
  width: 20px;
  height: 20px;
}

/* Main workspace layout */
.workspace-layout {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 24px;
  align-items: stretch;
  flex: 1;
}

@media (max-width: 900px) {
  .workspace-layout {
    grid-template-columns: 1fr;
    align-items: start;
  }
}

/* Cards and buttons alignment container */
.cards-and-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.workspace-row {
  display: flex;
  gap: 20px;
  align-items: center;
  transition: opacity 0.3s ease;
}

/* Row states */
.workspace-row.disabled {
  opacity: 0.4;
  pointer-events: none;
}

.workspace-row.active .text-card {
  border: 2px solid #2563eb;
}

.workspace-row.completed .text-card {
  background-color: #fef08a !important; /* Pale yellow */
  color: #854d0e;
  border: 1px solid #fef08a;
}

.text-card {
  background-color: white;
  padding: 16px;
  min-height: 72px;
  flex: 1;
  display: flex;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  line-height: 1.4;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  border: 2px solid transparent;
  transition: all 0.2s ease;
}

.blue-btn {
  background-color: #3b82f6; /* Blue buttons matching mockup */
  border: 1px solid #2563eb;
  border-radius: 8px;
  width: 90px;
  height: 64px;
  flex-shrink: 0;
  cursor: pointer;
  font-weight: 700;
  font-size: 13.5px;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.blue-btn:hover:not(:disabled) {
  background-color: #2563eb;
}

.blue-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.blue-btn:disabled {
  background-color: #9ca3af;
  border-color: #d1d5db;
  color: #e5e7eb;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-placeholder {
  width: 90px;
  height: 64px;
  flex-shrink: 0;
}

/* Right column - Demonstration Box */
.demo-container {
  border: 2px solid #2563eb; /* Blue border matching mockup */
  background-color: transparent;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 520px; /* Matches the exact height of cards column */
  width: 100%;
}

.demo-header-box {
  background-color: white;
  padding: 20px;
  width: 100%;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  color: #1e3a8a;
  line-height: 1.5;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.demo-content {
  width: 100%;
  margin-top: 20px;
  flex: 1; /* Stretch to fill container */
  background-color: white;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 16px;
  font-family: monospace;
  font-size: 12px;
  color: #334155;
  overflow-y: auto;
  white-space: pre-wrap;
  min-height: 0;
}

/* Settings Modal Overlay Styles */
.settings-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 31, 58, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
}

.settings-modal {
  background: white;
  border-radius: 12px;
  width: 100%;
  max-width: 820px;
  padding: 28px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  position: relative;
  border: 1px solid #e2e8f0;
}

.settings-modal h2 {
  margin: 0 0 24px 0;
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
}

.settings-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: none;
  border: none;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  color: #64748b;
  transition: color 0.2s;
}

.settings-close-btn:hover {
  color: #0f172a;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 768px) {
  .settings-grid {
    grid-template-columns: 1fr;
  }
}

.settings-panel-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-panel-card h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #1e3a8a;
  border-bottom: 2px solid #f1f5f9;
  padding-bottom: 8px;
}

.settings-panel-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
}

.settings-panel-card input[type="text"],
.settings-panel-card input[type="password"],
.settings-panel-card input[type="number"],
.settings-panel-card select,
.settings-panel-card textarea {
  padding: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 13.5px;
  font-family: inherit;
  color: #1e293b;
  width: 100%;
}

.settings-panel-card input:focus,
.settings-panel-card select:focus,
.settings-panel-card textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.settings-panel-card .muted {
  font-size: 11.5px;
  color: #64748b;
  line-height: 1.4;
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  border-top: 1px solid #e2e8f0;
  padding-top: 16px;
}

.settings-save-btn {
  background-color: #2563eb;
  color: white;
  border: 1px solid #1d4ed8;
  padding: 10px 20px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.settings-save-btn:hover {
  background-color: #1d4ed8;
}

.settings-cancel-btn {
  background-color: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
  padding: 10px 20px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.settings-cancel-btn:hover {
  background-color: #e2e8f0;
  color: #0f172a;
}

.hidden {
  display: none !important;
}

/* Rounded numbered step action buttons */
.step-num-btn {
  background-color: #2563eb;
  border: 1px solid #1d4ed8;
  border-radius: 12px;
  width: 90px;
  height: 64px;
  flex-shrink: 0;
  cursor: pointer;
  font-weight: 700;
  font-size: 20px;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 4px 6px rgba(37, 99, 235, 0.15);
}

.step-num-btn:hover:not(:disabled) {
  background-color: #1d4ed8;
}

.step-num-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.step-num-btn:disabled {
  background-color: #9ca3af;
  border-color: #cbd5e1;
  color: #e5e7eb;
  cursor: not-allowed;
  box-shadow: none;
}

/* Processing mode switch and multiprompt panel */
.page-container {
  --mp-accent: #2563eb;
  --mp-accent-light: rgba(37, 99, 235, 0.08);
  --mp-ink: #111827;
  --mp-muted: #4b5563;
}

.mode-card {
  background-color: white;
  padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.mode-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: #111827;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.mode-option:has(input:checked) {
  border-color: #2563eb;
  background-color: rgba(37, 99, 235, 0.06);
}

.mode-option:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.6;
}

.mode-hint {
  margin: 0;
  font-size: 12px;
  color: #4b5563;
  line-height: 1.5;
}

.mode-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mode-btn {
  background-color: #2563eb;
  border: 1px solid #1d4ed8;
  border-radius: 6px;
  color: white;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  cursor: pointer;
}

.mode-btn.secondary {
  background-color: #f1f5f9;
  border-color: #cbd5e1;
  color: #475569;
}

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

.demo-downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.demo-link {
  display: inline-block;
  padding: 6px 10px;
  border: 1px solid #2563eb;
  border-radius: 6px;
  color: #1d4ed8;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.demo-link:hover {
  background-color: rgba(37, 99, 235, 0.08);
}

.demo-multistage {
  white-space: normal;
}

.demo-multistage-summary {
  font-weight: bold;
  color: #1e3a8a;
  margin-bottom: 12px;
}

/* Multistage mode: taller demonstration window for stage reasoning */
.demo-container.is-multistage {
  height: max(760px, calc(100vh - 120px));
}

.demo-multistage .textai-stage-list {
  margin-top: 12px;
  font-family: 'Inter', system-ui, sans-serif;
}

@media (max-width: 640px) {
  .mode-switch {
    grid-template-columns: 1fr;
  }
}

.demo-multistage .textai-stage-row {
  grid-template-columns: 24px 1fr;
  row-gap: 6px;
}

.demo-multistage .textai-stage-row > :last-child {
  grid-column: 2;
  justify-self: start;
}
