/* ─── Editor Fullscreen Mode ─── */
body.editor-fullscreen #sidebar,
body.editor-fullscreen #sidebar-overlay {
    display: none !important;
}
body.editor-fullscreen > div > header {
    display: none !important;
}
body.editor-fullscreen > div {
    margin-left: 0 !important;
}
body.editor-fullscreen #main-content {
    margin-left: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
}

/* ─── Editor Layout ─── */
.editor-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background: #0f0f0f;
}

.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #111827;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    min-height: 52px;
    z-index: 20;
}

.editor-toolbar .toolbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.editor-toolbar .toolbar-center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.editor-toolbar .toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.editor-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ─── Panels ─── */
.editor-panel-left {
    width: 260px;
    min-width: 260px;
    background: #111827;
    border-right: 1px solid rgba(255,255,255,0.06);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.3s ease, min-width 0.3s ease, opacity 0.3s ease;
}

.editor-panel-right {
    width: 300px;
    min-width: 300px;
    background: #111827;
    border-left: 1px solid rgba(255,255,255,0.06);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: width 0.3s ease, min-width 0.3s ease, opacity 0.3s ease;
}

.editor-panel-left.hidden-panel {
    width: 0;
    min-width: 0;
    opacity: 0;
    pointer-events: none;
    border-right: none;
    padding: 0;
    overflow: hidden;
}

.editor-panel-right.hidden-panel {
    width: 0;
    min-width: 0;
    opacity: 0;
    pointer-events: none;
    border-left: none;
    padding: 0;
    overflow: hidden;
}

.panel-header {
    padding: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-header h3 {
    font-size: 13px;
    font-weight: 600;
    color: #e5e7eb;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

/* ─── Canvas ─── */
.editor-canvas {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0a0a0a;
    overflow: hidden;
    position: relative;
    padding: 16px;
}

.editor-canvas .iframe-wrapper {
    position: relative;
    transition: width 0.3s ease, height 0.3s ease, transform 0.3s ease;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.06), 0 20px 60px rgba(0,0,0,0.5);
}

.editor-canvas .iframe-wrapper.device-mobile {
    border-radius: 24px;
    box-shadow: 0 0 0 8px #1f2937, 0 0 0 10px #374151, 0 20px 60px rgba(0,0,0,0.5);
}

.editor-canvas .iframe-wrapper.device-tablet {
    border-radius: 16px;
    box-shadow: 0 0 0 6px #1f2937, 0 0 0 8px #374151, 0 20px 60px rgba(0,0,0,0.5);
}

.editor-canvas iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* ─── Toolbar Buttons ─── */
.editor-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.editor-btn-icon {
    padding: 6px;
    border-radius: 8px;
    cursor: pointer;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.editor-btn-ghost {
    background: transparent;
    color: #9ca3af;
}
.editor-btn-ghost:hover {
    background: rgba(255,255,255,0.06);
    color: #e5e7eb;
}
.editor-btn-ghost:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}
.editor-btn-ghost:disabled:hover {
    background: transparent;
    color: #9ca3af;
}

.editor-btn-save {
    background: #374151;
    color: #e5e7eb;
    position: relative;
}
.editor-btn-save:hover {
    background: #4b5563;
}
.editor-btn-save .dirty-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f59e0b;
    position: absolute;
    top: 4px;
    right: 4px;
    display: none;
}
.editor-btn-save.has-changes .dirty-dot {
    display: block;
}

.editor-btn-publish {
    background: #059669;
    color: white;
}
.editor-btn-publish:hover {
    background: #047857;
}
.editor-btn-publish:disabled {
    background: #374151;
    color: #6b7280;
    cursor: not-allowed;
}

.editor-btn-device {
    background: transparent;
    color: #6b7280;
    padding: 6px 10px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
}
.editor-btn-device:hover {
    color: #d1d5db;
    background: rgba(255,255,255,0.06);
}
.editor-btn-device.active {
    color: white;
    background: #7c3aed;
}

