/**
 * ND Lesson Editor v3.0 - Frontend Editor Styles
 * Mobile-first, AI-focused design
 */

/* =========================================================================
   CSS Variables
   ========================================================================= */
:root {
    --nd-primary: #f97316;
    --nd-primary-dark: #ea580c;
    --nd-primary-light: #fed7aa;
    --nd-secondary: #3b82f6;
    --nd-success: #22c55e;
    --nd-warning: #eab308;
    --nd-error: #ef4444;
    
    --nd-bg: #ffffff;
    --nd-bg-subtle: #f8fafc;
    --nd-bg-muted: #f1f5f9;
    --nd-border: #e2e8f0;
    --nd-border-strong: #cbd5e1;
    
    --nd-text: #1e293b;
    --nd-text-muted: #64748b;
    --nd-text-subtle: #94a3b8;
    
    --nd-radius: 8px;
    --nd-radius-lg: 12px;
    --nd-radius-xl: 16px;
    
    --nd-shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --nd-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    --nd-shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --nd-shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1);
    
    --nd-header-height: 56px;
    --nd-toolbar-height: 56px;
}

/* =========================================================================
   Base Reset
   ========================================================================= */
*, *::before, *::after {
    box-sizing: border-box;
}

.nd-fe-body {
    margin: 0;
    padding: 0;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--nd-text);
    background: var(--nd-bg-subtle);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

/* =========================================================================
   Header
   ========================================================================= */
.nd-fe-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nd-header-height);
    background: var(--nd-bg);
    border-bottom: 1px solid var(--nd-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 100;
    gap: 16px;
}

.nd-fe-header-left,
.nd-fe-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.nd-fe-header-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.nd-fe-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--nd-text);
    text-decoration: none;
    font-weight: 600;
}

.nd-fe-logo svg {
    color: var(--nd-primary);
}

.nd-fe-title-input {
    width: 100%;
    max-width: 400px;
    padding: 8px 12px;
    border: 1px solid transparent;
    border-radius: var(--nd-radius);
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    background: transparent;
    transition: all 0.2s;
}

.nd-fe-title-input:hover {
    background: var(--nd-bg-muted);
}

.nd-fe-title-input:focus {
    outline: none;
    border-color: var(--nd-primary);
    background: var(--nd-bg);
}

.nd-fe-step-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nd-fe-step-badge {
    background: var(--nd-primary);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.nd-fe-step-label {
    color: var(--nd-text-muted);
    font-size: 14px;
}

.nd-fe-save-status {
    font-size: 13px;
    color: var(--nd-text-muted);
}

.nd-fe-select-mini {
    padding: 6px 10px;
    border: 1px solid var(--nd-border);
    border-radius: var(--nd-radius);
    font-size: 13px;
    background: var(--nd-bg);
    cursor: pointer;
}

.nd-fe-usage-badge {
    padding: 4px 10px;
    background: var(--nd-bg-muted);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--nd-text-muted);
}

.nd-fe-user-menu {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
}

.nd-fe-user-menu img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* =========================================================================
   Buttons
   ========================================================================= */
.nd-fe-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--nd-radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
}

.nd-fe-btn-primary {
    background: var(--nd-primary);
    color: white;
}

.nd-fe-btn-primary:hover {
    background: var(--nd-primary-dark);
}

.nd-fe-btn-ghost {
    background: transparent;
    color: var(--nd-text-muted);
    border: 1px solid var(--nd-border);
}

.nd-fe-btn-ghost:hover {
    background: var(--nd-bg-muted);
    color: var(--nd-text);
}

.nd-fe-btn-large {
    padding: 14px 28px;
    font-size: 16px;
    border-radius: var(--nd-radius-lg);
}

.nd-fe-btn-block {
    width: 100%;
}

.nd-fe-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.nd-fe-btn-loading {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nd-fe-spinner {
    width: 18px;
    height: 18px;
    animation: nd-spin 1s linear infinite;
}

.nd-fe-spinner-large {
    width: 48px;
    height: 48px;
    animation: nd-spin 1s linear infinite;
    color: var(--nd-primary);
}

@keyframes nd-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.nd-fe-link-subtle {
    color: var(--nd-text-muted);
    font-size: 14px;
    text-decoration: none;
}

.nd-fe-link-subtle:hover {
    color: var(--nd-primary);
    text-decoration: underline;
}

/* =========================================================================
   Main Content Areas
   ========================================================================= */
.nd-fe-main {
    padding-top: var(--nd-header-height);
    min-height: 100vh;
}

.nd-fe-main-centered {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.nd-fe-main-editor {
    padding-bottom: var(--nd-toolbar-height);
}

/* =========================================================================
   Quick Start (Step 1)
   ========================================================================= */
.nd-fe-quickstart {
    width: 100%;
    max-width: 600px;
    background: var(--nd-bg);
    border-radius: var(--nd-radius-xl);
    box-shadow: var(--nd-shadow-lg);
    padding: 40px;
}

.nd-fe-quickstart-header {
    text-align: center;
    margin-bottom: 32px;
}

.nd-fe-quickstart-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.nd-fe-quickstart-header h1 {
    margin: 0 0 8px;
    font-size: 24px;
    font-weight: 700;
}

.nd-fe-quickstart-header p {
    margin: 0;
    color: var(--nd-text-muted);
}

.nd-fe-quickstart-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.nd-fe-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nd-fe-form-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--nd-text);
}

.nd-fe-required {
    color: var(--nd-error);
}

.nd-fe-input,
.nd-fe-select,
.nd-fe-textarea {
    padding: 12px 14px;
    border: 1px solid var(--nd-border);
    border-radius: var(--nd-radius);
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.2s;
    width: 100%;
}

.nd-fe-input:focus,
.nd-fe-select:focus,
.nd-fe-textarea:focus {
    outline: none;
    border-color: var(--nd-primary);
}

.nd-fe-textarea-main {
    padding: 16px;
    font-size: 16px;
    min-height: 80px;
    resize: vertical;
}

.nd-fe-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.nd-fe-topic-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
}

.nd-fe-suggestions-label {
    font-size: 12px;
    color: var(--nd-text-muted);
}

.nd-fe-suggestion {
    padding: 4px 12px;
    background: var(--nd-bg-muted);
    border: none;
    border-radius: 20px;
    font-size: 12px;
    color: var(--nd-text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.nd-fe-suggestion:hover {
    background: var(--nd-primary-light);
    color: var(--nd-primary-dark);
}

.nd-fe-advanced-options {
    border: 1px solid var(--nd-border);
    border-radius: var(--nd-radius);
    overflow: hidden;
}

.nd-fe-advanced-options summary {
    padding: 12px 16px;
    font-size: 14px;
    color: var(--nd-text-muted);
    cursor: pointer;
    background: var(--nd-bg-subtle);
}

.nd-fe-advanced-options summary:hover {
    background: var(--nd-bg-muted);
}

.nd-fe-advanced-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.nd-fe-quickstart-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-top: 8px;
}

/* =========================================================================
   Modals
   ========================================================================= */
.nd-fe-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 24px;
    backdrop-filter: blur(4px);
}

.nd-fe-modal-content {
    background: var(--nd-bg);
    border-radius: var(--nd-radius-xl);
    box-shadow: var(--nd-shadow-xl);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.nd-fe-modal-large {
    max-width: 640px;
}

.nd-fe-modal-progress {
    text-align: center;
    padding: 48px;
    max-width: 400px;
}

.nd-fe-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--nd-border);
}

.nd-fe-modal-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

