/* ═══════════════════════════════════════════════════════
   AI Format Converter — Plain & Mobile Friendly CSS
   ═══════════════════════════════════════════════════════ */

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

:root {
  --bg-base:        #ffffff;
  --bg-surface:     #f8f9fa;
  --bg-card:        #ffffff;
  --bg-input:       #ffffff;
  --border:         #e2e8f0;
  --border-dark:    #cbd5e1;

  --text-primary:   #0f172a;
  --text-secondary: #475569;
  --text-muted:     #64748b;

  --font-sans:      'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:      'JetBrains Mono', monospace;

  --radius-sm:  4px;
  --radius-md:  6px;
  --radius-lg:  8px;
}

html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background-color: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
}

/* ── HEADER ────────────────────────────────────────── */
.header {
  background: var(--bg-base);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* ── APP SHELL ─────────────────────────────────────── */
.app-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* ── FORMAT BAR ────────────────────────────────────── */
.format-bar {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 1rem;
  width: 100%;
}
.format-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}
.format-tabs {
  display: flex;
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
}
.fmt-tab {
  flex: 1;
  text-align: center;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  white-space: nowrap;
}
.fmt-tab:hover { color: var(--text-primary); }
.fmt-tab.active {
  background: var(--bg-base);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* ── PANES ─────────────────────────────────────────── */
.panes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  min-height: 480px;
}

.pane {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

/* ── PANE HEADER ───────────────────────────────────── */
.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
}
.pane-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.pane-actions { display: flex; gap: 0.5rem; }
.pane-btn {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-dark);
  background: var(--bg-base);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
}
.pane-btn:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
}

/* ── PANE BODY ─────────────────────────────────────── */
.pane-body { flex: 1; overflow: hidden; display: flex; flex-direction: column; }

/* INPUT */
.input-area {
  flex: 1;
  width: 100%;
  padding: 1rem;
  background: var(--bg-input);
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
  resize: none;
  min-height: 250px;
}
.input-area::placeholder { color: var(--text-muted); font-family: var(--font-sans); }

/* OPTIONS STRIP */
.options-strip {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.opt-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}
.opt-toggle input[type="checkbox"] {
  accent-color: var(--text-primary);
  width: 14px;
  height: 14px;
  cursor: pointer;
}

/* OUTPUT */
.preview-area {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  background: var(--bg-input);
}
.code-area {
  flex: 1;
  padding: 1rem;
  overflow: auto;
  background: var(--bg-surface);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-all;
}
.hidden { display: none !important; }

/* ── EMPTY STATE ───────────────────────────────────── */
.empty-state {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.5rem;
  padding: 2rem;
}
.empty-title { font-size: 0.95rem; font-weight: 600; color: var(--text-secondary); }
.empty-sub { font-size: 0.85rem; color: var(--text-muted); }

/* ── DOCUMENT PREVIEW STYLES ───────────────────────── */
.doc-preview {
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  line-height: 1.7;
}
.doc-preview h1 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}
.doc-preview h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
}
.doc-preview h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-top: 1rem;
  margin-bottom: 0.4rem;
}
.doc-preview p { margin-bottom: 0.75rem; color: var(--text-primary); }
.doc-preview ul, .doc-preview ol { padding-left: 1.5rem; margin-bottom: 0.75rem; }
.doc-preview li { margin-bottom: 0.3rem; }
.doc-preview a { color: var(--text-primary); text-decoration: underline; }
.doc-preview code { font-family: var(--font-mono); font-size: 0.85em; background: var(--bg-surface); border: 1px solid var(--border); padding: 2px 4px; border-radius: 3px; }
.doc-preview pre { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.75rem; margin: 0.75rem 0; overflow-x: auto; }
.doc-preview pre code { border: none; padding: 0; }
.doc-preview blockquote { border-left: 3px solid var(--text-muted); padding-left: 0.75rem; color: var(--text-secondary); margin: 0.75rem 0; font-style: italic; }
.doc-preview hr { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }

/* Callout box */
.doc-callout {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
}

/* ── EXPORT BAR ─────────────────────────────────────── */
.export-bar {
  margin-top: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.export-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}
.export-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  flex: 1;
}
.export-btn {
  padding: 0.6rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-dark);
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  flex: 1;
  min-width: 140px;
  text-align: center;
}
.export-btn:hover {
  background: var(--bg-surface);
  border-color: var(--text-primary);
}
.export-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── TOAST ─────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--text-primary);
  color: var(--bg-base);
  border-radius: var(--radius-md);
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.25s ease;
  z-index: 999;
  pointer-events: none;
}
.toast.show { transform: translateY(0); opacity: 1; }

/* ── RESPONSIVE / MOBILE FRIENDLY ───────────────────── */
@media (max-width: 768px) {
  .app-shell { padding: 1rem; }
  .panes {
    grid-template-columns: 1fr;
    gap: 1rem;
    min-height: auto;
  }
  .input-area {
    min-height: 180px;
  }
  .preview-area, .code-area {
    min-height: 200px;
  }
  .export-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    width: 100%;
  }
  .export-label {
    margin-bottom: 0.25rem;
  }
  .export-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    gap: 0.5rem;
  }
  .export-btn {
    min-width: 0;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .header-inner {
    padding: 0.75rem 1rem;
  }
  .export-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }
  .export-btn {
    padding: 0.6rem 0.5rem;
    font-size: 0.8rem;
  }
  .options-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .opt-toggle {
    font-size: 0.78rem;
  }
}