/* ─── Layers Panel ─── */
.layer-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}
.layer-item:hover {
    background: rgba(255,255,255,0.04);
}
.layer-item.active {
    background: rgba(124,58,237,0.15);
    border: 1px solid rgba(124,58,237,0.3);
}
.layer-item .layer-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: rgba(255,255,255,0.04);
    color: #9ca3af;
    font-size: 12px;
    flex-shrink: 0;
}
.layer-item .layer-name {
    flex: 1;
    font-size: 13px;
    color: #d1d5db;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.layer-item .layer-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.15s;
}
.layer-item:hover .layer-actions {
    opacity: 1;
}
.layer-item .layer-action-btn {
    padding: 4px;
    border-radius: 4px;
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.layer-item .layer-action-btn:hover {
    background: rgba(255,255,255,0.08);
    color: #d1d5db;
}

/* ─── Section Context Menu (US-001) ─── */
.layer-context-menu {
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 100;
    min-width: 140px;
    background: #1f2937;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 4px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    animation: fadeIn 0.15s ease-out;
}
.layer-context-menu button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    border-radius: 6px;
    background: none;
    color: #d1d5db;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.1s;
}
.layer-context-menu button:hover {
    background: rgba(255,255,255,0.08);
}
.layer-context-menu button.layer-menu-danger:hover {
    background: rgba(239,68,68,0.15);
    color: #fca5a5;
}

/* ─── Drag Handle ─── */
.layer-drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 12px;
    flex-shrink: 0;
    color: #4b5563;
    cursor: grab;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
    margin-left: -4px;
}
.layer-item:hover .layer-drag-handle {
    opacity: 1;
}
.layer-drag-handle:hover {
    color: #9ca3af;
}
.layer-drag-handle:active {
    cursor: grabbing;
}

/* ─── Drag & Drop ─── */
.layer-item.dragging {
    opacity: 0.3;
    background: rgba(124,58,237,0.05);
    border: 1px dashed rgba(124,58,237,0.3);
}
.layer-item.drag-over-top {
    box-shadow: 0 -2px 0 0 #7c3aed;
}
.layer-item.drag-over-bottom {
    box-shadow: 0 2px 0 0 #7c3aed;
}

/* ─── Properties Panel ─── */
.prop-section {
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.prop-section:last-child {
    border-bottom: none;
}
.prop-section-title {
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 10px;
}
.prop-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.prop-label {
    font-size: 12px;
    color: #9ca3af;
    min-width: 70px;
    flex-shrink: 0;
}
.prop-input {
    flex: 1;
    min-width: 0;
    padding: 6px 10px;
    background: #1f2937;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px;
    color: #e5e7eb;
    font-size: 12px;
    outline: none;
    transition: border-color 0.15s;
}
.prop-input:focus {
    border-color: #7c3aed;
}
.prop-input-sm {
    width: 60px;
    padding: 4px 8px;
    text-align: center;
}
.prop-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: #374151;
    border-radius: 2px;
    outline: none;
}
.prop-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: #7c3aed;
    border-radius: 50%;
    cursor: pointer;
}
.prop-color {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 2px solid rgba(255,255,255,0.1);
    cursor: pointer;
    padding: 0;
    background: none;
}
.prop-color::-webkit-color-swatch-wrapper {
    padding: 0;
}
.prop-color::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}
.prop-btn-group {
    display: flex;
    background: #1f2937;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.08);
}
.prop-btn-group button {
    flex: 1;
    padding: 6px;
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.prop-btn-group button:hover {
    background: rgba(255,255,255,0.04);
    color: #d1d5db;
}
.prop-btn-group button.active {
    background: #7c3aed;
    color: white;
}

/* ─── Empty States ─── */
.editor-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    color: #6b7280;
    text-align: center;
}
.editor-empty-state svg {
    width: 32px;
    height: 32px;
    margin-bottom: 12px;
    opacity: 0.5;
}
.editor-empty-state p {
    font-size: 13px;
    line-height: 1.5;
}