.nd-fe-modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    font-size: 24px;
    color: var(--nd-text-muted);
    cursor: pointer;
    border-radius: var(--nd-radius);
}

.nd-fe-modal-close:hover {
    background: var(--nd-bg-muted);
    color: var(--nd-text);
}

.nd-fe-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.nd-fe-modal-subtitle {
    margin: 0 0 20px;
    color: var(--nd-text-muted);
    font-size: 14px;
}

.nd-fe-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--nd-border);
    background: var(--nd-bg-subtle);
}

/* =========================================================================
   Outline Review
   ========================================================================= */
.nd-fe-outline-sections {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.nd-fe-outline-section {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: var(--nd-bg-subtle);
    border: 1px solid var(--nd-border);
    border-radius: var(--nd-radius);
    cursor: grab;
}

.nd-fe-outline-section:active {
    cursor: grabbing;
}

.nd-fe-outline-section.sortable-ghost {
    opacity: 0.4;
}

.nd-fe-outline-section.sortable-drag {
    background: var(--nd-bg);
    box-shadow: var(--nd-shadow-lg);
}

.nd-fe-outline-checkbox {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-top: 2px;
    accent-color: var(--nd-primary);
}

.nd-fe-outline-content {
    flex: 1;
    min-width: 0;
}

.nd-fe-outline-title {
    width: 100%;
    padding: 4px 8px;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 600;
    background: transparent;
}

.nd-fe-outline-title:focus {
    outline: none;
    border-color: var(--nd-primary);
    background: var(--nd-bg);
}

.nd-fe-outline-desc {
    font-size: 13px;
    color: var(--nd-text-muted);
    margin-top: 4px;
}

.nd-fe-outline-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.nd-fe-outline-action {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    opacity: 0.5;
}

.nd-fe-outline-action:hover {
    background: var(--nd-bg-muted);
    opacity: 1;
}

.nd-fe-outline-handle {
    cursor: grab;
    opacity: 0.3;
}

/* =========================================================================
   Progress Modal
   ========================================================================= */
.nd-fe-progress-icon {
    margin-bottom: 24px;
}

.nd-fe-progress-sections {
    text-align: left;
    margin: 24px 0;
}

.nd-fe-progress-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    font-size: 14px;
    border-bottom: 1px solid var(--nd-border);
}

.nd-fe-progress-item:last-child {
    border-bottom: none;
}

.nd-fe-progress-item-icon {
    width: 20px;
    text-align: center;
}

.nd-fe-progress-item.done .nd-fe-progress-item-icon {
    color: var(--nd-success);
}

.nd-fe-progress-item.active .nd-fe-progress-item-icon {
    color: var(--nd-primary);
}

.nd-fe-progress-item.pending {
    color: var(--nd-text-muted);
}

.nd-fe-progress-note {
    color: var(--nd-text-muted);
    font-size: 13px;
}

/* =========================================================================
   Editor
   ========================================================================= */
.nd-fe-editor-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 24px;
}

.nd-fe-editor {
    padding: 0;
    min-height: 300px;
}

/* Editor.js overrides */
.codex-editor__redactor {
    padding-bottom: 100px !important;
}

.ce-block__content {
    max-width: 100%;
}

.ce-toolbar__content {
    max-width: 100%;
}

.ce-paragraph {
    font-size: 16px;
    line-height: 1.7;
}

.ce-header {
    font-weight: 700;
}

/* AI-generated block indicator */
.ce-block[data-ai-generated="true"] {
    position: relative;
}

.ce-block[data-ai-generated="true"]::before {
    content: '✨';
    position: absolute;
    left: -24px;
    top: 4px;
    font-size: 12px;
    opacity: 0.5;
}

/* Section with AI actions */
.nd-fe-section-wrapper {
    position: relative;
}

.nd-fe-section-actions {
    position: absolute;
    top: 0;
    right: -40px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.nd-fe-section-wrapper:hover .nd-fe-section-actions {
    opacity: 1;
}

.nd-fe-section-action {
    width: 32px;
    height: 32px;
    border: 1px solid var(--nd-border);
    background: var(--nd-bg);
    border-radius: var(--nd-radius);
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nd-fe-section-action:hover {
    background: var(--nd-bg-muted);
    border-color: var(--nd-border-strong);
}

/* =========================================================================
   Bottom Toolbar
   ========================================================================= */
.nd-fe-editor-toolbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nd-toolbar-height);
    background: var(--nd-bg);
    border-top: 1px solid var(--nd-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 99;
}

.nd-fe-toolbar-left,
.nd-fe-toolbar-center,
.nd-fe-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nd-fe-toolbar-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    border-radius: var(--nd-radius);
    cursor: pointer;
    font-size: 18px;
    color: var(--nd-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}

.nd-fe-toolbar-btn:hover:not(:disabled) {
    background: var(--nd-bg-muted);
    color: var(--nd-text);
}

.nd-fe-toolbar-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.nd-fe-toolbar-btn-labeled {
    width: auto;
    padding: 0 16px;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
}

/* =========================================================================
   Inline AI Bubble
   ========================================================================= */
.nd-fe-inline-ai {
    position: absolute;
    background: var(--nd-bg);
    border: 1px solid var(--nd-border);
    border-radius: var(--nd-radius);
    box-shadow: var(--nd-shadow-lg);
    display: flex;
    gap: 4px;
    padding: 4px;
    z-index: 150;
}

.nd-fe-inline-ai button {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

.nd-fe-inline-ai button:hover {
    background: var(--nd-bg-muted);
}

/* =========================================================================
   Quiz Preview
   ========================================================================= */
.nd-fe-quiz-preview,
.nd-fe-fc-preview {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--nd-border);
}

.nd-fe-quiz-preview h3,
.nd-fe-fc-preview h3 {
    margin: 0 0 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--nd-text-muted);
}

.nd-fe-quiz-question {
    background: var(--nd-bg-subtle);
    border-radius: var(--nd-radius);
    padding: 16px;
    margin-bottom: 12px;
}

.nd-fe-quiz-question-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.nd-fe-quiz-question-text {
    flex: 1;
    font-weight: 500;
}

.nd-fe-quiz-question-actions {
    display: flex;
    gap: 4px;
}

.nd-fe-quiz-option {
    display: block;
    padding: 8px 12px;
    margin: 4px 0;
    background: var(--nd-bg);
    border-radius: 4px;
    font-size: 14px;
}

.nd-fe-quiz-option.correct {
    background: #dcfce7;
    border-left: 3px solid var(--nd-success);
}

/* =========================================================================
   Flashcard Preview
   ========================================================================= */
.nd-fe-fc-card {
    background: var(--nd-bg-subtle);
    border-radius: var(--nd-radius);
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
}

.nd-fe-fc-card-content {
    flex: 1;
}

.nd-fe-fc-card-front {
    font-weight: 600;
    margin-bottom: 4px;
}

.nd-fe-fc-card-back {
    font-size: 14px;
    color: var(--nd-text-muted);
}

/* =========================================================================
   Image Modal
   ========================================================================= */
.nd-fe-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--nd-border);
    padding-bottom: 4px;
}

.nd-fe-tab {
    padding: 8px 16px;
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 500;
    color: var(--nd-text-muted);
    cursor: pointer;
    border-radius: var(--nd-radius) var(--nd-radius) 0 0;
}

.nd-fe-tab.active {
    color: var(--nd-primary);
    background: var(--nd-primary-light);
}

.nd-fe-tab-content {
    display: none;
}

