/**
 * MafLabs Design System - ChatGPT & Claude Text Splitter
 * 100% Client-side, light theme only, responsive split-screen with draggable divider.
 */

@import url('fonts/fonts.css');

:root {
  /* Colors */
  --heading: #0f172a;
  --body: #475569;
  --muted: #64748b;
  --brand-blue: #2563eb;
  --brand-violet: #7c3aed;
  --brand-gradient: linear-gradient(90deg, #2563eb, #7c3aed);

  --badge-bg: #eff6ff;
  --badge-border: #bfdbfe;
  --badge-text: #1d4ed8;

  --card-bg: rgba(255, 255, 255, 0.88);
  --card-border: #e2e8f0;
  --card-surface: #ffffff;
  --card-surface-low: #f8fafc;
  --card-surface-high: #f1f5f9;

  /* Status Colors */
  --success-text: #16a34a;
  --success-bg: #f0fdf4;
  --success-border: #bbf7d0;

  --warning-text: #b45309;
  --warning-bg: #fffbeb;
  --warning-border: #fde68a;

  --error-text: #dc2626;
  --error-bg: #fef2f2;
  --error-border: #fecaca;

  /* Elevation & Borders */
  --radius-card: 14px;
  --radius-btn: 10px;
  --radius-input: 8px;
  --radius-full: 9999px;
  --shadow-card: 0 4px 24px rgba(15, 23, 42, 0.06);
  --shadow-elevated: 0 12px 32px rgba(15, 23, 42, 0.12);
  --shadow-btn: 0 6px 16px rgba(79, 70, 229, 0.28);
  --focus-ring: 0 0 0 4px rgba(37, 99, 235, 0.15);

  /* Typography */
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, 'JetBrains Mono', Menlo, Monaco, Consolas, 'Courier New', monospace;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  color: var(--body);
  background-color: #ffffff;
  min-height: 100vh;
  line-height: 1.6;
  position: relative;
  overflow-x: hidden;
}

/* Ambient mesh background glows */
.bg-mesh {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(circle at 10% 20%, rgba(169, 214, 245, 0.55) 0%, rgba(169, 214, 245, 0) 48%),
    radial-gradient(circle at 90% 25%, rgba(227, 201, 243, 0.45) 0%, rgba(227, 201, 243, 0) 50%);
  filter: blur(55px);
}

a {
  color: var(--brand-blue);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover {
  text-decoration: underline;
}

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

/* Site Header */
.site-header {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 800;
  text-decoration: none;
}
.brand-logo:hover {
  text-decoration: none;
}

.logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--brand-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.25);
}

.brand-text-maf {
  color: var(--heading);
}

.brand-text-labs {
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 14px;
  font-weight: 500;
}
.header-nav a {
  color: var(--body);
}
.header-nav a:hover {
  color: var(--brand-blue);
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  color: var(--heading);
}

/* Compact Hero (under 140px on desktop) */
.hero-section {
  max-width: 1440px;
  margin: 0 auto;
  padding: 14px 24px 8px 24px;
  text-align: center;
}

.category-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--badge-bg);
  border: 1px solid var(--badge-border);
  color: var(--badge-text);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.hero-h1 {
  font-family: var(--font-heading);
  font-size: clamp(22px, 3.2vw, 32px);
  font-weight: 800;
  color: var(--heading);
  line-height: 1.2;
  letter-spacing: -0.025em;
  margin-bottom: 4px;
}

