/* ============================================================
   UiPath Agent Interface — Premium Dark Mode Design System
   ============================================================
   A stunning glassmorphism-based design system with UiPath-inspired
   colors, smooth animations, and responsive layout.
   ============================================================ */

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

/* ── CSS Custom Properties ─────────────────────────────────── */
:root {
  /* Background Layers */
  --bg-deepest:       #070b16;
  --bg-deep:          #0a0f1e;
  --bg-base:          #0f1629;
  --bg-surface:       #141b2d;
  --bg-elevated:      #1a2340;

  /* Brand / Accent */
  --primary:          #fa4616;
  --primary-hover:    #ff5c33;
  --primary-subtle:   rgba(250, 70, 22, 0.12);
  --primary-glow:     rgba(250, 70, 22, 0.35);
  --secondary:        #3b82f6;
  --secondary-hover:  #60a5fa;
  --secondary-subtle: rgba(59, 130, 246, 0.12);
  --secondary-glow:   rgba(59, 130, 246, 0.35);

  /* Semantic */
  --success:          #10b981;
  --success-subtle:   rgba(16, 185, 129, 0.12);
  --warning:          #f59e0b;
  --warning-subtle:   rgba(245, 158, 11, 0.12);
  --error:            #ef4444;
  --error-subtle:     rgba(239, 68, 68, 0.12);

  /* Text */
  --text-primary:     #f1f5f9;
  --text-secondary:   #94a3b8;
  --text-tertiary:    #64748b;
  --text-disabled:    #475569;

  /* Surfaces */
  --card-bg:          rgba(15, 23, 42, 0.70);
  --card-bg-hover:    rgba(20, 27, 45, 0.85);
  --card-border:      rgba(255, 255, 255, 0.08);
  --card-border-hover:rgba(255, 255, 255, 0.14);

  /* Glass */
  --glass-bg:         rgba(15, 23, 42, 0.55);
  --glass-blur:       20px;
  --glass-border:     rgba(255, 255, 255, 0.10);

  /* Input */
  --input-bg:         rgba(10, 15, 30, 0.60);
  --input-border:     rgba(255, 255, 255, 0.10);
  --input-focus:      var(--secondary);
  --input-focus-glow: rgba(59, 130, 246, 0.25);

  /* Misc */
  --radius-sm:        6px;
  --radius-md:        10px;
  --radius-lg:        16px;
  --radius-xl:        24px;
  --radius-full:      9999px;

  --shadow-sm:        0 1px 3px rgba(0,0,0,0.3);
  --shadow-md:        0 4px 16px rgba(0,0,0,0.35);
  --shadow-lg:        0 8px 32px rgba(0,0,0,0.45);
  --shadow-xl:        0 16px 48px rgba(0,0,0,0.55);
  --shadow-glow-primary: 0 0 24px var(--primary-glow);
  --shadow-glow-secondary: 0 0 24px var(--secondary-glow);

  --transition-fast:  0.15s ease;
  --transition:       0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow:  0.5s cubic-bezier(0.4, 0, 0.2, 1);

  --header-height:    68px;
  --max-width:        1200px;
}

/* ── Reset & Base ──────────────────────────────────────────── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-deepest);
  /* Multi-layer gradient background */
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(250, 70, 22, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 50%, rgba(59, 130, 246, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 20% 80%, rgba(250, 70, 22, 0.03) 0%, transparent 50%),
    linear-gradient(180deg, var(--bg-deepest) 0%, var(--bg-deep) 30%, var(--bg-base) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Typography ────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
  letter-spacing: -0.02em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

p { color: var(--text-secondary); }

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

/* ── Custom Scrollbar ──────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.18);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.32);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.18) transparent;
}

/* ── Selection ─────────────────────────────────────────────── */
::selection {
  background: var(--primary);
  color: #fff;
}

/* ================================================================
   LAYOUT
   ================================================================ */

.app-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px 64px;
  position: relative;
}

/* ── Header ────────────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.4);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: 0 1px 24px rgba(0,0,0,0.25);
  transition: background var(--transition);
}

.header.scrolled {
  background: rgba(10, 15, 30, 0.85);
  box-shadow: 0 4px 32px rgba(0,0,0,0.4);
}

.toggle-thumb {
  display: none; /* CSS ::after handles the toggle knob */
}

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