.nd-fe-tab-content.active {
    display: block;
}

.nd-fe-image-search {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.nd-fe-image-search input {
    flex: 1;
}

.nd-fe-image-results {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    max-height: 300px;
    overflow-y: auto;
}

.nd-fe-image-result {
    aspect-ratio: 1;
    border-radius: var(--nd-radius);
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.nd-fe-image-result:hover {
    border-color: var(--nd-primary);
}

.nd-fe-image-result.selected {
    border-color: var(--nd-primary);
    box-shadow: 0 0 0 2px var(--nd-primary-light);
}

.nd-fe-image-result img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.nd-fe-image-credit {
    font-size: 12px;
    color: var(--nd-text-muted);
    margin-top: 12px;
}

.nd-fe-upload-zone {
    border: 2px dashed var(--nd-border);
    border-radius: var(--nd-radius-lg);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.nd-fe-upload-zone:hover {
    border-color: var(--nd-primary);
    background: var(--nd-primary-light);
}

.nd-fe-upload-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

/* =========================================================================
   Regenerate Modal - Simplified UX
   ========================================================================= */
.nd-fe-modal-compact .nd-fe-modal-body {
    padding: 16px 24px 24px;
}

/* Expandable preview */
.nd-fe-regen-preview {
    background: linear-gradient(135deg, #FFF8F0 0%, #FFF5EB 100%);
    border-left: 3px solid var(--nd-primary);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 13px;
    color: #555;
    max-height: 80px;
    overflow: hidden;
    position: relative;
    transition: max-height 0.3s ease;
}

.nd-fe-regen-preview.expanded {
    max-height: 300px;
    overflow-y: auto;
}

.nd-fe-regen-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.nd-fe-regen-preview-label {
    font-weight: 600;
    color: var(--nd-text);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nd-fe-regen-expand-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 10px;
    color: var(--nd-text-muted);
    transition: transform 0.3s;
}

.nd-fe-regen-preview.expanded .nd-fe-regen-expand-btn .expand-icon {
    transform: rotate(180deg);
}

.nd-fe-regen-preview p {
    margin: 0;
    line-height: 1.6;
    white-space: pre-wrap;
}

/* Loading overlay */
.nd-fe-regen-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 12px;
}

.nd-fe-regen-loading-content {
    text-align: center;
}

.nd-fe-regen-loading-content p {
    margin: 16px 0 4px;
    font-weight: 600;
    color: var(--nd-text);
}

.nd-fe-regen-loading-content small {
    color: var(--nd-text-muted);
}

.nd-fe-spinner-large {
    width: 48px;
    height: 48px;
    animation: spin 1s linear infinite;
    color: var(--nd-primary);
}

/* Action Cards Grid - 2x2 + 1 wide */
.nd-fe-regen-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.nd-fe-regen-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 16px 12px;
    background: var(--nd-bg);
    border: 2px solid var(--nd-border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.nd-fe-regen-card-wide {
    grid-column: span 2;
    flex-direction: row;
    justify-content: center;
    gap: 12px;
    padding: 12px 16px;
}

.nd-fe-regen-card-wide .nd-fe-regen-icon {
    font-size: 20px;
}

.nd-fe-regen-card:hover:not(:disabled) {
    border-color: var(--nd-primary);
    background: linear-gradient(135deg, #FFF8F0 0%, #FFFFFF 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 149, 0, 0.15);
}

.nd-fe-regen-card:active:not(:disabled) {
    transform: translateY(0);
}

.nd-fe-regen-card:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.nd-fe-regen-card.loading {
    pointer-events: none;
    border-color: var(--nd-primary);
    background: linear-gradient(135deg, #FFF8F0 0%, #FFFFFF 100%);
}

.nd-fe-regen-card.loading .nd-fe-regen-icon {
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.nd-fe-regen-icon {
    font-size: 24px;
    line-height: 1;
}

.nd-fe-regen-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--nd-text);
}

.nd-fe-regen-desc {
    font-size: 11px;
    color: var(--nd-text-muted);
}

/* Custom instruction panel */
.nd-fe-regen-custom {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--nd-border);
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.nd-fe-regen-custom .nd-fe-textarea {
    flex: 1;
    min-height: 60px;
    resize: none;
}

.nd-fe-btn-sm {
    padding: 10px 20px;
    font-size: 14px;
}

/* Highlight animation for regenerated content */
@keyframes highlightNew {
    0% { background-color: rgba(255, 149, 0, 0.3); }
    100% { background-color: transparent; }
}

.nd-fe-regenerated-highlight {
    animation: highlightNew 3s ease-out;
    border-radius: 4px;
}

/* Modal close button disabled state */
.nd-fe-modal-close:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Responsive */
@media (max-width: 480px) {
    .nd-fe-regen-grid {
        grid-template-columns: 1fr;
    }
    
    .nd-fe-regen-card {
        flex-direction: row;
        justify-content: flex-start;
        padding: 14px 16px;
        gap: 12px;
    }
    
    .nd-fe-regen-card-wide {
        grid-column: span 1;
    }
    
    .nd-fe-regen-icon {
        font-size: 20px;
    }
    
    .nd-fe-regen-custom {
        flex-direction: column;
        align-items: stretch;
    }
}

/* =========================================================================
   Checkbox Group
   ========================================================================= */
.nd-fe-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.nd-fe-checkbox-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    cursor: pointer;
}

.nd-fe-checkbox-group input {
    accent-color: var(--nd-primary);
}

/* =========================================================================
   Toast Notifications
   ========================================================================= */
.nd-fe-toasts {
    position: fixed;
    top: calc(var(--nd-header-height) + 16px);
    right: 16px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nd-fe-toast {
    padding: 12px 20px;
    background: var(--nd-bg);
    border-radius: var(--nd-radius);
    box-shadow: var(--nd-shadow-lg);
    border-left: 4px solid var(--nd-primary);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: nd-toast-in 0.3s ease;
}

.nd-fe-toast.success {
    border-left-color: var(--nd-success);
}

.nd-fe-toast.error {
    border-left-color: var(--nd-error);
}

@keyframes nd-toast-in {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* =========================================================================
   Image Placeholder Block
   ========================================================================= */
.nd-block-image-placeholder {
    background: var(--nd-bg-muted);
    border: 2px dashed var(--nd-border);
    border-radius: var(--nd-radius);
    padding: 32px;
    text-align: center;
    color: var(--nd-text-muted);
    cursor: pointer;
}

.nd-block-image-placeholder:hover {
    border-color: var(--nd-primary);
    background: var(--nd-primary-light);
}

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 768px) {
    .nd-fe-header {
        padding: 0 12px;
    }
    
    .nd-fe-logo span {
        display: none;
    }
    
    .nd-fe-step-label {
        display: none;
    }
    
    .nd-fe-quickstart {
        padding: 24px;
    }
    
    .nd-fe-form-row {
        grid-template-columns: 1fr;
    }
    
    .nd-fe-modal {
        padding: 16px;
    }
    
    .nd-fe-modal-content {
        max-height: 95vh;
    }
    
    .nd-fe-editor-container {
        padding: 16px;
    }
    
    .nd-fe-toolbar-btn-labeled span:not(.nd-fe-btn-icon):not(:first-child) {
        display: none;
    }
    
    .nd-fe-image-results {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .nd-fe-quickstart-header h1 {
        font-size: 20px;
    }
    
    .nd-fe-btn-large {
        width: 100%;
    }
}

/* iOS safe areas */
@supports (padding: env(safe-area-inset-bottom)) {
    .nd-fe-editor-toolbar {
        padding-bottom: env(safe-area-inset-bottom);
        height: calc(var(--nd-toolbar-height) + env(safe-area-inset-bottom));
    }
    
    .nd-fe-main-editor {
        padding-bottom: calc(var(--nd-toolbar-height) + env(safe-area-inset-bottom));
    }
}

/* Error message style */
.nd-fe-error {
    color: #ef4444;
    background: #fee2e2;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
}


/* =========================================================================
   Chip Radio Group (Quiz Type Selection)
   ========================================================================= */
.nd-fe-chip-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.nd-fe-chip {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    border: 2px solid var(--nd-border);
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--nd-bg);
}

.nd-fe-chip input[type="radio"] {
    display: none;
}

.nd-fe-chip:hover {
    border-color: var(--nd-primary);
    background: var(--nd-primary-light);
}

.nd-fe-chip.active,
.nd-fe-chip:has(input:checked) {
    border-color: var(--nd-primary);
    background: var(--nd-primary);
    color: white;
}

/* =========================================================================
   Section Hover Toolbar (Regenerate options)
   ========================================================================= */
.nd-fe-block-wrapper {
    position: relative;
}

.nd-fe-block-toolbar {
    position: absolute;
    right: -50px;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 50;
}

.nd-fe-block-wrapper:hover .nd-fe-block-toolbar {
    opacity: 1;
}

.nd-fe-block-toolbar-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--nd-border);
    background: var(--nd-bg);
    border-radius: var(--nd-radius);
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.nd-fe-block-toolbar-btn:hover {
    background: var(--nd-primary);
    border-color: var(--nd-primary);
    color: white;
}

.nd-fe-block-toolbar-btn[title]:hover::after {
    content: attr(title);
    position: absolute;
    right: 44px;
    background: var(--nd-text);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
}

/* =========================================================================
   Image Placeholder Enhanced
   ========================================================================= */
.nd-img-placeholder-buttons {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.nd-img-placeholder-btn-secondary {
    padding: 8px 16px;
    background: white;
    color: var(--nd-text);
    border: 1px solid var(--nd-border);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.nd-img-placeholder-btn-secondary:hover {
    background: var(--nd-bg-muted);
    border-color: var(--nd-border-strong);
}

/* =========================================================================
   Lessons List Page
   ========================================================================= */
.nd-fe-lessons-list {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px;
}

.nd-fe-lessons-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.nd-fe-lessons-header h1 {
    margin: 0;
    font-size: 24px;
}

.nd-fe-lessons-grid {
    display: grid;
    gap: 16px;
}

.nd-fe-lesson-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: var(--nd-bg);
    border: 1px solid var(--nd-border);
    border-radius: var(--nd-radius-lg);
    transition: all 0.2s;
}

.nd-fe-lesson-card:hover {
    border-color: var(--nd-primary);
    box-shadow: var(--nd-shadow);
}

.nd-fe-lesson-card-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 4px;
}

.nd-fe-lesson-card-meta {
    font-size: 13px;
    color: var(--nd-text-muted);
}

.nd-fe-lesson-card-actions {
    display: flex;
    gap: 8px;
}

.nd-fe-status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.nd-fe-status-draft {
    background: #fef3c7;
    color: #92400e;
}

.nd-fe-status-publish {
    background: #dcfce7;
    color: #166534;
}

.nd-fe-status-private {
    background: #e2e8f0;
    color: #475569;
}

/* =========================================================================
   METADATA FORM STYLES (Step 1)
   ========================================================================= */
.nd-fe-metadata-form-wrapper {
    max-width: 720px;
    width: 100%;
    margin: 0 auto;
}

.nd-fe-form-section {
    background: var(--nd-bg);
    border: 1px solid var(--nd-border);
    border-radius: var(--nd-radius-lg);
    padding: 24px;
    margin-bottom: 20px;
}

.nd-fe-section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--nd-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 20px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--nd-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nd-fe-optional-badge {
    font-size: 11px;
    font-weight: 500;
    color: var(--nd-text-muted);
    background: var(--nd-bg-muted);
    padding: 4px 10px;
    border-radius: 12px;
    text-transform: lowercase;
}

.nd-fe-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Collapsible sections */
.nd-fe-collapsible {
    border: 1px dashed var(--nd-border);
    background: transparent;
}

.nd-fe-collapsible > summary {
    cursor: pointer;
    list-style: none;
    padding: 16px 24px;
    margin: -24px;
    margin-bottom: 0;
}

.nd-fe-collapsible > summary::-webkit-details-marker {
    display: none;
}

.nd-fe-collapsible[open] > summary {
    border-bottom: 1px dashed var(--nd-border);
    margin-bottom: 20px;
}

.nd-fe-collapsible .nd-fe-collapsible-content {
    padding-top: 0;
}

/* Chips field */
.nd-fe-chips-field .nd-fe-chips-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.nd-fe-chips-field .nd-fe-chip {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    background: var(--nd-bg);
    border: 1px solid var(--nd-border);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.15s;
}

.nd-fe-chips-field .nd-fe-chip:hover {
    border-color: var(--nd-primary);
    background: var(--nd-primary-light);
}

.nd-fe-chips-field .nd-fe-chip input[type="radio"] {
    display: none;
}

.nd-fe-chips-field .nd-fe-chip span {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

.nd-fe-chips-field .nd-fe-chip:has(input:checked),
.nd-fe-chips-field .nd-fe-chip.selected {
    background: var(--nd-primary);
    border-color: var(--nd-primary);
    color: white;
}

/* Error states */
.nd-fe-form-group.has-error .nd-fe-select,
.nd-fe-form-group.has-error .nd-fe-input,
.nd-fe-form-group.has-error .nd-fe-textarea,
.nd-fe-form-group.has-error .nd-fe-textarea-main {
    border-color: var(--nd-error) !important;
    background: #fef2f2 !important;
}

.nd-fe-chips-field.has-error .nd-fe-chip {
    border-color: var(--nd-error);
    background: #fef2f2;
}

.nd-fe-chips-field.has-error .nd-fe-chip:has(input:checked) {
    background: var(--nd-primary);
    border-color: var(--nd-primary);
}

.nd-fe-error-message {
    display: none;
    color: var(--nd-error);
    font-size: 13px;
    margin-top: 6px;
    font-weight: 500;
}

.nd-fe-form-group.has-error .nd-fe-error-message,
.nd-fe-chips-field.has-error .nd-fe-error-message {
    display: block;
}

.nd-fe-field-hint {
    font-size: 13px;
    color: var(--nd-text-muted);
    margin: 0 0 8px 0;
}

.nd-fe-required-note {
    text-align: center;
    font-size: 13px;
    color: var(--nd-text-muted);
    margin-top: 16px;
}

/* Disabled button state */
.nd-fe-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* =========================================================================
   STATUS BADGE (Header)
   ========================================================================= */
.nd-fe-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.nd-fe-status-draft {
    background: #fef3c7;
    color: #92400e;
}

.nd-fe-status-publish {
    background: #dcfce7;
    color: #166534;
}

.nd-fe-status-private {
    background: #e0e7ff;
    color: #3730a3;
}

/* =========================================================================
   PREVIEW HEADER (Step 2)
   ========================================================================= */
.nd-fe-preview-header {
    background: var(--nd-bg);
    border-bottom: 1px solid var(--nd-border);
    padding: 32px 24px;
    margin-bottom: 24px;
}

.nd-fe-preview-header-inner {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.nd-fe-title-input-large {
    width: 100%;
    border: none;
    background: transparent;
    font-size: 32px;
    font-weight: 700;
    color: var(--nd-text);
    text-align: center;
    padding: 0;
    outline: none;
    margin-bottom: 16px;
}

.nd-fe-title-input-large:focus {
    outline: none;
}

.nd-fe-title-input-large::placeholder {
    color: var(--nd-text-muted);
}

.nd-fe-preview-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.nd-fe-meta-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    background: var(--nd-bg-muted);
    border-radius: 20px;
    font-size: 13px;
    color: var(--nd-text-muted);
}

/* =========================================================================
   SHAKE ANIMATION
   ========================================================================= */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

.shake {
    animation: shake 0.4s ease-in-out;
}

/* =========================================================================
   RESPONSIVE - MOBILE
   ========================================================================= */
@media (max-width: 768px) {
    .nd-fe-form-grid {
        grid-template-columns: 1fr;
    }
    
    .nd-fe-form-section {
        padding: 16px;
        margin-left: -16px;
        margin-right: -16px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    
    .nd-fe-chips-field .nd-fe-chips-group {
        gap: 8px;
    }
    
    .nd-fe-chips-field .nd-fe-chip {
        padding: 8px 14px;
    }
    
    .nd-fe-chips-field .nd-fe-chip span {
        font-size: 13px;
    }
    
    .nd-fe-preview-header {
        padding: 20px 16px;
    }
    
    .nd-fe-title-input-large {
        font-size: 24px;
    }
    
    .nd-fe-preview-meta {
        gap: 8px;
    }
    
    .nd-fe-meta-tag {
        font-size: 12px;
        padding: 5px 10px;
    }
}

/* =========================================================================
   OUTLINE MODAL - Sections
   ========================================================================= */
.nd-fe-outline-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.nd-fe-outline-section {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: var(--nd-bg-muted);
    border-radius: var(--nd-radius);
    transition: all 0.15s;
}

.nd-fe-outline-section:hover {
    background: var(--nd-bg);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.nd-fe-outline-checkbox {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    accent-color: var(--nd-primary);
}

.nd-fe-outline-title {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
    border: none;
    background: transparent;
    padding: 0;
    outline: none;
}

.nd-fe-outline-title:focus {
    color: var(--nd-primary);
}

.nd-fe-outline-desc {
    font-size: 13px;
    color: var(--nd-text-muted);
    margin: 4px 0 0;
    line-height: 1.5;
}

.nd-fe-outline-remove {
    opacity: 0;
    padding: 4px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--nd-text-muted);
    border-radius: 4px;
    transition: all 0.15s;
}

.nd-fe-outline-section:hover .nd-fe-outline-remove {
    opacity: 1;
}

.nd-fe-outline-remove:hover {
    color: var(--nd-error);
    background: var(--nd-error-light);
}

/* =========================================================================
   PROGRESS MODAL
   ========================================================================= */
.nd-fe-progress-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 24px;
}

.nd-fe-progress-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--nd-bg-muted);
    border-radius: var(--nd-radius);
    font-size: 14px;
    color: var(--nd-text-muted);
    transition: all 0.3s;
}

.nd-fe-progress-item.active {
    background: var(--nd-primary-light);
    color: var(--nd-primary);
}

.nd-fe-progress-item.done {
    background: #dcfce7;
    color: #16a34a;
}

.nd-fe-progress-item-icon {
    font-size: 12px;
}

.nd-fe-progress-note {
    text-align: center;
    font-size: 13px;
    color: var(--nd-text-muted);
    margin: 0;
}

/* =========================================================================
   OUTLINE SECTION CONTENT
   ========================================================================= */
.nd-fe-outline-section-content {
    flex: 1;
}

/* =========================================================================
   STEP 2: NEW LAYOUT - Subheader, View Toggle, Floating Toolbar
   ========================================================================= */

/* Editor Subheader */
.nd-fe-editor-subheader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: var(--nd-bg);
    border-bottom: 1px solid var(--nd-border);
    position: sticky;
    top: 60px;
    z-index: 90;
}

/* View Toggle (Edit/Preview) */
.nd-fe-view-toggle {
    display: flex;
    background: var(--nd-bg-muted);
    border-radius: var(--nd-radius);
    padding: 4px;
}

.nd-fe-view-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--nd-text-muted);
    cursor: pointer;
    transition: all 0.15s;
}