.gradient-text {
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 14px;
  color: var(--body);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-privacy {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
}

/* Toolbar */
.workspace-toolbar-container {
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 4px 24px;
}

.workspace-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
  flex-wrap: wrap;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Quick Presets Pills */
.presets-group {
  display: flex;
  background: var(--card-surface-high);
  padding: 3px;
  border-radius: 10px;
  gap: 2px;
}

.preset-pill {
  border: none;
  background: transparent;
  padding: 4px 9px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  color: var(--body);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.preset-pill:hover {
  color: var(--heading);
}
.preset-pill.active {
  background: #ffffff;
  color: var(--brand-blue);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  white-space: nowrap;
  font-family: inherit;
  min-height: 38px;
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn-primary {
  background: var(--brand-gradient);
  color: #ffffff;
  box-shadow: var(--shadow-btn);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.35);
}

.btn-secondary {
  background: #ffffff;
  color: var(--heading);
  border: 1px solid var(--card-border);
}
.btn-secondary:hover {
  border-color: var(--brand-blue);
  color: var(--brand-blue);
}

.btn-icon {
  background: #ffffff;
  border: 1px solid var(--card-border);
  color: var(--muted);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-icon:hover {
  color: var(--heading);
  border-color: var(--muted);
}

.progress-bar-container {
  width: 100%;
  height: 3px;
  background: transparent;
  overflow: hidden;
  margin-top: 2px;
}
.progress-bar-fill {
  width: 0%;
  height: 100%;
  background: var(--brand-gradient);
  transition: width 0.2s ease;
}

/* WORKSPACE SPLIT */
.workspace-wrapper {
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 6px 24px 24px 24px;
}

.workspace-split {
  display: flex;
  width: 100%;
  height: calc(100dvh - 215px);
  min-height: 560px;
  position: relative;
  gap: 0;
}

.workspace-pane {
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}

.pane-left {
  width: calc(50% - 6px);
}
.pane-right {
  width: calc(50% - 6px);
}

.split-divider {
  width: 12px;
  cursor: col-resize;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 20;
  user-select: none;
  touch-action: none;
}
.split-divider::after {
  content: "";
  width: 4px;
  height: 36px;
  border-radius: 2px;
  background: #cbd5e1;
  transition: background 0.15s ease, height 0.15s ease;
}
.split-divider:hover::after,
.split-divider.dragging::after {
  background: var(--brand-blue);
  height: 48px;
}

/* Pane Header */
.pane-header {
  padding: 8px 14px;
  background: var(--card-surface-low);
  border-bottom: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
  min-height: 46px;
}

.pane-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pane-title {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: var(--heading);
}

.pane-badge {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--card-surface-high);
  color: var(--muted);
  font-weight: 500;
}

/* Editor with Gutter */
.editor-container {
  display: flex;
  flex: 1;
  min-height: 0;
  position: relative;
  background: #ffffff;
  overflow: hidden;
}

.editor-gutter {
  width: 52px;
  padding: 12px 6px;
  background: #f8fafc;
  border-right: 1px solid var(--card-border);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
  color: #94a3b8;
  text-align: right;
  user-select: none;
  overflow: hidden;
  flex-shrink: 0;
  white-space: pre;
}

.editor-textarea {
  flex: 1;
  min-height: 0;
  width: 100%;
  padding: 12px 14px;
  border: none;
  outline: none;
  resize: none;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
  color: var(--heading);
  background: transparent;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;
}

/* Chunks Container */
.chunks-scroll-container {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #ffffff;
}

/* Chunk Card */
.chunk-card {
  border: 1px solid var(--card-border);
  border-radius: 10px;
  background: #ffffff;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  transition: all 0.15s ease;
}
.chunk-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}
.chunk-card.done {
  background: #f8fafc;
  border-color: #cbd5e1;
  opacity: 0.75;
}

.chunk-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 8px;
}

.chunk-card-title {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  color: var(--heading);
  display: flex;
  align-items: center;
  gap: 8px;
}

.chunk-metrics {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

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

.btn-copy-chunk {
  background: var(--brand-gradient);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-copy-chunk.copied {
  background: var(--success-bg);
  color: var(--success-text);
  border: 1px solid var(--success-border);
}

.chunk-body-preview {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--body);
  background: #f8fafc;
  padding: 10px;
  border-radius: 6px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 160px;
  overflow-y: auto;
}

/* Focus Mode */
body.focus-mode {
  overflow: hidden;
}
body.focus-mode .workspace-wrapper {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  z-index: 1000;
  background: #ffffff;
  padding: 12px;
}
body.focus-mode .workspace-split {
  height: calc(100vh - 24px);
}
body.focus-mode .site-header,
body.focus-mode .hero-section,
body.focus-mode .workspace-toolbar-container,
body.focus-mode .seo-section,
body.focus-mode .site-footer {
  display: none !important;
}

/* Sticky mobile bottom bar */
.mobile-sticky-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--card-border);
  padding: 10px 16px;
  z-index: 40;
  gap: 10px;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-backdrop.open {
  display: flex;
}

.modal-card {
  background: #ffffff;
  border-radius: var(--radius-card);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-elevated);
  max-width: 520px;
  width: 100%;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: var(--heading);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--heading);
}
.form-input, .form-select {
  padding: 8px 12px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-input);
  font-size: 13px;
  outline: none;
  background: #ffffff;
}
.form-input:focus, .form-select:focus {
  border-color: var(--brand-blue);
  box-shadow: var(--focus-ring);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 13px;
}
kbd {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 2px 7px;
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--heading);
}