/* ─── Scrollbar ─── */
.editor-panel-left ::-webkit-scrollbar,
.editor-panel-right ::-webkit-scrollbar {
    width: 4px;
}
.editor-panel-left ::-webkit-scrollbar-track,
.editor-panel-right ::-webkit-scrollbar-track {
    background: transparent;
}
.editor-panel-left ::-webkit-scrollbar-thumb,
.editor-panel-right ::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
}

/* ─── Section Catalog Modal ─── */
.animate-slide-up {
    animation: slideUp 0.25s ease-out;
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ─── Global Tab Styles ─── */
.editor-panel-right textarea {
    font-family: inherit;
    line-height: 1.5;
}

/* ─── Media Manager ─── */
.media-thumb {
    transition: border-color 0.15s;
}
.media-thumb:hover {
    border-color: rgba(124,58,237,0.5) !important;
}

/* ─── Drag Mode Active Button ─── */
.editor-btn-icon.active,
.editor-btn-icon[style*="background: rgb(124, 58, 237)"] {
    border-radius: 8px;
}

/* ─── AI Assist Button ─── */
#editor-btn-ai-assist {
    background: linear-gradient(135deg, rgba(124,58,237,0.3), rgba(99,102,241,0.3));
    border: 1px solid rgba(139,92,246,0.5);
    color: #c4b5fd;
}
#editor-btn-ai-assist:hover {
    background: linear-gradient(135deg, rgba(124,58,237,0.45), rgba(99,102,241,0.45));
    color: #e9ddff;
}
#editor-btn-ai-assist.active {
    background: linear-gradient(135deg, #7c3aed, #6366f1);
    color: white;
    border-color: #7c3aed;
}

/* ─── Checkbox Styling ─── */
.editor-panel-right input[type="checkbox"] {
    accent-color: #7c3aed;
    width: 16px;
    height: 16px;
}

/* ─── AI Assistant Panel ─── */
.editor-ai-panel {
    width: 0;
    min-width: 0;
    background: #111827;
    border-left: 1px solid rgba(255,255,255,0.06);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transition: width 0.3s ease, min-width 0.3s ease, opacity 0.3s ease;
}
.editor-ai-panel.open {
    width: 400px;
    min-width: 400px;
    opacity: 1;
}

.ai-panel-header {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

/* ─── AI Mode Toggle (Build/Chat) ─── */
.ai-mode-toggle {
    display: flex;
    background: #1f2937;
    border-radius: 8px;
    padding: 2px;
    gap: 2px;
}
.ai-mode-btn {
    padding: 4px 14px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #6b7280;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.ai-mode-btn:hover {
    color: #d1d5db;
}
.ai-mode-btn.active {
    color: white;
}
#ai-mode-build.active {
    background: #7c3aed;
}
#ai-mode-chat.active {
    background: #3b82f6;
}

.ai-panel-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.ai-panel-messages::-webkit-scrollbar { width: 4px; }
.ai-panel-messages::-webkit-scrollbar-track { background: transparent; }
.ai-panel-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.ai-welcome-msg {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 24px 16px;
}

.ai-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    padding: 0 8px;
}
.ai-chip {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid rgba(124,58,237,0.3);
    background: rgba(124,58,237,0.08);
    color: #c4b5fd;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.ai-chip:hover {
    background: rgba(124,58,237,0.2);
    border-color: rgba(124,58,237,0.5);
    color: #e9ddff;
}