.nd-fe-view-btn:hover {
    color: var(--nd-text);
}

.nd-fe-view-btn.active {
    background: var(--nd-bg);
    color: var(--nd-text);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Quick Tools */
.nd-fe-quick-tools {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nd-fe-quick-tool {
    width: 36px;
    height: 36px;
    border: 1px solid var(--nd-border);
    background: var(--nd-bg);
    border-radius: var(--nd-radius);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nd-fe-quick-tool:hover {
    background: var(--nd-bg-muted);
    border-color: var(--nd-primary);
}

.nd-fe-quick-tool:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.nd-fe-add-section-btn {
    width: auto;
    padding: 0 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--nd-primary);
    border-color: var(--nd-primary);
}

.nd-fe-add-section-btn:hover {
    background: var(--nd-primary-light);
}

.nd-fe-separator {
    width: 1px;
    height: 24px;
    background: var(--nd-border);
    margin: 0 4px;
}

/* =========================================================================
   EDITOR SECTIONS
   ========================================================================= */

/* Section Cards - Applied via JavaScript */
.nd-fe-editor .ce-block {
    transition: all 0.2s;
}

/* Section visual grouping */
.nd-fe-section-card {
    background: var(--nd-bg);
    border: 1px solid var(--nd-border);
    border-radius: 12px;
    padding: 32px;
    margin-bottom: 24px;
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.nd-fe-section-card:hover {
    border-color: var(--nd-primary-light);
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

/* Section number indicator */
.nd-fe-section-number {
    position: absolute;
    top: -12px;
    left: 24px;
    background: var(--nd-primary);
    color: white;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 12px;
}

/* Add block button at section end */
.nd-fe-section-add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 16px;
    margin-top: 16px;
    border: 2px dashed var(--nd-border);
    border-radius: var(--nd-radius);
    background: transparent;
    color: var(--nd-text-muted);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s;
}

.nd-fe-section-add-btn:hover {
    border-color: var(--nd-primary);
    color: var(--nd-primary);
    background: var(--nd-primary-light);
}

/* =========================================================================
   FLOATING TOOLBAR
   ========================================================================= */

.nd-fe-floating-toolbar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

.nd-fe-floating-toolbar.visible {
    opacity: 1;
    visibility: visible;
}

.nd-fe-floating-toolbar-inner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--nd-text);
    border-radius: 50px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.nd-fe-floating-label {
    font-size: 13px;
    color: rgba(255,255,255,0.7);
    margin-right: 8px;
}

.nd-fe-float-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nd-fe-float-btn:hover {
    background: var(--nd-primary);
    transform: scale(1.1);
}

.nd-fe-float-btn span {
    filter: grayscale(1) brightness(2);
}

.nd-fe-float-btn:hover span {
    filter: none;
}

/* =========================================================================
   PREVIEW MODE
   ========================================================================= */

.nd-fe-preview-wrapper {
    max-width: 900px;
    margin: 0 auto;
    padding: 32px 24px;
}

.nd-fe-preview-content {
    background: var(--nd-bg);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0,0,0,0.1);
}

/* Preview Section Slides */
.nd-fe-preview-section {
    padding: 48px;
    border-bottom: 1px solid var(--nd-border);
    position: relative;
}

.nd-fe-preview-section:last-child {
    border-bottom: none;
}

.nd-fe-preview-section h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--nd-text);
}

