@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Prompt:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --font-sans: 'Plus Jakarta Sans', 'Prompt', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Modern Light Theme Palette */
  --bg-main: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F8FAFC;
  --bg-input: #F8FAFC;
  --bg-subtle: #F1F5F9;
  
  --border: #E2E8F0;
  --border-hover: #CBD5E1;
  --border-focus: #4F46E5;

  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;

  --primary: #4F46E5;
  --primary-hover: #4338CA;
  --primary-glow: rgba(79, 70, 229, 0.15);

  --accent: #0284C7;
  --accent-glow: rgba(2, 132, 199, 0.12);

  --success: #059669;
  --success-bg: #ECFDF5;
  --success-border: #A7F3D0;

  --error: #DC2626;
  --error-bg: #FEF2F2;
  --error-border: #FECACA;

  --warning: #D97706;
  --warning-bg: #FFFBEB;
  --warning-border: #FDE68A;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 28px -4px rgba(15, 23, 42, 0.08), 0 4px 8px -2px rgba(15, 23, 42, 0.03);
  --shadow-glow: 0 10px 25px -3px rgba(79, 70, 229, 0.12);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Ambient Subtle Background Gradients */
body::before, body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
}

body::before {
  top: -120px;
  left: 15%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, transparent 70%);
}

body::after {
  bottom: -120px;
  right: 15%;
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.07) 0%, transparent 70%);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

.container-form {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 20px 80px;
  position: relative;
  z-index: 1;
}

/* Navbar / Header */
.header {
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(255, 255, 255, 0.88);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 1.15rem;
}

.logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--primary), #06B6D4);
  border-radius: var(--radius-sm);
  color: white;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

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

/* Hero Section */
.hero {
  padding: 60px 0 40px;
  text-align: center;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: #EEF2FF;
  border: 1px solid #C7D2FE;
  border-radius: 9999px;
  color: #4338CA;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 20px;
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.05);
}

.hero-title {
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.25;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #0F172A 0%, #1E293B 45%, #4F46E5 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 680px;
  margin: 0 auto 32px;
}

/* Settings Bar (Endpoint Config) */
.config-bar {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 48px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

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

.config-info-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: #EEF2FF;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid #E0E7FF;
}

.config-input-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 320px;
}

.config-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-hover);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  outline: none;
  transition: all 0.2s;
}

.config-input:focus {
  background: #FFFFFF;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* Grid of Templates */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
  margin-bottom: 80px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  display: flex;
  flex-direction: column;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), #06B6D4);
  opacity: 0;
  transition: opacity 0.25s;
}

.card:hover {
  transform: translateY(-4px);
  border-color: #C7D2FE;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  background: var(--bg-surface);
}

.card:hover::before {
  opacity: 1;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: #EEF2FF;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  border: 1px solid #E0E7FF;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.badge-popular {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}

.badge-recommended {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.badge-new {
  background: #F0FDF4;
  color: #0284C7;
  border: 1px solid #BAE6FD;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.card-desc {
  font-size: 0.92rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
  flex: 1;
  line-height: 1.55;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.card-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.9rem;
  transition: gap 0.2s;
}

.card:hover .card-cta {
  gap: 10px;
  color: var(--primary-hover);
}

/* Form Container Styles */
.form-shell {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.form-header {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.form-badge-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.form-title {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.form-description {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Endpoint info strip */
.endpoint-strip {
  margin-top: 18px;
  padding: 10px 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.endpoint-strip-target {
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.endpoint-strip-url {
  font-family: var(--font-mono);
  color: var(--primary);
  font-weight: 600;
}

/* Form Fields */
.form-group {
  margin-bottom: 22px;
}

.form-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.required-mark {
  color: var(--error);
  margin-left: 4px;
}

.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-hover);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  outline: none;
  transition: all 0.2s ease;
}

.form-control::placeholder {
  color: var(--text-muted);
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
  background: #FFFFFF;
}

textarea.form-control {
  min-height: 120px;
  resize: vertical;
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

select.form-control option {
  background: #FFFFFF;
  color: var(--text-primary);
}

/* File Upload Dropzone */
.file-dropzone {
  border: 2px dashed #CBD5E1;
  border-radius: var(--radius-md);
  padding: 26px;
  text-align: center;
  background: var(--bg-subtle);
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.file-dropzone:hover, .file-dropzone.drag-over {
  border-color: var(--primary);
  background: #EEF2FF;
}

.file-dropzone input[type="file"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.file-icon {
  width: 44px;
  height: 44px;
  margin: 0 auto 10px;
  color: var(--primary);
}

.file-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.file-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.file-selected-name {
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 600;
  font-family: var(--font-mono);
  display: none;
}

/* Action Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, #4F46E5, #4338CA);
  color: white;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4338CA, #3730A3);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.35);
}

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

.btn-secondary {
  background: #FFFFFF;
  color: var(--text-secondary);
  border: 1px solid var(--border-hover);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
  border-color: #94A3B8;
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* Spinner */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: none;
}

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

/* Back Link */
.back-nav {
  margin-bottom: 24px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}

.back-nav:hover {
  color: var(--primary);
  border-color: #C7D2FE;
  background: #EEF2FF;
}

/* Result Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
  max-width: 520px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 45px -10px rgba(15, 23, 42, 0.25);
  animation: modalEnter 0.25s ease-out;
}

@keyframes modalEnter {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-icon.success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.modal-icon.error {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid var(--error-border);
}

.modal-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.modal-desc {
  font-size: 0.92rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.5;
}

.modal-details {
  background: #0F172A;
  border: 1px solid #1E293B;
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: #A5B4FC;
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 24px;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 10px 25px -4px rgba(15, 23, 42, 0.12);
  z-index: 999;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--text-primary);
  font-size: 0.9rem;
}

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

/* Deploy Guide Cards */
.deploy-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

/* Code Snippet Box */
.code-box {
  margin-top: 32px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.code-pre {
  background: #0F172A;
  border: 1px solid #1E293B;
  padding: 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: #E2E8F0;
  overflow-x: auto;
  max-height: 220px;
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  background: var(--bg-surface);
}

.footer a {
  color: var(--text-secondary);
  text-decoration: none;
}

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

/* Responsive */
@media (max-width: 640px) {
  .form-shell {
    padding: 24px 18px;
  }
  .config-bar {
    padding: 16px;
  }
  .config-input-group {
    min-width: 100%;
  }
}