/* AI Context Chips (element selection) */
.ai-context-chips {
    display: flex;
    gap: 6px;
    padding: 6px 12px;
    overflow-x: auto;
    scrollbar-width: none;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.ai-context-chips::-webkit-scrollbar { display: none; }
.ai-context-chip {
    padding: 4px 12px;
    border-radius: 16px;
    border: 1px solid rgba(99,102,241,0.3);
    background: rgba(99,102,241,0.1);
    color: #a5b4fc;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
}
.ai-context-chip:hover {
    background: rgba(99,102,241,0.25);
    border-color: rgba(99,102,241,0.5);
    color: #c7d2fe;
}

/* Message bubbles */
.ai-msg {
    max-width: 90%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.5;
    word-wrap: break-word;
    animation: fadeIn 0.2s ease-out;
}
.ai-msg-user {
    align-self: flex-end;
    background: linear-gradient(135deg, #7c3aed, #6366f1);
    color: white;
    border-bottom-right-radius: 4px;
}
.ai-msg-ai {
    align-self: flex-start;
    background: #1f2937;
    color: #e5e7eb;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(255,255,255,0.06);
}

/* Thinking animation */
.ai-thinking {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #9ca3af;
    font-size: 12px;
}
.ai-thinking-dots {
    display: flex;
    gap: 4px;
}
.ai-thinking-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #7c3aed;
    animation: aiDotPulse 1.4s ease-in-out infinite;
}
.ai-thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.ai-thinking-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes aiDotPulse {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1); }
}

/* Attachment strip (previews above input) */
.ai-attachments-strip {
    display: flex;
    gap: 8px;
    padding: 8px 16px 0;
    flex-shrink: 0;
    overflow-x: auto;
    scrollbar-width: none;
}
.ai-attachments-strip::-webkit-scrollbar { display: none; }
.ai-attachments-strip:empty { display: none; }

.ai-att-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    background: #1f2937;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    flex-shrink: 0;
    max-width: 160px;
    animation: fadeIn 0.2s ease-out;
}
.ai-att-item img {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}
.ai-att-item .ai-att-doc-icon {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    background: rgba(124,58,237,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #a78bfa;
    font-size: 16px;
}
.ai-att-item .ai-att-name {
    font-size: 11px;
    color: #d1d5db;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 80px;
}

.ai-att-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ef4444;
    border: 2px solid #111827;
    color: white;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: transform 0.1s;
}
.ai-att-remove:hover {
    transform: scale(1.15);
}

/* Attachment badge in user message bubble */
.ai-att-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 8px;
    background: rgba(255,255,255,0.15);
    font-size: 10px;
    margin-top: 6px;
    opacity: 0.85;
}

/* Input area */
.ai-panel-input {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: flex-end;
    gap: 8px;
    flex-shrink: 0;
}

/* Attach button (paperclip) */
.ai-attach-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: rgba(255,255,255,0.04);
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
}
.ai-attach-btn:hover {
    background: rgba(124,58,237,0.15);
    color: #a78bfa;
}
.ai-panel-input textarea {
    flex: 1;
    resize: none;
    padding: 10px 14px;
    background: #1f2937;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    color: #e5e7eb;
    font-size: 13px;
    font-family: inherit;
    line-height: 1.5;
    outline: none;
    max-height: 120px;
    transition: border-color 0.15s;
}
.ai-panel-input textarea:focus {
    border-color: #7c3aed;
}
.ai-panel-input textarea::placeholder {
    color: #6b7280;
}
.ai-panel-input textarea:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.ai-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #7c3aed, #6366f1);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
}
.ai-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(124,58,237,0.4);
}
.ai-send-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Undo button in AI response */
.ai-undo-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.04);
    color: #9ca3af;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s;
}
.ai-undo-btn:hover {
    background: rgba(124,58,237,0.15);
    border-color: rgba(124,58,237,0.3);
    color: #c4b5fd;
}

/* Error message bubble */
.ai-msg-error {
    background: rgba(239,68,68,0.12) !important;
    border-color: rgba(239,68,68,0.3) !important;
    color: #fca5a5 !important;
}

/* Mobile responsive: AI panel as overlay */
@media (max-width: 768px) {
    .editor-ai-panel.open {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 100% !important;
        min-width: 100% !important;
        z-index: 50;
    }
}

