/* Flash Sale Banner */
.flash-sale-banner {
  background: linear-gradient(90deg, #f59e0b 0%, #d97706 50%, #b45309 100%);
  color: #ffffff;
  padding: 0.5rem 1.25rem;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
  position: relative;
  z-index: 101;
}

.btn-banner-action {
  background: #ffffff;
  color: #b45309;
  border: none;
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  font-weight: 800;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-banner-action:hover {
  background: #fef3c7;
  transform: scale(1.05);
}

:root {
  --bg-main: #05070d;
  --bg-pane: rgba(13, 17, 28, 0.7);
  --bg-card: rgba(21, 29, 46, 0.75);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(99, 102, 241, 0.3);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-inverse: #0f172a;

  --accent-primary: #6366f1;
  --accent-secondary: #4f46e5;
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-purple: #c084fc;
  --accent-gold: #f59e0b;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
  --shadow-glow: 0 0 35px rgba(99, 102, 241, 0.25);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
}

/* Ambient Background Glow Blobs */
.ambient-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(140px);
  pointer-events: none;
  z-index: 0;
}

.glow-1 {
  width: 500px;
  height: 500px;
  background: rgba(99, 102, 241, 0.15);
  top: -150px;
  left: -100px;
}

.glow-2 {
  width: 600px;
  height: 600px;
  background: rgba(6, 182, 212, 0.12);
  bottom: -200px;
  right: -150px;
}

/* ==========================================================================
   Navbar Architecture
   ========================================================================== */

.navbar {
  height: 72px;
  background: rgba(8, 12, 22, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.75rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.logo-box {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(6, 182, 212, 0.25));
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 50%, #818cf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.badge-pro-animated {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  -webkit-text-fill-color: #ffffff;
  font-size: 0.65rem;
  padding: 0.18rem 0.5rem;
  border-radius: 6px;
  font-weight: 800;
  letter-spacing: 0.05em;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
}

.brand-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  background-color: var(--accent-emerald);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-emerald);
  display: inline-block;
}

/* Nav Controls & Control Pills */
.nav-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.control-pill {
  background: rgba(21, 29, 46, 0.7);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0.35rem 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}

.control-pill:hover {
  border-color: var(--border-glow);
  background: rgba(255, 255, 255, 0.05);
}

.pill-icon {
  font-size: 0.85rem;
}

.select-clean {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 0.8rem;
  font-family: var(--font-sans);
  font-weight: 500;
  outline: none;
  cursor: pointer;
}

.select-clean option {
  background: #0f172a;
  color: #ffffff;
}

/* Buttons System */
.btn {
  padding: 0.55rem 1.15rem;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
}

.btn-gradient-primary {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #ffffff;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
}

.btn-gradient-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.6);
}

.btn-gradient-accent {
  background: linear-gradient(135deg, #06b6d4 0%, #2563eb 100%);
  color: #ffffff;
  box-shadow: 0 4px 20px rgba(6, 182, 212, 0.4);
}

.btn-gradient-accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(6, 182, 212, 0.6);
}

.btn-glass-icon {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 0.45rem 0.75rem;
}

.btn-glass-icon:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-action {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-action:hover {
  background: rgba(255, 255, 255, 0.12);
}

.text-danger { color: #f87171 !important; }

/* ==========================================================================
   Split Workspace Layout
   ========================================================================== */

.app-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex: 1;
  height: calc(100vh - 72px);
  overflow: hidden;
  position: relative;
  z-index: 1;
}

@media (max-width: 1024px) {
  .app-container {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }
}

.pane-header {
  height: 50px;
  background: rgba(13, 17, 28, 0.9);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
}

.pane-title {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: #cbd5e1;
}

.title-badge {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
  font-size: 0.65rem;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-weight: 700;
}

.badge-emerald {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}

/* ==========================================================================
   Left Column: Editor Pane & AI Chips
   ========================================================================== */

.editor-pane {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-color);
  background: var(--bg-pane);
}