.header-logo img {
  height: 32px;
  width: auto;
}

.header-title {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* ── Main Content ──────────────────────────────────────────── */
.main-content {
  padding-top: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.section {
  margin-bottom: 8px;
}

/* ================================================================
   GLASSMORPHISM CARD
   ================================================================ */

.card {
  background: var(--card-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  transition:
    background var(--transition),
    border-color var(--transition),
    box-shadow var(--transition),
    transform var(--transition);
}

.card:hover {
  background: var(--card-bg-hover);
  border-color: var(--card-border-hover);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

/* ================================================================
   AI CONNECTION SECTION
   ================================================================ */

.ai-connection {
  background: var(--card-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.ai-connection .form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

/* Connection Status */
.connection-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  transition: all var(--transition);
}

.connection-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background var(--transition);
}

.connection-dot.connected {
  background: var(--success);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
  animation: pulse 2s infinite;
}

.connection-dot.disconnected {
  background: var(--error);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.3);
}

.connection-status.connected {
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.2);
  background: var(--success-subtle);
}

.connection-status.disconnected {
  color: var(--text-tertiary);
}

/* ================================================================
   FORM ELEMENTS
   ================================================================ */

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.01em;
}

.form-label .badge {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

/* Shared input base */
.form-input,
.form-textarea,
.form-select {
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  color: var(--text-primary);
  background-color: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  outline: none;
  transition:
    border-color var(--transition),
    box-shadow var(--transition),
    background var(--transition);
  width: 100%;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-disabled);
}

.form-input:hover,
.form-textarea:hover,
.form-select:hover {
  border-color: rgba(255, 255, 255, 0.16);
  background-color: rgba(10, 15, 30, 0.80);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px var(--input-focus-glow), var(--shadow-sm);
  background-color: rgba(10, 15, 30, 0.90);
}

/* Textarea */
.form-textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.7;
}

/* Select */
.form-select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2394a3b8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

.form-select option {
  background: var(--bg-surface);
  color: var(--text-primary);
}

/* Character Counter */
.char-counter {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  text-align: right;
  margin-top: -2px;
  transition: color var(--transition-fast);
}

.char-counter.warning {
  color: var(--warning);
}

.char-counter.error {
  color: var(--error);
}

/* ================================================================
   TOGGLE SWITCH
   ================================================================ */

.toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toggle-switch {
  position: relative;
  width: 48px;
  height: 24px;
  background: rgba(255, 255, 255, 0.10);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition);
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: transform var(--transition), background var(--transition), box-shadow var(--transition);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.toggle-switch:hover::after {
  background: var(--text-primary);
}

.toggle-switch.active {
  background: var(--primary);
  border-color: rgba(250, 70, 22, 0.3);
}

.toggle-switch.active::after {
  transform: translateX(24px);
  background: #fff;
  box-shadow: 0 1px 8px rgba(250, 70, 22, 0.4);
}

.toggle-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  user-select: none;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.toggle-label:hover {
  color: var(--text-primary);
}

/* ================================================================
   SEGMENTED CONTROL / RADIO PILLS
   ================================================================ */

.segmented-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
}

.segment-option {
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 12px 20px;
  border-radius: calc(var(--radius-md) - 2px);
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
  text-align: left;
}

.segment-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.segment-content strong {
  font-size: 0.88rem;
  color: inherit;
}

.segment-desc {
  font-size: 0.75rem;
  font-weight: 400;
  opacity: 0.7;
  line-height: 1.4;
}

.segment-option:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.segment-option.active {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 2px 8px rgba(250, 70, 22, 0.3);
}

/* ================================================================
   FILE UPLOAD
   ================================================================ */