.nd-fe-preview-section p {
    font-size: 17px;
    line-height: 1.7;
    margin-bottom: 16px;
    color: var(--nd-text);
}

.nd-fe-preview-section img {
    max-width: 100%;
    border-radius: var(--nd-radius);
    margin: 24px 0;
}

/* Preview Quiz Card */
.nd-fe-preview-quiz {
    background: linear-gradient(135deg, #fff5e6 0%, #fff9f0 100%);
    border: 1px solid #f0d4a0;
    border-radius: 12px;
    padding: 24px;
    margin: 24px 0;
}

.nd-fe-preview-quiz h3 {
    font-size: 18px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Preview Image Placeholder */
.nd-fe-preview-image-placeholder {
    background: linear-gradient(135deg, #e8f4ff 0%, #f0f8ff 100%);
    border: 2px dashed #a0c8e8;
    border-radius: 12px;
    padding: 48px;
    text-align: center;
    margin: 24px 0;
}

/* Section Navigation Dots (for slides feel) */
.nd-fe-section-nav {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 90;
}

.nd-fe-section-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--nd-border);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.nd-fe-section-dot:hover,
.nd-fe-section-dot.active {
    background: var(--nd-primary);
    transform: scale(1.3);
}

.nd-fe-section-dot.active {
    box-shadow: 0 0 0 4px var(--nd-primary-light);
}

/* =========================================================================
   RESPONSIVE
   ========================================================================= */

@media (max-width: 768px) {
    .nd-fe-editor-subheader {
        flex-direction: column;
        gap: 12px;
        padding: 12px 16px;
    }
    
    .nd-fe-view-toggle {
        width: 100%;
    }
    
    .nd-fe-view-btn {
        flex: 1;
        text-align: center;
    }
    
    .nd-fe-quick-tools {
        width: 100%;
        justify-content: center;
    }
    
    .nd-fe-floating-toolbar-inner {
        padding: 10px 16px;
    }
    
    .nd-fe-float-btn {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .nd-fe-section-nav {
        display: none;
    }
    
    .nd-fe-section-card {
        padding: 20px;
        margin-bottom: 16px;
    }
    
    .nd-fe-preview-section {
        padding: 24px;
    }
}
/* =========================================================================
   STEP 2 REDESIGN - Unified Toolbar, Sections, Navigation
   v3.4.0
   ========================================================================= */

/* =========================================================================
   VIEW TOGGLE IN HEADER
   ========================================================================= */
.nd-fe-view-toggle-compact {
    display: flex;
    background: var(--nd-bg-muted);
    border-radius: var(--nd-radius);
    padding: 3px;
    margin-right: 16px;
}

.nd-fe-view-btn-compact {
    padding: 6px 12px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--nd-text-muted);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.nd-fe-view-btn-compact:hover {
    color: var(--nd-text);
}

.nd-fe-view-btn-compact.active {
    background: var(--nd-bg);
    color: var(--nd-text);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* =========================================================================
   UNIFIED TOOLBAR
   ========================================================================= */
.nd-fe-toolbar {
    position: sticky;
    top: 52px !important;
    z-index: 95;
    background: var(--nd-bg);
    border-bottom: 1px solid var(--nd-border);
    padding: 8px 0;
}

.nd-fe-toolbar-inner {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.nd-fe-toolbar-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nd-fe-toolbar-group-content {
    flex-wrap: wrap;
}

.nd-fe-toolbar-divider {
    width: 1px;
    height: 28px;
    background: var(--nd-border);
    margin: 0 8px;
}

.nd-fe-toolbar-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid var(--nd-border);
    background: var(--nd-bg);
    border-radius: var(--nd-radius);
    font-size: 13px;
    font-weight: 500;
    color: var(--nd-text);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.nd-fe-toolbar-btn:hover:not(:disabled) {
    background: var(--nd-bg-muted);
    border-color: var(--nd-primary);
    color: var(--nd-primary);
}

.nd-fe-toolbar-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.nd-fe-toolbar-btn-accent {
    background: var(--nd-primary-light);
    border-color: var(--nd-primary);
    color: var(--nd-primary);
}

.nd-fe-toolbar-btn-accent:hover:not(:disabled) {
    background: var(--nd-primary);
    color: white;
}

.nd-fe-toolbar-icon {
    font-size: 16px;
    line-height: 1;
}

.nd-fe-toolbar-label {
    font-size: 13px;
}

/* Hide labels on smaller screens */
@media (max-width: 900px) {
    .nd-fe-toolbar-group-content .nd-fe-toolbar-label {
        display: none;
    }
    
    .nd-fe-toolbar-group-content .nd-fe-toolbar-btn {
        padding: 8px 10px;
    }
}

@media (max-width: 600px) {
    .nd-fe-toolbar-inner {
        padding: 0 12px;
    }
    
    .nd-fe-toolbar-btn {
        padding: 6px 8px;
    }
    
    .nd-fe-toolbar-label {
        display: none;
    }
}

/* =========================================================================
   SECTION NAVIGATION DOTS
   ========================================================================= */
.nd-fe-section-nav {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 90;
    padding: 12px 8px;
    background: rgba(255,255,255,0.9);
    border-radius: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
}

.nd-fe-section-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--nd-border);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.nd-fe-section-dot:hover {
    background: var(--nd-primary-light);
    border-color: var(--nd-primary);
    transform: scale(1.2);
}

.nd-fe-section-dot.active {
    background: var(--nd-primary);
    border-color: var(--nd-primary);
    box-shadow: 0 0 0 4px var(--nd-primary-light);
}

.nd-fe-section-dot[data-title]:hover::before {
    content: attr(data-title);
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-right: 12px;
    padding: 6px 12px;
    background: var(--nd-text);
    color: white;
    font-size: 12px;
    white-space: nowrap;
    border-radius: 6px;
    pointer-events: none;
}

@media (max-width: 768px) {
    .nd-fe-section-nav {
        right: 8px;
        gap: 8px;
        padding: 8px 6px;
    }
    
    .nd-fe-section-dot {
        width: 10px;
        height: 10px;
    }
    
    .nd-fe-section-dot[data-title]:hover::before {
        display: none;
    }
}

/* =========================================================================
   EDITOR SECTIONS - Visual Grouping
   ========================================================================= */

/* Section Card Wrapper (injected by JS) */
.nd-fe-section-wrapper {
    background: var(--nd-bg);
    border: 1px solid var(--nd-border);
    border-radius: 16px;
    margin-bottom: 24px;
    padding: 32px;
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    transition: all 0.2s;
}

.nd-fe-section-wrapper:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border-color: var(--nd-primary-light);
}

/* Section Header with number */
.nd-fe-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--nd-border);
}

.nd-fe-section-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--nd-primary);
    color: white;
    font-size: 14px;
    font-weight: 700;
    border-radius: 50%;
    flex-shrink: 0;
}