.ai-editor-toolbar {
  background: linear-gradient(90deg, rgba(6, 182, 212, 0.12), rgba(147, 51, 234, 0.12));
  border-bottom: 1px solid rgba(6, 182, 212, 0.2);
  padding: 0.5rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.ai-label-pill {
  font-size: 0.7rem;
  font-weight: 800;
  color: #cffafe;
  letter-spacing: 0.05em;
  margin-right: 0.2rem;
}

.btn-chip {
  background: rgba(147, 51, 234, 0.2);
  border: 1px solid rgba(192, 132, 252, 0.35);
  color: #f3e8ff;
  font-size: 0.75rem;
  padding: 0.3rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-chip:hover {
  background: rgba(147, 51, 234, 0.45);
  border-color: #c084fc;
  transform: translateY(-1px);
}

.btn-chip-cyan {
  background: rgba(6, 182, 212, 0.2);
  border-color: rgba(56, 189, 248, 0.4);
  color: #e0f2fe;
}

.btn-chip-cyan:hover {
  background: rgba(6, 182, 212, 0.45);
  border-color: #38bdf8;
}

.btn-chip-emerald {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(52, 211, 153, 0.4);
  color: #d1fae5;
}

.btn-chip-emerald:hover {
  background: rgba(16, 185, 129, 0.45);
  border-color: #34d399;
}

.metadata-bar {
  display: grid;
  grid-template-columns: 1fr 1fr 140px;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  background: rgba(15, 23, 42, 0.4);
  border-bottom: 1px solid var(--border-color);
}

.meta-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.meta-field label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.input-glass {
  background: rgba(8, 12, 22, 0.8);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.4rem 0.65rem;
  border-radius: 8px;
  font-size: 0.8rem;
  outline: none;
  transition: all 0.2s ease;
}

.input-glass:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}

.watermark-label {
  font-size: 0.75rem;
  color: var(--accent-gold);
  font-weight: 600;
}

.editor-wrapper {
  flex: 1;
  position: relative;
  display: flex;
}

#markdown-input {
  width: 100%;
  height: 100%;
  background: rgba(5, 7, 13, 0.95);
  color: #e2e8f0;
  border: none;
  padding: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.6;
  resize: none;
  outline: none;
}

.pane-footer {
  height: 38px;
  background: rgba(13, 17, 28, 0.95);
  border-top: 1px solid var(--border-color);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.status-indicator {
  color: var(--accent-emerald);
}

/* ==========================================================================
   Right Column: Live A4 Studio Stage & Document Render
   ========================================================================== */

.preview-pane {
  display: flex;
  flex-direction: column;
  background: #030509;
  background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 0);
  background-size: 24px 24px;
}

.preview-viewport {
  flex: 1;
  overflow-y: auto;
  padding: 2.25rem;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

/* 3D Realistic A4 Sheet */
.a4-page {
  width: 210mm;
  min-height: 297mm;
  padding: 20mm;
  background: #ffffff;
  color: #1e293b;
  box-shadow: 0 20px 60px -10px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  position: relative;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  transition: all 0.3s ease;
}

/* Typography Classes */
.font-outfit { font-family: 'Outfit', sans-serif !important; }
.font-inter { font-family: 'Inter', sans-serif !important; }
.font-roboto { font-family: 'Roboto', sans-serif !important; }
.font-mono { font-family: 'JetBrains Mono', monospace !important; }

.watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-35deg);
  font-size: 1.5rem;
  font-weight: 800;
  color: rgba(239, 68, 68, 0.12);
  pointer-events: none;
  text-align: center;
  width: 120%;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  z-index: 10;
}

.watermark.hidden { display: none !important; }

.doc-header { margin-bottom: 1.5rem; }

.doc-brand {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.doc-logo-placeholder {
  background: linear-gradient(135deg, #1e1b4b, #312e81);
  color: #ffffff;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
}

.doc-meta-right {
  text-align: right;
  font-size: 0.8rem;
  color: #64748b;
}

.doc-meta-right h4 {
  color: #0f172a;
  font-size: 0.95rem;
  font-weight: 700;
}

.doc-divider {
  height: 3px;
  background: linear-gradient(to right, #6366f1, #3b82f6, #10b981);
  margin-top: 1rem;
  border-radius: 2px;
}

.doc-content {
  flex: 1;
  font-size: 9.5pt;
  line-height: 1.6;
  color: #334155;
}

.doc-content h1 {
  font-size: 20pt;
  font-weight: 800;
  color: #0f172a;
  margin: 1rem 0 0.75rem;
  line-height: 1.2;
}

.doc-content h2 {
  font-size: 14pt;
  font-weight: 700;
  color: #1e293b;
  margin: 1.25rem 0 0.5rem;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 0.3rem;
}

.doc-content blockquote {
  background: #f8fafc;
  border-left: 4px solid #6366f1;
  padding: 0.6rem 1rem;
  margin: 0.75rem 0;
  font-style: italic;
  color: #475569;
  border-radius: 0 6px 6px 0;
}

.doc-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 9pt;
}

.doc-content th {
  background: #0f172a;
  color: #ffffff;
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-weight: 600;
}

.doc-content td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #e2e8f0;
}

.doc-content tr:nth-child(even) td { background: #f8fafc; }

/* Diagram & Chart Boxes */
.mermaid-container-box, .chart-container-box {
  margin: 1.25rem 0;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.05);
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  text-align: center;
}

.diagram-box-title, .chart-box-title {
  font-size: 10pt;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.75rem;
}

#doc-chart-canvas {
  max-width: 100%;
  max-height: 200px;
}

.doc-footer {
  margin-top: 2rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  font-size: 8pt;
  color: #94a3b8;
}