.file-upload-zone {
  border: 2px dashed rgba(255, 255, 255, 0.10);
  border-radius: var(--radius-lg);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: rgba(255, 255, 255, 0.015);
  position: relative;
  overflow: hidden;
}

.file-upload-zone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, var(--secondary-subtle) 0%, transparent 70%);
  opacity: 0;
  transition: opacity var(--transition);
}

.file-upload-zone:hover {
  border-color: rgba(59, 130, 246, 0.3);
  background: rgba(59, 130, 246, 0.04);
}

.file-upload-zone:hover::before {
  opacity: 1;
}

.file-upload-zone.dragover {
  border-color: var(--secondary);
  background: var(--secondary-subtle);
  box-shadow: inset 0 0 30px rgba(59, 130, 246, 0.06), var(--shadow-glow-secondary);
  transform: scale(1.01);
}

.file-upload-zone.dragover::before {
  opacity: 1;
}

.file-upload-icon {
  font-size: 2rem;
  margin-bottom: 12px;
  opacity: 0.5;
  transition: opacity var(--transition);
}

.file-upload-zone:hover .file-upload-icon {
  opacity: 0.8;
}

.file-upload-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.file-upload-text strong {
  color: var(--secondary);
}

.file-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  margin-top: 12px;
  font-size: 0.85rem;
  animation: fadeIn 0.3s ease;
}

.file-info-name {
  color: var(--text-primary);
  font-weight: 500;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-info-size {
  color: var(--text-tertiary);
  font-size: 0.78rem;
  flex-shrink: 0;
}

/* ================================================================
   WORKFLOW LIST
   ================================================================ */

.workflow-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.workflow-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  animation: slideDown 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  transition: border-color var(--transition), background var(--transition);
}

.workflow-item:hover {
  border-color: var(--card-border-hover);
  background: rgba(255, 255, 255, 0.05);
}

.workflow-item.removing {
  animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.workflow-item-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.workflow-item-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-subtle);
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.workflow-item .btn-danger {
  position: absolute;
  top: 12px;
  right: 12px;
}

.add-workflow-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  border: 2px dashed rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-tertiary);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.add-workflow-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-subtle);
}

.add-workflow-btn .icon {
  font-size: 1.1rem;
  font-weight: 300;
}

/* ================================================================
   SECTION CARD
   ================================================================ */

.section-card {
  background: var(--card-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.section-card:hover {
  border-color: var(--card-border-hover);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition-fast);
}

.section-header:hover {
  background: rgba(255, 255, 255, 0.02);
}

.section-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  background: var(--primary-subtle);
  color: var(--primary);
}

.section-icon.blue {
  background: var(--secondary-subtle);
  color: var(--secondary);
}

