/* ==========================================================================
   CleanPrompt — Minimalist Design System (Shadcn UI + Linear/Notion Dark & Light)
   Default Theme: Dark Mode (data-theme="dark") for maximum visual comfort
   ========================================================================== */

:root,
[data-theme="light"] {
  --bg-page: #f8fafc;
  --bg-header: rgba(255, 255, 255, 0.86);
  --bg-card: #ffffff;
  --bg-surface: #f8fafc;
  --bg-elevated: #ffffff;
  --bg-muted: #f1f5f9;
  --bg-pill: #f1f5f9;
  --bg-pill-hover: #e2e8f0;
  --bg-pdf-backdrop: #e2e8f0;

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

  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;

  --accent-50: #eef2ff;
  --accent-100: #e0e7ff;
  --accent-400: #818cf8;
  --accent-500: #6366f1;
  --accent-600: #4f46e5;
  --violet-500: #8b5cf6;
  --violet-600: #7c3aed;

  --emerald-bg: #ecfdf5;
  --emerald-border: rgba(5, 150, 105, 0.25);
  --emerald-text: #047857;
  --emerald-solid: #059669;

  --rose-bg: #fff1f2;
  --rose-border: #fecdd3;
  --rose-text: #e11d48;

  --btn-copy-bg: #0f172a;
  --btn-copy-hover: #1e293b;
  --btn-copy-text: #ffffff;

  --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.07), 0 1px 2px -1px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.06), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
  --shadow-accent: 0 8px 22px -4px rgba(79, 70, 229, 0.38);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-serif: 'Merriweather', Georgia, Cambria, "Times New Roman", Times, serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

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

/* ==========================================================================
   Dark Mode Tokens (Linear / Raycast / Shadcn Dark Palette)
   ========================================================================== */
[data-theme="dark"] {
  --bg-page: #090d16;
  --bg-header: rgba(9, 13, 22, 0.82);
  --bg-card: #111827;
  --bg-surface: #0b111e;
  --bg-elevated: #1e293b;
  --bg-muted: #161f33;
  --bg-pill: #161f33;
  --bg-pill-hover: #1e293b;
  --bg-pdf-backdrop: #0b111e;

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-placeholder: #64748b;

  --border-subtle: #1e293b;
  --border-strong: #334155;

  --accent-50: rgba(99, 102, 241, 0.14);
  --accent-100: rgba(99, 102, 241, 0.28);
  --accent-400: #818cf8;
  --accent-500: #6366f1;
  --accent-600: #4f46e5;
  --violet-500: #a78bfa;
  --violet-600: #7c3aed;

  --emerald-bg: rgba(16, 185, 129, 0.12);
  --emerald-border: rgba(16, 185, 129, 0.3);
  --emerald-text: #34d399;
  --emerald-solid: #059669;

  --rose-bg: rgba(244, 63, 94, 0.12);
  --rose-border: rgba(244, 63, 94, 0.35);
  --rose-text: #fb7185;

  --btn-copy-bg: #f8fafc;
  --btn-copy-hover: #e2e8f0;
  --btn-copy-text: #090d16;

  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 2px 6px -1px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 6px 14px -2px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 14px 30px -5px rgba(0, 0, 0, 0.65);
  --shadow-accent: 0 8px 26px -3px rgba(99, 102, 241, 0.45);
}

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

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.hidden {
  display: none !important;
}

/* Top Accent Bar */
.top-accent-bar {
  height: 3px;
  width: 100%;
  background: linear-gradient(90deg, var(--accent-500) 0%, var(--violet-600) 50%, var(--accent-400) 100%);
}

/* Layout Container */
.container {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ==========================================================================
   Header & Dark/Light Mode Switcher
   ========================================================================== */
.site-header {
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-header);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 30;
}

.header-inner {
  height: 3.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--text-primary);
}

.brand-logo {
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-600), var(--violet-600));
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-xs);
}

.brand-name {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.025em;
}

.brand-tag {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.48rem;
  border-radius: 999px;
  background: var(--accent-50);
  color: var(--accent-400);
  border: 1px solid var(--accent-100);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-pill);
  border: 1px solid var(--border-subtle);
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.btn-theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.36rem 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-pill);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-theme-toggle:hover {
  background: var(--bg-pill-hover);
  border-color: var(--accent-400);
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.main-content {
  flex: 1;
  padding: 1.75rem 0 3.5rem;
}

.hero {
  text-align: center;
  max-width: 780px;
  margin: 0 auto 1.4rem;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.8rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--accent-400);
  margin-bottom: 0.75rem;
  box-shadow: var(--shadow-xs);
}