.nd-fe-section-title-display {
    flex: 1;
    font-size: 20px;
    font-weight: 700;
    color: var(--nd-text);
    margin: 0;
}

.nd-fe-section-actions {
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.15s;
}

.nd-fe-section-wrapper:hover .nd-fe-section-actions {
    opacity: 1;
}

.nd-fe-section-action-btn {
    padding: 6px 10px;
    border: 1px solid var(--nd-border);
    background: var(--nd-bg);
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}

.nd-fe-section-action-btn:hover {
    background: var(--nd-bg-muted);
    border-color: var(--nd-primary);
}

/* Section Content Area */
.nd-fe-section-content {
    /* EditorJS blocks inside */
}

/* Add block at end of section */
.nd-fe-section-add-block {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    margin-top: 16px;
    border: 2px dashed var(--nd-border);
    border-radius: var(--nd-radius);
    background: transparent;
    color: var(--nd-text-muted);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}

.nd-fe-section-add-block:hover {
    border-color: var(--nd-primary);
    color: var(--nd-primary);
    background: var(--nd-primary-light);
}

/* =========================================================================
   EDITOR BLOCKS INSIDE SECTIONS
   ========================================================================= */
.nd-fe-editor .ce-block {
    padding: 8px 0;
}

.nd-fe-editor .ce-block--focused {
    background: var(--nd-primary-light);
    border-radius: var(--nd-radius);
    margin: 0 -16px;
    padding: 8px 16px;
}