.section-icon.green {
  background: var(--success-subtle);
  color: var(--success);
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.section-subtitle {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* Badge */
.section-badge {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.section-badge.required {
  background: var(--primary-subtle);
  color: var(--primary);
  border: 1px solid rgba(250, 70, 22, 0.2);
}

.section-badge.optional {
  background: rgba(148, 163, 184, 0.08);
  color: var(--text-tertiary);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

/* Collapse chevron */
.section-chevron {
  width: 20px;
  height: 20px;
  color: var(--text-tertiary);
  transition: transform var(--transition);
  flex-shrink: 0;
}

.section-header[aria-expanded="false"] .section-chevron,
.section-header.collapsed .section-chevron {
  transform: rotate(-90deg);
}

/* Section Body */
.section-body {
  padding: 0 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  transition: max-height var(--transition-slow), opacity var(--transition), padding var(--transition);
  max-height: 2000px;
  opacity: 1;
  overflow: hidden;
}

.section-body.collapsed {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.section-divider {
  height: 1px;
  background: var(--card-border);
  margin: 0 24px;
}

/* ================================================================
   BUTTONS
   ================================================================ */

/* Shared button base */
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-icon {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition);
  outline: none;
  position: relative;
  overflow: hidden;
}

/* Primary */
.btn-primary {
  font-size: 0.9rem;
  padding: 14px 32px;
  border-radius: var(--radius-md);
  color: #fff;
  background: linear-gradient(135deg, var(--primary) 0%, #e03e10 100%);
  box-shadow: 0 4px 16px rgba(250, 70, 22, 0.25);
  letter-spacing: 0.01em;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.btn-primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 28px rgba(250, 70, 22, 0.35);
}

.btn-primary:hover::before {
  opacity: 1;
}

.btn-primary:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 2px 8px rgba(250, 70, 22, 0.3);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Secondary */
.btn-secondary {
  font-size: 0.85rem;
  padding: 10px 24px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--card-border);
}

.btn-secondary:hover {
  color: var(--text-primary);
  border-color: var(--card-border-hover);
  background: rgba(255, 255, 255, 0.04);
  transform: translateY(-1px);
}

.btn-secondary:active {
  transform: translateY(0);
}

/* Danger */
.btn-danger {
  font-size: 0.78rem;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: var(--error);
  background: var(--error-subtle);
  border: 1px solid rgba(239, 68, 68, 0.15);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.3);
  transform: scale(1.05);
}

.btn-danger:active {
  transform: scale(0.95);
}

/* Icon Button */
.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
  color: var(--text-tertiary);
  background: transparent;
  font-size: 1rem;
}

.btn-icon:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

/* ================================================================
   PROGRESS / GENERATION
   ================================================================ */

.progress-container {
  padding: 24px;
  text-align: center;
  animation: fadeIn 0.5s ease;
}

.progress-bar-wrapper {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: 16px 0;
  position: relative;
}

.progress-bar {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--primary), var(--secondary), var(--primary));
  background-size: 200% 100%;
  animation: progressGlow 2s ease infinite;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 60px;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3));
  animation: shimmer 1.5s ease infinite;
}

.progress-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 8px;
}

.progress-percentage {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

/* Generation Overlay */
.generation-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(7, 11, 22, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.generation-overlay .card {
  max-width: 480px;
  width: 90%;
  padding: 40px;
}

/* ================================================================
   RESULT SECTION
   ================================================================ */

.result-container {
  animation: fadeIn 0.5s ease;
}

.result-header {
  text-align: center;
  margin-bottom: 24px;
}

.result-success-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--success-subtle);
  color: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin: 0 auto 16px;
  box-shadow: 0 0 24px rgba(16, 185, 129, 0.2);
}

.result-file-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 20px 0;
}

.result-file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  animation: fadeIn 0.3s ease;
}

.result-file-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--card-border-hover);
}

.result-file-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--secondary-subtle);
  color: var(--secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.result-file-name {
  flex: 1;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-file-action {
  color: var(--text-tertiary);
  cursor: pointer;
  transition: color var(--transition-fast);
}

.result-file-action:hover {
  color: var(--secondary);
}

/* Download Button */
.download-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px;
  margin-top: 16px;
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--success) 0%, #0d9668 100%);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.25);
  transition: all var(--transition);
}

.download-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(16, 185, 129, 0.35);
}

.download-btn:active {
  transform: translateY(0);
}

/* ================================================================
   TOAST NOTIFICATIONS
   ================================================================ */

.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  min-width: 320px;
  max-width: 440px;
  background: var(--bg-elevated);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.85rem;
  color: var(--text-primary);
  pointer-events: auto;
  animation: toastIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  transition: all var(--transition);
}

.toast.dismissing {
  animation: toastOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.toast.success {
  border-left: 3px solid var(--success);
}
.toast.success .toast-icon { color: var(--success); }

.toast.error {
  border-left: 3px solid var(--error);
}
.toast.error .toast-icon { color: var(--error); }

.toast.info {
  border-left: 3px solid var(--secondary);
}
.toast.info .toast-icon { color: var(--secondary); }

.toast.warning {
  border-left: 3px solid var(--warning);
}
.toast.warning .toast-icon { color: var(--warning); }

.toast-message {
  flex: 1;
  line-height: 1.4;
}

.toast-close {
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 2px;
  transition: color var(--transition-fast);
  background: none;
  border: none;
  font-size: 1rem;
}

.toast-close:hover {
  color: var(--text-primary);
}

/* Toast progress bar (auto-dismiss) */
.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  animation: toastProgress 4s linear forwards;
}