/* SEO Content */
.seo-section {
  max-width: 1000px;
  margin: 40px auto;
  padding: 0 24px;
}

.seo-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.seo-content h2 {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 800;
  color: var(--heading);
  margin-top: 16px;
}
.seo-content h3 {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: var(--heading);
}
.seo-content p, .seo-content li {
  font-size: 15px;
  line-height: 1.7;
  color: var(--body);
}
.seo-content ol, .seo-content ul {
  padding-left: 24px;
}

.code-comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 12px 0;
}
.code-box-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 4px;
}
.code-box {
  background: #f8fafc;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-all;
}

.faq-item {
  border: 1px solid var(--card-border);
  border-radius: 10px;
  background: #ffffff;
  padding: 12px 16px;
  margin-bottom: 10px;
}
.faq-item summary {
  font-weight: 600;
  color: var(--heading);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.faq-item summary::-webkit-details-marker {
  display: none;
}
.faq-item summary::after {
  content: "+";
  font-size: 18px;
  font-weight: 400;
  color: var(--muted);
}
.faq-item[open] summary::after {
  content: "–";
}
.faq-answer {
  padding-top: 10px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--body);
}

/* Site Footer */
.site-footer {
  border-top: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.9);
  padding: 32px 24px;
  margin-top: 48px;
}
.footer-container {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.more-tools-list {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.tool-tag {
  background: var(--card-surface-high);
  color: var(--body);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  text-decoration: none;
}
.tool-tag:hover {
  background: #e2e8f0;
  color: var(--heading);
  text-decoration: none;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: #0f172a;
  color: #ffffff;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: var(--shadow-elevated);
  pointer-events: auto;
}

/* RESPONSIVE */
@media (max-width: 900px) {
  .workspace-split {
    flex-direction: column;
    height: auto;
  }
  .pane-left, .pane-right {
    width: 100% !important;
    min-height: 60dvh;
  }
  .split-divider {
    display: none;
  }
  .mobile-sticky-bar {
    display: flex;
  }
  .workspace-wrapper {
    padding-bottom: 70px;
  }
}

@media (max-width: 700px) {
  .header-nav {
    display: none;
  }
  .nav-toggle {
    display: block;
  }
  .hero-h1 {
    font-size: 24px;
  }
}


/* Ambient Background Blobs (Fixed across entire viewport) */
.blob-bg-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  -webkit-filter: blur(80px);
  opacity: 0.85;
  will-change: transform;
}

.blob-1 {
  top: -12vh;
  left: -8vw;
  width: 50vw;
  height: 50vw;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.32) 0%, rgba(59, 130, 246, 0.16) 45%, rgba(255, 255, 255, 0) 70%);
  animation: blob-float-1 20s infinite ease-in-out alternate;
}

.blob-2 {
  top: -10vh;
  right: -10vw;
  width: 48vw;
  height: 48vw;
  background: radial-gradient(circle, rgba(147, 51, 234, 0.28) 0%, rgba(168, 85, 247, 0.15) 45%, rgba(255, 255, 255, 0) 70%);
  animation: blob-float-2 24s infinite ease-in-out alternate;
}

.blob-3 {
  bottom: -15vh;
  left: -10vw;
  width: 52vw;
  height: 52vw;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.25) 0%, rgba(14, 165, 233, 0.14) 45%, rgba(255, 255, 255, 0) 70%);
  animation: blob-float-3 22s infinite ease-in-out alternate;
}

.blob-4 {
  bottom: -10vh;
  right: -8vw;
  width: 46vw;
  height: 46vw;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.28) 0%, rgba(236, 72, 153, 0.15) 45%, rgba(255, 255, 255, 0) 70%);
  animation: blob-float-4 26s infinite ease-in-out alternate;
}

@keyframes blob-float-1 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(5vw, 6vh) scale(1.06); }
  100% { transform: translate(-3vw, 10vh) scale(0.96); }
}

@keyframes blob-float-2 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-6vw, 8vh) scale(1.08); }
  100% { transform: translate(4vw, 5vh) scale(0.94); }
}

@keyframes blob-float-3 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(6vw, -8vh) scale(1.06); }
  100% { transform: translate(-4vw, -4vh) scale(0.95); }
}

@keyframes blob-float-4 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-5vw, -6vh) scale(1.08); }
  100% { transform: translate(6vw, -10vh) scale(0.95); }
}

/* Ensure foreground content stacks above blobs */
header, main, footer, .container, .site-header, .site-footer, .workspace, article {
  position: relative;
  z-index: 1;
}