/* H2 blocks (section headers) styling */
.nd-fe-editor .ce-block h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--nd-text);
    margin: 0;
    padding: 8px 0;
}

/* Empty block placeholder */
.nd-fe-editor .ce-paragraph[data-placeholder]:empty::before {
    color: var(--nd-text-muted);
    font-style: italic;
}

/* =========================================================================
   PREVIEW MODE SECTIONS
   ========================================================================= */
.nd-fe-preview-wrapper {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px;
}

.nd-fe-preview-content {
    background: var(--nd-bg);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}

.nd-fe-preview-section {
    padding: 48px;
    position: relative;
    border-bottom: 1px solid var(--nd-border);
}

.nd-fe-preview-section:last-child {
    border-bottom: none;
}

.nd-fe-preview-section:nth-child(even) {
    background: var(--nd-bg-muted);
}

.nd-fe-preview-section h2 {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--nd-text);
}

.nd-fe-preview-section h2::before {
    content: counter(section);
    counter-increment: section;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--nd-primary);
    color: white;
    font-size: 18px;
    font-weight: 700;
    border-radius: 50%;
    flex-shrink: 0;
}

.nd-fe-preview-content {
    counter-reset: section;
}

.nd-fe-preview-section p {
    font-size: 17px;
    line-height: 1.8;
    margin-bottom: 16px;
    color: var(--nd-text);
}