.hero-title {
  font-size: clamp(1.6rem, 3.2vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.18;
  color: var(--text-primary);
  margin-bottom: 0.6rem;
}

.text-gradient {
  background: linear-gradient(135deg, var(--accent-400) 0%, var(--violet-500) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 0.94rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.hero-subtitle code {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  background: var(--bg-muted);
  color: var(--accent-400);
  border: 1px solid var(--border-subtle);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

/* ==========================================================================
   Quick Examples Bar (1-Click Real Cases)
   ========================================================================== */
.examples-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  padding: 0.65rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

.examples-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.examples-pills {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.example-pill {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.38rem 0.75rem;
  border-radius: 999px;
  background: var(--bg-pill);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.15s ease;
}

.example-pill:hover {
  background: var(--bg-pill-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.example-pill.active {
  background: var(--accent-50);
  color: var(--accent-400);
  border-color: var(--accent-500);
  font-weight: 600;
}

/* ==========================================================================
   Workspace Grid & Cards
   ========================================================================== */
.workspace-grid {
  display: grid;
  grid-template-columns: 1fr 1.12fr;
  gap: 1.4rem;
  align-items: start;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.card-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.step-badge {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--bg-muted);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-badge-accent {
  background: var(--accent-50);
  border-color: var(--accent-500);
  color: var(--accent-400);
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text-primary);
}

.card-description {
  font-size: 0.79rem;
  color: var(--text-muted);
}

/* Quick Actions in Input Header */
.input-quick-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.36rem 0.65rem;
  font-family: var(--font-sans);
  font-size: 0.77rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-pill);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-ghost:hover {
  background: var(--bg-pill-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-ghost-danger:hover {
  background: var(--rose-bg);
  color: var(--rose-text);
  border-color: var(--rose-border);
}

/* ==========================================================================
   1. Input Textarea & Filters
   ========================================================================== */
.textarea-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.raw-textarea {
  width: 100%;
  min-height: 330px;
  padding: 1rem;
  font-family: var(--font-sans);
  font-size: 0.92rem;
  line-height: 1.62;
  color: var(--text-primary);
  background-color: var(--bg-surface);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  resize: vertical;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.raw-textarea::placeholder {
  color: var(--text-placeholder);
}

.raw-textarea:focus {
  outline: none;
  border-color: var(--accent-500);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.raw-textarea.has-error {
  border-color: var(--rose-text);
  background-color: var(--rose-bg);
  animation: shakeError 0.36s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes shakeError {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(3px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
  40%, 60% { transform: translate3d(4px, 0, 0); }
}

.input-error {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-md);
  background: var(--rose-bg);
  border: 1px solid var(--rose-border);
  color: var(--rose-text);
  font-size: 0.81rem;
}

/* Filters Grid */
.filters-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.45rem;
}

.checkbox-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 0.38rem 0.65rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}

.checkbox-pill:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.checkbox-pill input[type="checkbox"] {
  accent-color: var(--accent-500);
  width: 14px;
  height: 14px;
  cursor: pointer;
  flex-shrink: 0;
}

.input-stats {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.artifact-badge {
  background: var(--accent-50);
  color: var(--accent-400);
  border: 1px solid var(--accent-100);
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-weight: 600;
}

/* Primary Action Button */
.btn-primary {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: 0.9rem 1.25rem;
  font-family: var(--font-sans);
  font-size: 0.96rem;
  font-weight: 600;
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent-600) 0%, var(--violet-600) 100%);
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-accent);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.btn-primary:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

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

.kbd-hint {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.24);
}

/* ==========================================================================
   2. Output Section, Breakdown Badges & Shadcn <Tabs>
   ========================================================================== */
.clean-summary-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--emerald-text);
  background: var(--emerald-bg);
  border: 1px solid var(--emerald-border);
  padding: 0.26rem 0.65rem;
  border-radius: 999px;
}

.removal-breakdown {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  padding: 0.55rem 0.75rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.75rem;
}

.removal-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.16rem 0.5rem;
  border-radius: 999px;
  background: var(--bg-pill);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  font-weight: 500;
}

.removal-chip strong {
  color: var(--emerald-text);
}

.shadcn-tabs {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.tabs-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.3rem;
  background-color: var(--bg-surface);
  padding: 0.3rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

.tab-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 0.6rem;
  font-family: var(--font-sans);
  font-size: 0.79rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.16s ease;
  white-space: nowrap;
}

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

.tab-trigger.active {
  background-color: var(--bg-elevated);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}

.tab-content {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.tab-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  min-height: 1.85rem;
  flex-wrap: wrap;
}

.tab-toolbar-hint {
  font-size: 0.77rem;
  color: var(--text-muted);
}

.tab-toolbar-hint code {
  font-family: var(--font-mono);
  font-size: 0.73rem;
  background: var(--bg-muted);
  color: var(--accent-400);
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
}

/* HTML Subview Toggle */
.subview-toggle {
  display: inline-flex;
  background: var(--bg-surface);
  padding: 0.18rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.subview-btn {
  font-family: var(--font-sans);
  font-size: 0.73rem;
  font-weight: 500;
  padding: 0.22rem 0.55rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
}

.subview-btn.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-weight: 600;
}

.btn-outline-sm {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  color: var(--text-primary);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-outline-sm:hover {
  border-color: var(--accent-400);
}

/* Output Surface Container */
.output-surface {
  min-height: 360px;
  max-height: 500px;
  overflow-y: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  position: relative;
}

/* Empty State */
.empty-state {
  min-height: 356px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}

.empty-icon {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
  color: var(--accent-400);
}

.empty-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.empty-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  max-width: 320px;
}

/* Tab 1: Plain Text Output */
.plain-output {
  padding: 1.25rem;
  font-family: var(--font-sans);
  font-size: 0.93rem;
  line-height: 1.72;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-wrap: break-word;
  background: var(--bg-surface);
  min-height: 356px;
}

/* Tab 2: HTML Code & Preview Output */
.html-code-output {
  padding: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.65;
  color: var(--accent-400);
  background: var(--bg-surface);
  white-space: pre-wrap;
  word-wrap: break-word;
  min-height: 356px;
}

.html-preview-output {
  padding: 1.35rem 1.5rem;
  background: var(--bg-surface);
  min-height: 356px;
  font-family: var(--font-sans);
  color: var(--text-primary);
  line-height: 1.7;
}

.html-preview-output h2 {
  font-size: 1.22rem;
  font-weight: 700;
  margin: 1.2rem 0 0.55rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.3rem;
}

.html-preview-output h2:first-child,
.html-preview-output h3:first-child {
  margin-top: 0;
}

.html-preview-output h3 {
  font-size: 1.02rem;
  font-weight: 600;
  margin: 1rem 0 0.35rem;
  color: var(--accent-400);
}

.html-preview-output p {
  margin-bottom: 0.85rem;
  color: var(--text-secondary);
}

.html-preview-output ul,
.html-preview-output ol {
  margin: 0.5rem 0 0.95rem 1.35rem;
  color: var(--text-secondary);
}

.html-preview-output li {
  margin-bottom: 0.35rem;
}

.html-preview-output blockquote {
  border-left: 3px solid var(--accent-500);
  padding-left: 0.9rem;
  color: var(--text-muted);
  font-style: italic;
  margin: 0.85rem 0;
}

.html-preview-output table,
.formal-doc-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.25rem;
  font-size: 0.88rem;
}

.html-preview-output th,
.html-preview-output td {
  border: 1px solid var(--border-strong);
  padding: 0.5rem 0.75rem;
  text-align: left;
}

.html-preview-output th {
  background: var(--bg-muted);
  color: var(--text-primary);
  font-weight: 600;
}

.formal-doc-body th,
.formal-doc-body td {
  border: 1px solid #cbd5e1;
  padding: 0.48rem 0.75rem;
  text-align: left;
  color: #1f2937;
}

.formal-doc-body th {
  background: #f1f5f9;
  color: #0f172a;
  font-weight: 700;
}

/* Tab 3: Formal Document Controls (Template Selector + Word .docx + PDF) */
.doc-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  flex-wrap: wrap;
  padding: 0.5rem 0.65rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.template-selector-group {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  flex: 1;
}

.template-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.template-select {
  font-family: var(--font-sans);
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-primary);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.32rem 0.55rem;
  cursor: pointer;
}

.template-select:focus,
.doc-meta-input:focus {
  outline: none;
  border-color: var(--accent-500);
}

.doc-meta-input {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.32rem 0.6rem;
  min-width: 190px;
}

.doc-export-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.btn-word-sm {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.34rem 0.72rem;
  color: #ffffff;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  border: 1px solid #1d4ed8;
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.28);
  transition: all 0.15s ease;
}

.btn-word-sm:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

/* Tab 3: Formal Document (PDF / Word Preview) — Editorial Sheet */
.pdf-desk-backdrop {
  background: var(--bg-pdf-backdrop);
  padding: 1.25rem;
}

.formal-document-sheet {
  background: #ffffff;
  max-width: 680px;
  margin: 0 auto;
  padding: 2.4rem 2.65rem;
  border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  border: 1px solid #cbd5e1;
  font-family: var(--font-serif);
  color: #111827;
  line-height: 1.8;
  font-size: 0.94rem;
  transition: all 0.2s ease;
}

/* Template 1: Ejecutivo (Merriweather Serif) */
.formal-document-sheet.template-executive {
  font-family: var(--font-serif);
  line-height: 1.8;
  font-size: 0.94rem;
}

/* Template 2: Académico APA 7ª Edición (Times New Roman 12pt, Doble Espacio, Sangría) */
.formal-document-sheet.template-apa {
  font-family: 'Times New Roman', Times, Georgia, serif;
  font-size: 1rem;
  line-height: 2.0;
  color: #000000;
}

.formal-document-sheet.template-apa .formal-doc-body h2,
.formal-document-sheet.template-apa .formal-doc-body h3 {
  font-family: 'Times New Roman', Times, Georgia, serif;
  border-bottom: none;
  color: #000000;
  margin: 1.2rem 0 0.4rem;
}

.formal-document-sheet.template-apa .formal-doc-body h2 {
  text-align: center;
  font-size: 1.08rem;
  font-weight: 700;
}

.formal-document-sheet.template-apa .formal-doc-body h3 {
  text-align: left;
  font-size: 1.02rem;
  font-weight: 700;
}

.formal-document-sheet.template-apa .formal-doc-body p {
  text-indent: 2rem;
  text-align: left;
  margin-bottom: 0.5rem;
  color: #000000;
}

/* Template 3: Moderno / Tech (Inter Sans) */
.formal-document-sheet.template-modern {
  font-family: var(--font-sans);
  font-size: 0.93rem;
  line-height: 1.7;
  color: #0f172a;
}

.formal-document-sheet.template-modern .formal-doc-body h2 {
  font-family: var(--font-sans);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #1e1b4b;
  border-left: 4px solid #4f46e5;
  border-bottom: none;
  padding-left: 0.65rem;
}

.formal-document-sheet.template-modern .formal-doc-body h3 {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  color: #312e81;
}

.formal-document-sheet.template-modern .formal-doc-body p {
  text-align: left;
}

.formal-doc-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 0.65rem;
  margin-bottom: 1.4rem;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
}