/* ─── Mobile Editor Overlay ─── */
.editor-mobile-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #030712;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
    text-align: center;
    animation: fadeIn 0.3s ease-out;
}
.editor-mobile-overlay .mobile-icon {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    background: rgba(124,58,237,0.12);
    border: 1px solid rgba(124,58,237,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}
.editor-mobile-overlay .mobile-icon svg {
    width: 40px;
    height: 40px;
    color: #a78bfa;
}
.editor-mobile-overlay h2 {
    font-size: 20px;
    font-weight: 700;
    color: #f3f4f6;
    margin-bottom: 12px;
    line-height: 1.3;
}
.editor-mobile-overlay p {
    font-size: 14px;
    color: #9ca3af;
    line-height: 1.6;
    max-width: 340px;
    margin-bottom: 32px;
}
.editor-mobile-overlay .mobile-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 300px;
}
.editor-mobile-overlay .btn-back-dashboard {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border-radius: 12px;
    background: linear-gradient(135deg, #7c3aed, #6366f1);
    color: white;
    font-size: 15px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}
.editor-mobile-overlay .btn-back-dashboard:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(124,58,237,0.4);
}
.editor-mobile-overlay .btn-continue-anyway {
    padding: 12px 24px;
    border-radius: 12px;
    background: transparent;
    color: #6b7280;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid rgba(255,255,255,0.08);
    cursor: pointer;
    transition: all 0.2s;
}
.editor-mobile-overlay .btn-continue-anyway:hover {
    color: #9ca3af;
    border-color: rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.03);
}

/* ─── Page Tab Bar ─── */
.editor-page-tabs {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 0 16px;
    background: #0d1117;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    min-height: 36px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.editor-page-tabs::-webkit-scrollbar {
    display: none;
}
.page-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: none;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: #6b7280;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
    position: relative;
}
.page-tab:hover {
    color: #d1d5db;
    background: rgba(255,255,255,0.03);
}
.page-tab.active {
    color: #a78bfa;
    border-bottom-color: #7c3aed;
    background: rgba(124,58,237,0.06);
}
.page-tab.active .page-tab-label {
    color: #c4b5fd;
}
.page-tab-label {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.page-tab-add {
    color: #4b5563;
    padding: 6px 10px;
    border-bottom: 2px solid transparent;
}
.page-tab-add:hover {
    color: #a78bfa;
    background: rgba(124,58,237,0.06);
}

/* ─── Mobile Editor: Compact Layout ─── */
@media (max-width: 768px) {
    .editor-container.mobile-mode .editor-page-tabs {
        display: none !important;
    }
    .editor-container.mobile-mode .editor-panel-left,
    .editor-container.mobile-mode .editor-panel-right {
        display: none !important;
    }
    .editor-container.mobile-mode .editor-canvas {
        padding: 0;
    }
    .editor-container.mobile-mode .editor-toolbar .toolbar-center {
        display: none;
    }
    .editor-container.mobile-mode .toolbar-left .w-px,
    .editor-container.mobile-mode .toolbar-left #editor-page-selector-wrap,
    .editor-container.mobile-mode .toolbar-left #editor-lang-selector-wrap,
    .editor-container.mobile-mode .toolbar-left #editor-translation-badge,
    .editor-container.mobile-mode .toolbar-left #editor-hamburger-btn {
        display: none !important;
    }
    .editor-container.mobile-mode .toolbar-right .w-px,
    .editor-container.mobile-mode .toolbar-right #editor-btn-undo,
    .editor-container.mobile-mode .toolbar-right #editor-btn-redo,
    .editor-container.mobile-mode .toolbar-right [onclick*="Popups"],
    .editor-container.mobile-mode .toolbar-right [onclick*="Versions"],
    .editor-container.mobile-mode .toolbar-right [onclick*="docs"] {
        display: none !important;
    }
    .editor-container.mobile-mode .toolbar-right .editor-btn-publish {
        padding: 6px 10px;
        font-size: 12px;
    }
    .editor-container.mobile-mode .toolbar-right .editor-btn-save {
        padding: 6px 10px;
        font-size: 12px;
    }
    .editor-container.mobile-mode .toolbar-left > span {
        max-width: 100px !important;
        font-size: 12px;
    }
    .editor-container.mobile-mode .toolbar-right #editor-btn-knowledge,
    .editor-container.mobile-mode .toolbar-right #editor-btn-themes {
        display: none !important;
    }
}