.toast.success .toast-progress { background: var(--success); }
.toast.error .toast-progress { background: var(--error); }
.toast.info .toast-progress { background: var(--secondary); }
.toast.warning .toast-progress { background: var(--warning); }

/* ================================================================
   PREVIEW MODAL
   ================================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(7, 11, 22, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.25s ease;
}

.modal-content {
  width: 100%;
  max-width: 720px;
  max-height: 80vh;
  background: var(--bg-surface);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.modal-title {
  font-size: 1rem;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 1.1rem;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

/* Markdown preview inside modal */
.modal-body h1,
.modal-body h2,
.modal-body h3 {
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}

.modal-body p {
  margin-bottom: 0.8em;
}

.modal-body ul,
.modal-body ol {
  padding-left: 1.5em;
  margin-bottom: 0.8em;
}

.modal-body code {
  font-family: 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.82em;
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--primary-hover);
}

.modal-body pre {
  background: rgba(0, 0, 0, 0.35);
  padding: 16px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin-bottom: 1em;
  border: 1px solid var(--card-border);
}

.modal-body pre code {
  background: none;
  padding: 0;
}

/* ================================================================
   TAGS / CHIPS
   ================================================================ */

.tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--secondary-subtle);
  border: 1px solid rgba(59, 130, 246, 0.15);
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--secondary-hover);
  animation: fadeIn 0.2s ease;
  transition: all var(--transition-fast);
}

.tag:hover {
  background: rgba(59, 130, 246, 0.18);
}

.tag-remove {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--secondary);
  cursor: pointer;
  font-size: 0.7rem;
  transition: all var(--transition-fast);
  padding: 0;
  line-height: 1;
}

.tag-remove:hover {
  background: rgba(59, 130, 246, 0.25);
  color: #fff;
}

.tag-input {
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  color: var(--text-primary);
  background: transparent;
  border: none;
  outline: none;
  min-width: 120px;
  flex: 1;
  padding: 4px 0;
}

.tag-input::placeholder {
  color: var(--text-disabled);
}

.tag-input-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition), box-shadow var(--transition);
  cursor: text;
}

.tag-input-wrapper:focus-within {
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px var(--input-focus-glow);
}

/* ================================================================
   KEYFRAME ANIMATIONS
   ================================================================ */

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    max-height: 600px;
    transform: translateY(0);
  }
}

@keyframes slideUp {
  from {
    opacity: 1;
    max-height: 600px;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    max-height: 0;
    transform: translateY(-12px);
    padding-top: 0;
    padding-bottom: 0;
    margin-top: 0;
    margin-bottom: 0;
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
  }
  50% {
    opacity: 0.6;
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.3);
  }
}

@keyframes shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(200%); }
}

@keyframes progressGlow {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(80px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateX(80px) scale(0.95);
  }
}

