/**
 * intro-editor.css
 * Styles for split-pane HTML editor (HTML left, preview right)
 * Last modified: v015.038 (2025-11-12)
 */

/* ============================================
   Intro Editor Modal
   ============================================ */

.intro-editor-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
}

.intro-editor-modal.active {
  display: flex;
}

.intro-editor-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}

.intro-editor-container {
  position: relative;
  width: 95%;
  max-width: 1600px;
  height: 90vh;
  background: var(--theme-bg-primary, #1a1a1a);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

/* ============================================
   Header
   ============================================ */

.intro-editor-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--theme-border-primary, #333);
  background: var(--theme-bg-secondary, #1a1a1a);
}

.intro-editor-save-btn {
  padding: 0.5rem 1rem;
  background: #10b981;
  color: white;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  margin-left: auto;
}

.intro-editor-save-btn:hover {
  background: #059669;
}

.intro-editor-header h2 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--theme-text-primary, #fff);
}

.intro-editor-category-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--theme-bg-tertiary, #2a2a2a);
  border-radius: 6px;
}

.intro-editor-category-icon {
  font-size: 1.25rem;
}

.intro-editor-category-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--theme-text-primary, #fff);
}

.intro-editor-close {
  margin-left: auto;
  background: transparent;
  border: none;
  font-size: 2rem;
  line-height: 1;
  color: var(--theme-text-secondary, #999);
  cursor: pointer;
  padding: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.intro-editor-close:hover {
  color: var(--theme-text-primary, #fff);
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
}

/* ============================================
   Split-Pane Layout
   ============================================ */

.intro-editor-split-view {
  display: flex;
  gap: 1px;
  height: 100%;
  background: var(--theme-border-primary, #333);
}

.intro-editor-pane-left,
.intro-editor-pane-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--theme-bg-primary, #1a1a1a);
  overflow: hidden;
}

.intro-editor-pane-header {
  padding: 0.75rem 1rem;
  background: var(--theme-bg-secondary, #252525);
  border-bottom: 1px solid var(--theme-border-primary, #333);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--theme-text-primary, #fff);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Category view with stacked sections */
.intro-editor-category-view {
  display: flex;
  flex-direction: column;
  gap: 1px;
  height: 100%;
  background: var(--theme-border-primary, #333);
  overflow-y: auto;
}

.intro-editor-section {
  background: var(--theme-bg-primary, #1a1a1a);
  display: flex;
  flex-direction: column;
}

.intro-editor-section-title {
  padding: 0.75rem 1.5rem;
  background: var(--theme-bg-tertiary, #2a2a2a);
  font-size: 1rem;
  font-weight: 600;
  color: var(--theme-accent-primary, #a855f7);
  border-bottom: 1px solid var(--theme-border-primary, #333);
}

.intro-editor-section .intro-editor-split-view {
  min-height: 400px;
  max-height: 50vh;
}

/* ============================================
   Content Area
   ============================================ */

.intro-editor-content {
  flex: 1;
  overflow: hidden;
  position: relative;
  background: var(--theme-bg-primary, #1a1a1a);
  display: flex;
  flex-direction: column;
}

.intro-editor-toolbar-help {
  padding: 0.75rem 2rem;
  background: var(--theme-bg-tertiary, #252525);
  border-bottom: 1px solid var(--theme-border-primary, #333);
  color: var(--theme-text-secondary, #999);
  font-size: 0.875rem;
}

.intro-editor-quill {
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* Custom page break button in toolbar */
.ql-toolbar button.ql-pagebreak {
  width: auto !important;
  padding: 0 8px !important;
}

.ql-toolbar button.ql-pagebreak::after {
  content: '📄 Page Break';
  font-size: 12px;
}
/* ============================================
   Quill Editor Customization
   ============================================ */

.intro-editor-quill .ql-toolbar {
  background: var(--theme-bg-tertiary, #2a2a2a);
  border: none;
  border-bottom: 1px solid var(--theme-border-primary, #333);
  border-radius: 8px 8px 0 0;
}

.intro-editor-quill .ql-container {
  flex: 1;
  overflow: auto;
  border: none;
  font-size: 1rem;
  font-family: var(--theme-font-content, 'Lora', serif);
}

.intro-editor-quill .ql-editor {
  min-height: 200px;
  padding: 1.5rem;
  color: var(--theme-text-primary, #fff);
}

.intro-editor-quill .ql-editor.ql-blank::before {
  color: var(--theme-text-tertiary, #666);
  font-style: italic;
}

/* Quill toolbar buttons */
.intro-editor-quill .ql-stroke {
  stroke: var(--theme-text-secondary, #999);
}

.intro-editor-quill .ql-fill {
  fill: var(--theme-text-secondary, #999);
}

.intro-editor-quill .ql-picker-label {
  color: var(--theme-text-secondary, #999);
}

.intro-editor-quill .ql-toolbar button:hover .ql-stroke,
.intro-editor-quill .ql-toolbar button:hover .ql-fill,
.intro-editor-quill .ql-toolbar button.ql-active .ql-stroke,
.intro-editor-quill .ql-toolbar button.ql-active .ql-fill {
  stroke: var(--theme-accent-primary, #8b5cf6);
  fill: var(--theme-accent-primary, #8b5cf6);
}

.intro-editor-quill .ql-toolbar button:hover,
.intro-editor-quill .ql-toolbar button.ql-active {
  background: rgba(139, 92, 246, 0.1);
}

/* ============================================
   Preview Pane
   ============================================ */

.intro-editor-preview {
  flex: 1;
  overflow: auto;
  padding: 1.5rem;
  background: var(--theme-bg-primary, #1a1a1a);
  color: var(--theme-text-primary, #fff);
  font-family: var(--theme-font-content, 'Lora', serif);
  line-height: 1.8;
}

.intro-editor-preview h1,
.intro-editor-preview h2,
.intro-editor-preview h3 {
  color: var(--theme-text-primary, #fff);
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

.intro-editor-preview p {
  margin-bottom: 1rem;
}

.intro-editor-preview ul,
.intro-editor-preview ol {
  margin-bottom: 1rem;
  padding-left: 2rem;
}

.intro-editor-preview a {
  color: var(--theme-accent-primary, #8b5cf6);
  text-decoration: underline;
}

.intro-editor-preview blockquote {
  border-left: 4px solid var(--theme-accent-primary, #8b5cf6);
  padding-left: 1rem;
  margin: 1rem 0;
  color: var(--theme-text-secondary, #999);
  font-style: italic;
}

.intro-editor-preview code {
  background: var(--theme-bg-tertiary, #2a2a2a);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.9em;
}

.intro-editor-preview pre {
  background: var(--theme-bg-tertiary, #2a2a2a);
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 1rem 0;
}

/* ============================================
   Footer
   ============================================ */

.intro-editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 2rem;
  background: var(--theme-bg-secondary, #252525);
  border-top: 1px solid var(--theme-border-primary, #333);
}

.intro-editor-save-status {
  font-size: 0.875rem;
  color: var(--theme-text-secondary, #999);
}

.intro-editor-footer .editor-btn {
  margin-left: auto;
}

/* ============================================
   Responsive
   ============================================ */


/* ============================================
   HTML Editor Styles
   ============================================ */

.intro-html-editor {
  width: 100%;
  flex: 1;
  padding: 1rem;
  background: var(--theme-bg-primary, #1a1a1a);
  color: var(--theme-text-primary, #e0e0e0);
  border: none;
  font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.6;
  resize: none;
  tab-size: 2;
}

.intro-html-editor:focus {
  outline: none;
  border-color: var(--theme-accent-primary, #a855f7);
  box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.2);
}

/* ============================================
   Toolbar Styles
   ============================================ */

.intro-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 0.75rem;
  background: var(--theme-bg-secondary, #252525);
  border-bottom: 1px solid var(--theme-border, #333);
  flex-wrap: wrap;
}

.toolbar-btn {
  padding: 0.4rem 0.6rem;
  background: transparent;
  color: var(--theme-text-secondary, #999);
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.15s;
  min-width: 32px;
  text-align: center;
}

.toolbar-btn:hover {
  background: var(--theme-bg-tertiary, #2a2a2a);
  color: var(--theme-text-primary, #fff);
  border-color: var(--theme-border, #444);
}

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

.toolbar-separator {
  width: 1px;
  height: 24px;
  background: var(--theme-border, #333);
  margin: 0 0.25rem;
}

/* ============================================
   Preview Styles
   ============================================ */

.intro-editor-preview-controls {
  display: flex;
  gap: 0.5rem;
  padding: 1rem;
  background: var(--theme-bg-tertiary, #2a2a2a);
  border-bottom: 1px solid var(--theme-border, #333);
}

.preview-btn {
  padding: 0.5rem 1rem;
  background: var(--theme-bg-secondary, #242424);
  color: var(--theme-text-secondary, #999);
  border: 1px solid var(--theme-border, #333);
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.preview-btn:hover {
  border-color: var(--theme-accent-primary, #a855f7);
}

.preview-btn.active {
  background: var(--theme-accent-primary, #a855f7);
  color: white;
  border-color: var(--theme-accent-primary, #a855f7);
}

.intro-editor-preview-content {
  position: relative;
  flex: 1;
  overflow: auto;
}

.intro-preview-pane {
  display: none;
  padding: 2rem;
  height: 100%;
  overflow: auto;
}

.intro-preview-pane.active {
  display: block;
}

.intro-preview-pane h2 {
  margin-top: 0;
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 1024px) {
  .intro-editor-split-view {
    flex-direction: column;
  }
  
  .intro-editor-pane-left,
  .intro-editor-pane-right {
    min-height: 300px;
  }
  
  .intro-editor-section .intro-editor-split-view {
    max-height: none;
  }
}

@media (max-width: 768px) {
  .intro-editor-container {
    width: 100%;
    height: 100vh;
    border-radius: 0;
  }
  
  .intro-editor-header {
    padding: 1rem;
  }
  
  .intro-editor-toolbar {
    padding: 0.5rem;
    overflow-x: auto;
  }
  
  .toolbar-btn {
    font-size: 11px;
    padding: 0.3rem 0.5rem;
  }
}