/* ─── Knowledge Base Button ─── */
#editor-btn-knowledge {
    color: #9ca3af;
    background: transparent;
    border: none;
}
#editor-btn-knowledge:hover {
    background: rgba(124,58,237,0.15);
    color: #a78bfa;
}

/* ─── US-008: Design Themes ─── */
#editor-btn-themes {
    color: #9ca3af;
    background: transparent;
    border: none;
}
#editor-btn-themes:hover {
    background: rgba(124,58,237,0.15);
    color: #a78bfa;
}

.theme-color-picker {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 2px solid rgba(255,255,255,0.1);
    cursor: pointer;
    padding: 0;
    background: none;
    flex-shrink: 0;
}
.theme-color-picker::-webkit-color-swatch-wrapper {
    padding: 2px;
}
.theme-color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.theme-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 12px;
    transition: all 0.15s;
}
.theme-card:hover {
    border-color: rgba(124,58,237,0.3);
    background: rgba(255,255,255,0.05);
}
.theme-card-active {
    border-color: rgba(124,58,237,0.5);
    background: rgba(124,58,237,0.06);
}

.theme-active-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(124,58,237,0.2);
    color: #a78bfa;
    font-size: 10px;
    font-weight: 600;
}

.theme-color-swatches {
    display: flex;
    gap: 4px;
}
.theme-swatch {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 2px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

.theme-action-btn {
    padding: 5px;
    border-radius: 6px;
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.theme-action-btn:hover {
    background: rgba(124,58,237,0.15);
    color: #a78bfa;
}
.theme-action-delete:hover {
    background: rgba(239,68,68,0.15);
    color: #fca5a5;
}

/* ─── US-003: Code View Panel ─── */
.code-view-tabs {
    display: flex;
    background: #1f2937;
    border-radius: 8px;
    padding: 2px;
    gap: 2px;
    width: 100%;
}
.code-view-tab {
    flex: 1;
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #6b7280;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}
.code-view-tab:hover {
    color: #d1d5db;
}
.code-view-tab.active {
    background: #7c3aed;
    color: white;
}

.code-view-subtabs {
    display: flex;
    gap: 2px;
    background: #1f2937;
    border-radius: 6px;
    padding: 2px;
    margin-bottom: 8px;
    flex-shrink: 0;
}
.code-view-subtab {
    flex: 1;
    padding: 5px 8px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: #6b7280;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}
.code-view-subtab:hover {
    color: #d1d5db;
}
.code-view-subtab.active {
    background: rgba(124,58,237,0.3);
    color: #c4b5fd;
}

#editor-code-view {
    flex-direction: column;
}
.code-view-editor {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.code-view-textarea {
    flex: 1;
    width: 100%;
    min-height: 200px;
    padding: 12px;
    background: #0d1117;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    color: #e6edf3;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.6;
    resize: none;
    outline: none;
    tab-size: 2;
    white-space: pre;
    overflow: auto;
}
.code-view-textarea:focus {
    border-color: #7c3aed;
}
.code-view-textarea::placeholder {
    color: #4b5563;
}
.code-view-apply-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 10px;
    margin-top: 8px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #7c3aed, #6366f1);
    color: white;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}
.code-view-apply-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(124,58,237,0.4);
}

/* ─── US-009: AI Image Generation ─── */
.ai-img-style-btn {
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.03);
    color: #9ca3af;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}
.ai-img-style-btn:hover {
    border-color: rgba(124,58,237,0.4);
    color: #d1d5db;
}
.ai-img-style-btn.ai-img-style-active {
    background: rgba(124,58,237,0.2);
    border-color: #7c3aed;
    color: white;
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.animate-spin {
    animation: spin 1s linear infinite;
}