@keyframes toastProgress {
  from  { width: 100%; }
  to    { width: 0%; }
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(16px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Spinner utility */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner.large {
  width: 40px;
  height: 40px;
  border-width: 3px;
}

/* ================================================================
   RESPONSIVE DESIGN
   ================================================================ */

/* Tablet: 768 - 1024px */
@media (max-width: 1024px) {
  .app-container {
    padding: 0 16px 48px;
  }

  .header {
    padding: 0 20px;
  }

  .section-body {
    padding: 0 20px 20px;
  }

  .section-header {
    padding: 16px 20px;
  }

  .ai-connection {
    padding: 20px;
  }
}

/* Mobile: < 768px */
@media (max-width: 767px) {
  :root {
    --header-height: 56px;
  }

  body {
    font-size: 15px;
  }

  .app-container {
    padding: 0 12px 40px;
  }

  .header {
    padding: 0 16px;
  }

  .header-title {
    font-size: 1rem;
  }

  .main-content {
    padding-top: 20px;
    gap: 16px;
  }

  .section-card {
    border-radius: var(--radius-md);
  }

  .section-header {
    padding: 14px 16px;
  }

  .section-body {
    padding: 0 16px 16px;
  }

  .section-icon {
    width: 30px;
    height: 30px;
    font-size: 0.95rem;
  }

  .section-title {
    font-size: 0.9rem;
  }

  .ai-connection {
    padding: 16px;
  }

  .ai-connection .form-row {
    grid-template-columns: 1fr;
  }

  .segmented-control {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .segment-option {
    padding: 8px 16px;
    font-size: 0.78rem;
  }

  .form-input,
  .form-textarea,
  .form-select {
    padding: 10px 14px;
    font-size: 0.85rem;
  }

  .btn-primary {
    width: 100%;
    padding: 14px 24px;
  }

  .toast-container {
    top: auto;
    bottom: 16px;
    right: 12px;
    left: 12px;
  }

  .toast {
    min-width: auto;
    width: 100%;
  }

  .modal-content {
    max-height: 90vh;
    border-radius: var(--radius-md);
  }

  .modal-body {
    padding: 16px;
  }

  .file-upload-zone {
    padding: 28px 16px;
  }

  .workflow-item {
    padding: 12px;
  }

  .download-btn {
    padding: 14px;
    font-size: 0.88rem;
  }

  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }
  h3 { font-size: 1.1rem; }
}

/* Small mobile: < 400px */
@media (max-width: 399px) {
  .app-container {
    padding: 0 8px 32px;
  }

  .connection-status {
    font-size: 0.72rem;
    padding: 4px 10px;
  }

  .toggle-switch {
    width: 42px;
    height: 22px;
  }

  .toggle-switch::after {
    width: 16px;
    height: 16px;
  }

  .toggle-switch.active::after {
    transform: translateX(20px);
  }
}

/* ================================================================
   UTILITY CLASSES
   ================================================================ */

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

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

.text-primary-color {
  color: var(--primary);
}

.text-success {
  color: var(--success);
}

.text-error {
  color: var(--error);
}

.text-center {
  text-align: center;
}

/* Margin */
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.ml-1 { margin-left: 8px; }
.mr-1 { margin-right: 8px; }

/* Gap */
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }

/* Width */
.w-full { width: 100%; }

/* ================================================================
   FOCUS MANAGEMENT — Accessibility
   ================================================================ */

:focus-visible {
  outline: 2px solid var(--secondary);
  outline-offset: 2px;
}

button:focus:not(:focus-visible),
input:focus:not(:focus-visible),
select:focus:not(:focus-visible),
textarea:focus:not(:focus-visible) {
  outline: none;
}

/* ================================================================
   PRINT
   ================================================================ */

@media print {
  body {
    background: #fff;
    color: #000;
  }

  .header,
  .toast-container,
  .modal-overlay,
  .generation-overlay {
    display: none !important;
  }

  .card,
  .section-card {
    background: #fff;
    border: 1px solid #ddd;
    box-shadow: none;
    backdrop-filter: none;
  }
}

/* ================================================================
   MISSING LAYOUT CLASSES (Header, Hero, etc.)
   ================================================================ */

/* Header Inner */
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo svg {
  flex-shrink: 0;
  filter: drop-shadow(0 0 8px rgba(250, 70, 22, 0.4));
}

.logo-text {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
}

/* Header Connection Status */
.header-connection-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  white-space: nowrap;
}

/* Hero Section */
.hero-section {
  text-align: center;
  padding: 48px 24px 32px;
}

.hero-title {
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--primary) 60%, var(--secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
  line-height: 1.2;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 680px;
  margin: 0 auto;
  line-height: 1.7;
}

/* Section Title Group */
.section-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-title-group h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