.nd-fe-preview-section img {
    max-width: 100%;
    border-radius: 12px;
    margin: 24px 0;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

/* Preview Quiz/Flashcard cards */
.nd-fe-preview-interactive {
    background: linear-gradient(135deg, #fff9f0 0%, #fff5e6 100%);
    border: 1px solid #f0d4a0;
    border-radius: 16px;
    padding: 24px;
    margin: 24px 0;
}

.nd-fe-preview-interactive h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    margin-bottom: 16px;
}

/* Preview Image Placeholder */
.nd-fe-preview-image-ph {
    background: linear-gradient(135deg, #f0f8ff 0%, #e8f4ff 100%);
    border: 2px dashed #a0c8e8;
    border-radius: 12px;
    padding: 48px 24px;
    text-align: center;
    margin: 24px 0;
}

.nd-fe-preview-image-ph-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.nd-fe-preview-image-ph-text {
    color: var(--nd-text-muted);
    font-size: 14px;
}

/* =========================================================================
   RESPONSIVE
   ========================================================================= */
@media (max-width: 768px) {
    .nd-fe-editor-card,
    .nd-fe-preview-wrapper {
        padding: 16px;
    }
    
    .nd-fe-section-wrapper {
        padding: 20px;
        margin-bottom: 16px;
    }
    
    .nd-fe-preview-section {
        padding: 24px;
    }
    
    .nd-fe-preview-section h2 {
        font-size: 22px;
    }
    
    .nd-fe-preview-section h2::before {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .nd-fe-view-toggle-compact {
        margin-right: 8px;
    }
    
    .nd-fe-view-btn-compact span:last-child {
        display: none;
    }
}

/* Hide old elements */
.nd-fe-editor-subheader,
.nd-fe-floating-toolbar,
.nd-fe-view-toggle:not(.nd-fe-view-toggle-compact) {
    display: none !important;
}

/* =========================================================================
   REDESIGNED TOOLBAR - v3.4.1
   ========================================================================= */

/* Reset old toolbar styles */
.nd-fe-toolbar-btn,
.nd-fe-toolbar-icon,
.nd-fe-toolbar-label,
.nd-fe-toolbar-divider,
.nd-fe-toolbar-btn-accent {
    all: unset;
}

/* New Toolbar Container */
.nd-fe-toolbar {
    position: sticky;
    top: 60px;
    z-index: 95;
    background: var(--nd-bg);
    border-bottom: 1px solid var(--nd-border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.nd-fe-toolbar-inner {
    max-width: 1000px;
    margin: 0 auto;
    padding: 10px 24px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* Toolbar Groups */
.nd-fe-toolbar-group {
    display: flex;
    align-items: center;
    gap: 2px;
    background: var(--nd-bg-muted);
    border-radius: 8px;
    padding: 4px;
}

.nd-fe-toolbar-history {
    background: transparent;
    padding: 0;
    gap: 4px;
}

/* Separator */
.nd-fe-toolbar-sep {
    width: 1px;
    height: 32px;
    background: var(--nd-border);
    margin: 0 8px;
}

/* Base Button Style */
.nd-fe-tb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--nd-text);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.nd-fe-tb-btn:hover:not(:disabled) {
    background: var(--nd-bg);
    color: var(--nd-primary);
}

.nd-fe-tb-btn:active:not(:disabled) {
    transform: scale(0.96);
}

.nd-fe-tb-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.nd-fe-tb-btn svg {
    flex-shrink: 0;
}

/* Icon-only Button */
.nd-fe-tb-icon {
    padding: 8px;
    border: 1px solid var(--nd-border);
    background: var(--nd-bg);
    border-radius: 8px;
}

.nd-fe-tb-icon:hover:not(:disabled) {
    border-color: var(--nd-primary);
    background: var(--nd-primary-light);
}

/* Primary Button (Add Section) */
.nd-fe-tb-primary {
    background: var(--nd-primary);
    color: white !important;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
}

.nd-fe-tb-primary:hover:not(:disabled) {
    background: var(--nd-primary-dark, #e06b00);
    color: white !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(234, 127, 0, 0.3);
}

.nd-fe-tb-primary svg {
    stroke: white;
}

/* Label visibility */
.nd-fe-tb-label {
    font-size: 13px;
}

@media (max-width: 800px) {
    .nd-fe-toolbar-blocks .nd-fe-tb-label,
    .nd-fe-toolbar-media .nd-fe-tb-label {
        display: none;
    }
    
    .nd-fe-toolbar-blocks .nd-fe-tb-btn,
    .nd-fe-toolbar-media .nd-fe-tb-btn {
        padding: 8px;
    }
}

@media (max-width: 600px) {
    .nd-fe-toolbar-inner {
        padding: 8px 12px;
        gap: 4px;
    }
    
    .nd-fe-toolbar-sep {
        display: none;
    }
    
    .nd-fe-tb-primary span {
        display: none;
    }
    
    .nd-fe-tb-primary {
        padding: 8px 12px;
    }
    
    .nd-fe-toolbar-group {
        padding: 2px;
    }
}

/* =========================================================================
   TOAST NOTIFICATIONS - Fixed
   ========================================================================= */
.nd-fe-toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.nd-fe-toast {
    padding: 12px 20px;
    background: var(--nd-text);
    color: white;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    pointer-events: auto;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
}

.nd-fe-toast.show {
    transform: translateX(0);
    opacity: 1;
}

.nd-fe-toast-success {
    background: #059669;
}

.nd-fe-toast-error {
    background: #dc2626;
}

.nd-fe-toast-info {
    background: #2563eb;
}

@media (max-width: 480px) {
    .nd-fe-toast-container {
        left: 12px;
        right: 12px;
        bottom: 12px;
    }
    
    .nd-fe-toast {
        transform: translateY(100%);
    }
    
    .nd-fe-toast.show {
        transform: translateY(0);
    }
}

/* =========================================================================
   AI HOVER BUTTON FOR BLOCKS - Styles defined in JS
   ========================================================================= */

/* Position adjustment for editor */
.nd-fe-editor .ce-block {
    position: relative;
}

/* =========================================================================
   VIEW TOGGLE IMPROVEMENTS
   ========================================================================= */
.nd-fe-view-toggle-compact {
    display: flex;
    background: var(--nd-bg-muted);
    border-radius: 8px;
    padding: 4px;
    margin-right: 12px;
}

.nd-fe-view-btn-compact {
    padding: 8px 14px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--nd-text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.nd-fe-view-btn-compact:hover {
    color: var(--nd-text);
}

.nd-fe-view-btn-compact.active {
    background: var(--nd-bg);
    color: var(--nd-text);
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

/* =========================================================================
   v3.4.2 - TOOLBAR CENTERED + TITLE IN EDITOR
   ========================================================================= */

/* Toolbar centered */
.nd-fe-toolbar-inner {
    max-width: 900px;
    margin: 0 auto;
    padding: 10px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* Editor wrapper - remove old preview header */
.nd-fe-preview-header {
    display: none !important;
}

/* Editor Card - contains title + editor */
.nd-fe-editor-card {
    position: relative;
    background: var(--nd-bg);
    border: 1px solid var(--nd-border);
    border-radius: 16px;
    padding: 32px 64px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
    max-width: 960px;
    margin: 24px auto;
}

/* Title Input - 28px inside card */
.nd-fe-title-input {
    font-size: 28px;
    font-weight: 700;
    color: var(--nd-text);
    border: none;
    background: transparent;
    padding: 0;
    margin-bottom: 16px;
    outline: none;
    line-height: 1.3;
    max-width: 100%;
}

/* Specific ID selector for title input */
input#nd-fe-title {
    max-width: 100%;
    font-size: 28px;
}

.nd-fe-title-input::placeholder {
    color: var(--nd-text-muted);
    font-weight: 500;
}

.nd-fe-title-input:focus {
    outline: none;
}

/* Meta tags inside editor card */
.nd-fe-editor-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--nd-border);
}

.nd-fe-editor-meta .nd-fe-meta-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: var(--nd-bg-muted);
    border-radius: 20px;
    font-size: 13px;
    color: var(--nd-text-muted);
}

/* EditorJS styling inside card */
.nd-fe-editor-card .codex-editor {
    padding: 0;
}

.nd-fe-editor-card .ce-block__content {
    max-width: 100%;
}

.nd-fe-editor-card .ce-toolbar__content {
    max-width: 100%;
}

/* Hide old title input styles */
.nd-fe-title-input-large {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    .nd-fe-editor-card {
        padding: 20px;
        border-radius: 12px;
        margin: 16px auto;
    }
    
    .nd-fe-title-input {
        font-size: 22px;
    }
    
    .nd-fe-toolbar-inner {
        padding: 8px 12px;
    }
}

/* Ensure blocks receive pointer events for AI hover */
.ce-block,
.ce-block__content {
    pointer-events: auto !important;
}

/* ========================================
   Drag & Drop Styles
   ======================================== */

/* Drag handle cursor - folosește grab pentru a indica drag */
.ce-toolbar__settings-btn {
    cursor: grab !important;
}

/* Aliniere verticală toolbar cu textul */
.ce-toolbar__actions {
    padding-top: 12px;
}

.ce-toolbar__settings-btn:active {
    cursor: grabbing !important;
}

/* Block being dragged */
.ce-block--dragging {
    opacity: 0.5;
    background: var(--nd-bg-muted);
}

/* Drop indicator line - arată unde va fi plasat blocul */
.ce-block--drop-target::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: -2px;
    height: 4px;
    background: var(--nd-primary);
    border-radius: 2px;
    animation: nd-pulse 0.5s ease-in-out infinite alternate;
}

@keyframes nd-pulse {
    from { opacity: 0.5; }
    to { opacity: 1; }
}

/* Hover effect pe butoanele toolbar */
.ce-toolbar__plus:hover,
.ce-toolbar__settings-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 6px;
}

/* Ascunde tooltip-ul nativ Editor.js pe settings button și înlocuiește cu al nostru */
.ce-toolbar__settings-btn {
    position: relative;
}

/* Tooltip custom unificat - înlocuiește "Click to tune" */
.ce-toolbar__settings-btn[data-tooltip]::before,
.ce-toolbar__settings-btn[data-tooltip]::after {
    display: none !important;
}

/* Suprascriem tooltip-ul nativ */
.ce-popover__item[data-item-name="move-up"]::before { content: '↑ '; }
.ce-popover__item[data-item-name="move-down"]::before { content: '↓ '; }

/* ========================================
   Toolbar Tooltip Override
   ======================================== */

/* Ascunde tooltip-ul nativ Editor.js pentru settings button */
.ct[data-tooltip="Click to tune"] {
    display: none !important;
}

/* Tooltip personalizat pentru drag handle */
.ce-toolbar__settings-btn {
    position: relative;
}

/* Overlay text pe tooltip-ul nativ - combină mesajele */
.ce-toolbar__settings-btn::before {
    content: '⋮⋮ Trage sau click pentru opțiuni';
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.ce-toolbar__settings-btn::after {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1e293b;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 1000;
}

.ce-toolbar__settings-btn:hover::before,
.ce-toolbar__settings-btn:hover::after {
    opacity: 1;
}

/* Ascunde complet tooltip-ul nativ care apare sub */
.ct.ct--bottom {
    display: none !important;
}

/* Pentru cazul în care Editor.js folosește alt sistem de tooltip */
[data-cy="tooltip"] {
    display: none !important;
}

/* ========================================
   AI Image Controls Overlay
   ======================================== */

/* Container for AI-generated images */
.ce-block .image-tool {
    position: relative;
}

/* Overlay that appears on hover for AI images */
.nd-ai-image-overlay {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 10;
}

.ce-block:hover .nd-ai-image-overlay {
    opacity: 1;
}

/* AI image control buttons */
.nd-ai-img-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 16px;
}

.nd-ai-img-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.nd-ai-img-btn-regenerate {
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: white;
}

.nd-ai-img-btn-regenerate:hover {
    background: linear-gradient(135deg, #ea580c, #c2410c);
}

.nd-ai-img-btn-upload {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

.nd-ai-img-btn-upload:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

.nd-ai-img-btn-delete {
    background: rgba(255, 255, 255, 0.95);
    color: #ef4444;
}

.nd-ai-img-btn-delete:hover {
    background: #fef2f2;
    color: #dc2626;
}

/* Tooltip for AI image buttons */
.nd-ai-img-btn::after {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
}

.nd-ai-img-btn:hover::after {
    opacity: 1;
}

/* Badge for AI-generated images */
.nd-ai-image-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(249, 115, 22, 0.9);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Hidden file input for upload */
.nd-ai-img-upload-input {
    display: none;
}