.formal-doc-body h1,
.formal-doc-body h2 {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
  margin: 1.4rem 0 0.65rem;
  line-height: 1.35;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 0.25rem;
}

.formal-doc-body h1:first-child,
.formal-doc-body h2:first-child,
.formal-doc-body h3:first-child {
  margin-top: 0;
}

.formal-doc-body h3 {
  font-family: var(--font-serif);
  font-size: 1.02rem;
  font-weight: 700;
  color: #1e293b;
  margin: 1.15rem 0 0.35rem;
}

.formal-doc-body p {
  margin-bottom: 0.95rem;
  text-align: justify;
  color: #1f2937;
}

.formal-doc-body ul,
.formal-doc-body ol {
  margin: 0.55rem 0 1.05rem 1.5rem;
  color: #1f2937;
}

.formal-doc-body li {
  margin-bottom: 0.4rem;
}

.formal-doc-body blockquote {
  border-left: 2px solid #94a3b8;
  padding-left: 1rem;
  margin: 1rem 0;
  font-style: italic;
  color: #334155;
}

/* ==========================================================================
   3. Copy to Clipboard Button (Premium Sleek Redesign) & Shadcn Toast
   ========================================================================== */
.btn-copy-large {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  padding: 0.85rem 1.25rem;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  color: #ffffff;
  background: linear-gradient(135deg, #059669 0%, #047857 50%, #0f766e 100%);
  border: 1px solid rgba(52, 211, 153, 0.38);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 20px -4px rgba(5, 150, 105, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn-copy-icon-wrap {
  width: 1.85rem;
  height: 1.85rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.18);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-copy-text-main {
  letter-spacing: -0.01em;
}

.copy-format-pill {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.22);
  color: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.16);
  margin-left: 0.15rem;
}

.btn-copy-large:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 12px 24px -4px rgba(5, 150, 105, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.btn-copy-large:active:not(:disabled) {
  transform: translateY(0);
}

.btn-copy-large:disabled {
  background: var(--bg-surface);
  border: 1px dashed var(--border-strong);
  color: var(--text-placeholder);
  cursor: not-allowed;
  box-shadow: none;
}

.btn-copy-large:disabled .btn-copy-icon-wrap {
  background: var(--bg-muted);
  border-color: var(--border-subtle);
  color: var(--text-placeholder);
}

.btn-copy-large:disabled .copy-format-pill {
  background: var(--bg-muted);
  border-color: var(--border-subtle);
  color: var(--text-placeholder);
}

.btn-copy-large.copied-state {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  border-color: #34d399 !important;
  color: #ffffff !important;
}

/* Shadcn UI Toast Notification */
.shadcn-toast-viewport {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-width: 390px;
  width: calc(100% - 2rem);
  pointer-events: none;
}

.shadcn-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.95rem 1.1rem;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: toastSlideIn 0.24s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.shadcn-toast.toast-leaving {
  animation: toastFadeOut 0.2s ease forwards;
}

.shadcn-toast-icon {
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: var(--emerald-bg);
  color: var(--emerald-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 0.05rem;
}

.shadcn-toast-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
}

.shadcn-toast-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastFadeOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(8px) scale(0.97); }
}