/* Input with Action (API key field) */
.input-with-action {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.input-with-action .form-input {
  flex: 1;
  padding-right: 48px;
}

.input-with-action .btn-icon {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
}

/* Toggle Row */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.toggle-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.toggle-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
}

.toggle-description {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  line-height: 1.5;
}

/* File Upload Texts */
.upload-text {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-top: 12px;
  position: relative;
  z-index: 1;
}

.upload-subtext {
  font-size: 0.82rem;
  color: var(--text-tertiary);
  margin-top: 4px;
  position: relative;
  z-index: 1;
}

.upload-formats {
  font-size: 0.72rem;
  color: var(--text-disabled);
  margin-top: 12px;
  position: relative;
  z-index: 1;
}

.file-upload-zone svg {
  color: var(--text-tertiary);
  position: relative;
  z-index: 1;
  opacity: 0.6;
  transition: opacity var(--transition);
}

.file-upload-zone:hover svg {
  opacity: 0.9;
  color: var(--secondary);
}

/* File Info Layout */
.file-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  animation: fadeIn 0.3s ease;
}

.file-info-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.file-info-left div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.file-name {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-size {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.file-status {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.file-status.success {
  color: var(--success);
}

.file-status.warning {
  color: var(--warning);
}

/* Workflow Number */
.workflow-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-subtle);
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Section Hint */
.section-hint {
  font-size: 0.82rem;
  color: var(--text-tertiary);
  line-height: 1.6;
  padding: 0;
  margin: 0 0 8px;
}

/* App Suggestions */
.app-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.app-suggestion {
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.app-suggestion:hover {
  background: var(--secondary-subtle);
  border-color: rgba(59, 130, 246, 0.2);
  color: var(--secondary-hover);
  transform: translateY(-1px);
}

.app-suggestion.selected {
  background: var(--secondary-subtle);
  border-color: var(--secondary);
  color: var(--secondary);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.15);
}

/* ================================================================
   GENERATE SECTION & BUTTON
   ================================================================ */

.generate-section {
  text-align: center;
  padding: 32px 0;
}

.btn-generate {
  font-family: 'Inter', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 18px 48px;
  border-radius: var(--radius-lg);
  color: #fff;
  background: linear-gradient(135deg, var(--primary) 0%, #e03e10 50%, var(--primary) 100%);
  background-size: 200% 100%;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow:
    0 4px 20px rgba(250, 70, 22, 0.3),
    0 0 60px rgba(250, 70, 22, 0.08);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  letter-spacing: 0.01em;
}

.btn-generate::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 50%);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.btn-generate:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow:
    0 8px 36px rgba(250, 70, 22, 0.4),
    0 0 80px rgba(250, 70, 22, 0.12);
  background-position: 100% 0;
}

.btn-generate:hover::before {
  opacity: 1;
}

.btn-generate:active {
  transform: translateY(-1px) scale(0.99);
}

.btn-generate:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 4px 16px rgba(250, 70, 22, 0.15);
}

.btn-generate svg {
  flex-shrink: 0;
}

.generate-hint {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  margin-top: 12px;
  line-height: 1.5;
}

/* ================================================================
   PROGRESS BAR FIX (wrapper for section-body)
   ================================================================ */

.progress-container {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.progress-percent {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--primary);
}

.pulse-icon {
  animation: pulse 1.5s ease-in-out infinite;
}

/* ================================================================
   RESULT SECTION ENHANCEMENTS
   ================================================================ */

.result-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}

.result-actions .btn-generate {
  flex: 1;
}

.result-actions .btn-secondary {
  white-space: nowrap;
}