/* Dark Executive Themes */
.a4-page.theme-executive {
  background: #0f172a;
  color: #cbd5e1;
}

.a4-page.theme-executive .mermaid-container-box, .a4-page.theme-executive .chart-container-box {
  background: rgba(30, 41, 59, 0.5);
  border-color: rgba(255, 255, 255, 0.1);
}

.a4-page.theme-executive .diagram-box-title, .a4-page.theme-executive .chart-box-title {
  color: #f59e0b;
}

.a4-page.theme-executive .doc-logo-placeholder {
  background: linear-gradient(135deg, #d97706, #b45309);
}

.a4-page.theme-executive .doc-meta-right h4 { color: #f8fafc; }

.a4-page.theme-executive .doc-divider {
  background: linear-gradient(to right, #f59e0b, #d97706, #b45309);
}

.a4-page.theme-executive .doc-content { color: #cbd5e1; }
.a4-page.theme-executive .doc-content h1 { color: #ffffff; }

.a4-page.theme-executive .doc-content h2 {
  color: #f59e0b;
  border-bottom-color: rgba(245, 158, 11, 0.2);
}

.a4-page.theme-executive .doc-content blockquote {
  background: rgba(30, 41, 59, 0.7);
  border-left-color: #f59e0b;
  color: #e2e8f0;
}

.a4-page.theme-executive .doc-content th { background: #d97706; }
.a4-page.theme-executive .doc-content tr:nth-child(even) td { background: rgba(30, 41, 59, 0.4); }

/* ==========================================================================
   Pricing & Pro License Modal Architecture
   ========================================================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-card-wide {
  background: #0d111c;
  border: 1px solid rgba(192, 132, 252, 0.3);
  border-radius: 24px;
  width: 95%;
  max-width: 940px;
  padding: 2.5rem;
  position: relative;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.95);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-close {
  position: absolute;
  top: 1.25rem;
  right: 1.5rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  cursor: pointer;
}

.modal-header {
  text-align: center;
  margin-bottom: 2rem;
}

.pro-badge-large {
  display: inline-block;
  background: linear-gradient(135deg, #06b6d4, #3b82f6);
  color: #ffffff;
  padding: 0.35rem 0.95rem;
  border-radius: 9999px;
  font-weight: 800;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.4);
}

.modal-header h2 {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  color: #ffffff;
  margin-bottom: 0.5rem;
}

.modal-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Pricing Grid - 3 Tiers */
.pricing-tiers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.tier-card {
  background: rgba(21, 29, 46, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: all 0.3s ease;
}

.tier-card:hover {
  transform: translateY(-5px);
  border-color: rgba(192, 132, 252, 0.5);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
}

.tier-card-featured {
  background: linear-gradient(145deg, rgba(6, 182, 212, 0.25), rgba(21, 29, 46, 0.95));
  border: 2px solid #38bdf8;
  box-shadow: 0 12px 35px rgba(56, 189, 248, 0.3);
}

.tier-badge {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  width: fit-content;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.badge-featured {
  background: linear-gradient(135deg, #06b6d4, #3b82f6);
  color: #ffffff;
}

.badge-gold {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
}

.tier-title {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  color: #ffffff;
  margin-bottom: 0.5rem;
}

.tier-price {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 1rem;
}

.tier-period {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
}

.tier-features {
  list-style: none;
  font-size: 0.825rem;
  color: #cbd5e1;
  margin-bottom: 1.5rem;
  flex: 1;
}

.tier-features li {
  margin-bottom: 0.65rem;
  line-height: 1.4;
}

.btn-tier {
  width: 100%;
  justify-content: center;
  padding: 0.7rem;
  font-size: 0.875rem;
  border-radius: 10px;
}

.btn-tier-pro {
  background: linear-gradient(135deg, #0070ba, #003087);
  color: #ffffff;
}

.btn-tier-ai {
  background: linear-gradient(135deg, #06b6d4, #2563eb);
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.4);
}

.btn-tier-enterprise {
  background: linear-gradient(135deg, #f59e0b, #b45309);
  color: #ffffff;
}

.license-key-box {
  border-top: 1px solid var(--border-color);
  padding-top: 1.25rem;
}

.license-key-box label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  display: block;
}

.input-group {
  display: flex;
  gap: 0.5rem;
}

.input-group input {
  flex: 1;
}

.license-msg {
  font-size: 0.75rem;
  margin-top: 0.45rem;
}

/* Print Rules */
@media print {
  body { background: white; padding: 0; }
  .navbar, .editor-pane, .pane-header, .preview-actions, .modal-overlay { display: none !important; }
  .app-container { display: block; height: auto; }
  .preview-pane { background: white; }
  .preview-viewport { padding: 0; }
  .a4-page { box-shadow: none; width: 100%; min-height: 100vh; }
}