/* ==========================================================================
   Google AdSense Slots, SEO Content Section & Legal Modal
   ========================================================================== */
.adsense-slot-wrapper {
  margin: 2.25rem auto 0;
  max-width: 970px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.adsense-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-placeholder);
}

.adsense-unit {
  width: 100%;
  min-height: 96px;
  background: var(--bg-card);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  position: relative;
  overflow: hidden;
}

.adsense-placeholder-hint {
  font-size: 0.76rem;
  color: var(--text-placeholder);
  text-align: center;
}

.seo-content-section {
  margin-top: 2.5rem;
  padding-top: 2.25rem;
  border-top: 1px solid var(--border-subtle);
}

.faq-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.15rem;
  margin-top: 1.25rem;
}

.faq-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.25rem;
}

.faq-item h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

.faq-item p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.seo-header {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 1.75rem;
}

.seo-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.seo-lead {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.15rem;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-xs);
}

.feature-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.45rem;
}

.feature-card p {
  font-size: 0.83rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.footer-link-btn {
  background: none;
  border: none;
  font-family: var(--font-sans);
  font-size: 0.79rem;
  color: var(--accent-400);
  text-decoration: underline;
  cursor: pointer;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(4px);
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  max-width: 560px;
  width: 100%;
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-header h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-body p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 0.85rem;
}

.modal-body a {
  color: var(--accent-400);
}

/* ==========================================================================
   Footer & Responsive
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-card);
  padding: 1.2rem 0;
  font-size: 0.79rem;
  color: var(--text-muted);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

@media (max-width: 980px) {
  .workspace-grid,
  .features-grid,
  .faq-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .hide-mobile {
    display: none;
  }

  .filters-grid,
  .tabs-list {
    grid-template-columns: 1fr;
  }

  .tab-trigger {
    justify-content: flex-start;
    padding: 0.6rem 0.85rem;
  }

  .formal-document-sheet {
    padding: 1.5rem 1.25rem;
  }
}

@media print {
  body { background: #ffffff !important; }
  .no-print, .top-accent-bar { display: none !important; }
  .main-content, .container, .workspace-grid, .output-card, .shadcn-tabs, #tab-panel-pdf, .output-surface {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
    max-height: none !important;
    overflow: visible !important;
    background: transparent !important;
  }
  #tab-panel-plain, #tab-panel-html { display: none !important; }
  .formal-document-sheet {
    display: block !important;
    box-shadow: none !important;
    border: none !important;
    max-width: 100% !important;
    padding: 1cm 1.5cm !important;
  }
}