.result-file-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.result-file-name {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-file-size {
  font-size: 0.72rem;
  color: var(--text-tertiary);
}

.btn-small {
  font-size: 0.75rem;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  gap: 4px;
}

/* ================================================================
   TOAST CLASS ALIASES (toast-success = toast success)
   ================================================================ */

.toast-success { border-left: 3px solid var(--success); }
.toast-success .toast-icon { color: var(--success); }

.toast-error { border-left: 3px solid var(--error); }
.toast-error .toast-icon { color: var(--error); }

.toast-info { border-left: 3px solid var(--secondary); }
.toast-info .toast-icon { color: var(--secondary); }

.toast-warning { border-left: 3px solid var(--warning); }
.toast-warning .toast-icon { color: var(--warning); }

.toast.show {
  opacity: 1;
  transform: translateX(0) scale(1);
}

/* ================================================================
   SPIN ANIMATION UTILITY
   ================================================================ */

.spin {
  animation: spin 1s linear infinite;
}

/* ================================================================
   MARKDOWN CONTENT (Preview)
   ================================================================ */

.markdown-content {
  color: var(--text-secondary);
  line-height: 1.7;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4 {
  color: var(--text-primary);
  margin-top: 1.4em;
  margin-bottom: 0.5em;
}

.markdown-content h1 { font-size: 1.5rem; }
.markdown-content h2 { font-size: 1.25rem; }
.markdown-content h3 { font-size: 1.1rem; }

.markdown-content p { margin-bottom: 0.8em; }

.markdown-content ul,
.markdown-content ol {
  padding-left: 1.5em;
  margin-bottom: 0.8em;
}

.markdown-content li {
  margin-bottom: 0.3em;
}

.markdown-content code {
  font-family: 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.85em;
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--primary-hover);
}

.markdown-content pre {
  background: rgba(0, 0, 0, 0.35);
  padding: 16px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin-bottom: 1em;
  border: 1px solid var(--card-border);
}

.markdown-content pre code {
  background: none;
  padding: 0;
}

.markdown-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
  font-size: 0.85rem;
}

.markdown-content th,
.markdown-content td {
  padding: 8px 12px;
  border: 1px solid var(--card-border);
  text-align: left;
}

.markdown-content th {
  background: rgba(255, 255, 255, 0.04);
  font-weight: 600;
  color: var(--text-primary);
}

.markdown-content blockquote {
  border-left: 3px solid var(--primary);
  padding-left: 16px;
  margin: 1em 0;
  color: var(--text-tertiary);
}

.markdown-content strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* ================================================================
   FOOTER
   ================================================================ */

.footer {
  text-align: center;
  padding: 32px 24px;
  color: var(--text-disabled);
  font-size: 0.78rem;
  border-top: 1px solid var(--card-border);
  margin-top: 48px;
}

.footer p {
  color: var(--text-disabled);
}

/* ================================================================
   MODAL ACTIVE STATE
   ================================================================ */

.modal-overlay.active {
  display: flex;
}

.modal-overlay.hidden {
  display: none !important;
}

/* ================================================================
   AUTO INFO BOX (Workflow auto mode)
   ================================================================ */

.auto-info-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  background: rgba(59, 130, 246, 0.06);
  border: 1px solid rgba(59, 130, 246, 0.15);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.6;
}

.auto-info-box svg {
  flex-shrink: 0;
  color: var(--secondary);
  margin-top: 2px;
}

.workflow-mode-control {
  margin-bottom: 8px;
}

/* ================================================================
   RESPONSIVE ADDITIONS
   ================================================================ */

@media (max-width: 767px) {
  .hero-title {
    font-size: 1.6rem;
  }

  .hero-subtitle {
    font-size: 0.9rem;
  }

  .hero-section {
    padding: 32px 16px 24px;
  }

  .btn-generate {
    width: 100%;
    padding: 16px 32px;
    font-size: 0.95rem;
  }

  .generate-section {
    padding: 24px 0;
  }

  .toggle-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .result-actions {
    flex-direction: column;
  }

  .result-actions .btn-generate,
  .result-actions .btn-secondary {
    width: 100%;
  }

  .app-suggestions {
    gap: 6px;
  }

  .app-suggestion {
    font-size: 0.75rem;
    padding: 6px 10px;
  }

  .header-connection-status .connection-text {
    display: none;
  }

  .logo-text {
    font-size: 0.9rem;
  }
}
