/* ═══════════════════════════════════════════
   LetsPresent Editor — Premium Dark Theme
   ═══════════════════════════════════════════ */

:root {
    /* Color Palette */
    --bg-base: #0f1117;
    --bg-surface: #161821;
    --bg-elevated: #1e2030;
    --bg-hover: #252840;
    --bg-active: #2d3050;
    --bg-input: #1a1d2e;

    --text-primary: #e4e6f0;
    --text-secondary: #8990b3;
    --text-muted: #5c6490;
    --text-inverse: #0f1117;

    --accent: #7c6aef;
    --accent-hover: #9485f5;
    --accent-muted: rgba(124, 106, 239, 0.15);

    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;
    --info: #60a5fa;

    --border: #2a2d42;
    --border-light: #353856;
    --border-focus: #7c6aef;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);

    /* Sizing */
    --sidebar-width: 280px;
    --sidebar-collapsed: 0px;
    --topbar-height: 60px;
    --statusbar-height: 32px;
    --pane-header-height: 44px;

    /* Transitions */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --duration: 0.25s;

    /* Typography */
    --font-sans: 'Noto Sans KR', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
}

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

html,
body {
    height: 100%;
    overflow: hidden;
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ─── App Layout ─── */
.app-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* ─── Sidebar ─── */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: width var(--duration) var(--ease), min-width var(--duration) var(--ease);
    z-index: 100;
    overflow: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
    min-width: var(--sidebar-collapsed);
}

.sidebar.collapsed .sidebar-label,
.sidebar.collapsed .sidebar-actions,
.sidebar.collapsed .sidebar-search,
.sidebar.collapsed .sidebar-list,
.sidebar.collapsed .logo span {
    opacity: 0;
    pointer-events: none;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 12px;
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
    white-space: nowrap;
}

.logo i {
    font-size: 20px;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--duration) var(--ease);
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sidebar.collapsed .sidebar-toggle i {
    transform: rotate(180deg);
}

.sidebar-actions {
    padding: 0 16px 12px;
    flex-shrink: 0;
}

.sidebar-search {
    padding: 0 16px 12px;
    flex-shrink: 0;
}

.search-wrapper {
    position: relative;
}

.search-wrapper i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 12px;
}

.search-wrapper input {
    width: 100%;
    padding: 8px 12px 8px 34px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 13px;
    outline: none;
    transition: border-color var(--duration) var(--ease);
}

.search-wrapper input:focus {
    border-color: var(--border-focus);
}

.search-wrapper input::placeholder {
    color: var(--text-muted);
}

.sidebar-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 8px;
}

.article-item {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 2px;
    position: relative;
    border: 1px solid transparent;
}

.article-item:hover {
    background: var(--bg-hover);
}

.article-item.active {
    background: var(--accent-muted);
    border-color: var(--accent);
}

.article-item-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.article-item-date {
    font-size: 11px;
    color: var(--text-muted);
}

.article-item .delete-item-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    transition: opacity var(--duration) var(--ease);
}

.article-item:hover .delete-item-btn {
    opacity: 0.7;
}

.article-item .delete-item-btn:hover {
    opacity: 1;
    background: rgba(248, 113, 113, 0.1);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-muted);
    gap: 12px;
}

.empty-state i {
    font-size: 32px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 13px;
}

/* ─── Main Content ─── */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    min-width: 0;
}

/* ─── Top Bar ─── */
.topbar {
    height: var(--topbar-height);
    min-height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    gap: 16px;
    flex-shrink: 0;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.sidebar-mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
    padding: 6px;
}

.sidebar-reopen {
    display: none;
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 16px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    transition: all var(--duration) var(--ease);
}

.sidebar-reopen:hover {
    background: var(--accent-muted);
    color: var(--accent-hover);
}

.sidebar.collapsed~.main-content .sidebar-reopen {
    display: flex;
    align-items: center;
    justify-content: center;
}

.title-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.title-input {
    flex: 1;
    font-size: 18px;
    font-weight: 600;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-sans);
    outline: none;
    padding: 4px 0;
    min-width: 0;
}

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

.article-id-badge {
    font-size: 11px;
    padding: 2px 8px;
    background: var(--accent-muted);
    color: var(--accent);
    border-radius: 12px;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    font-family: var(--font-sans);
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--duration) var(--ease);
    white-space: nowrap;
    user-select: none;
}

.btn:active {
    transform: scale(0.97);
}

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

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 0 16px rgba(124, 106, 239, 0.3);
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--bg-hover);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent), #9f7aea);
    color: white;
    border: none;
}

.btn-accent:hover {
    box-shadow: 0 0 20px rgba(124, 106, 239, 0.4);
    transform: translateY(-1px);
}

.btn-accent:active {
    transform: translateY(0) scale(0.97);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

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

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #ef5350;
}

.btn-danger-ghost {
    color: var(--danger);
}

.btn-danger-ghost:hover {
    background: rgba(248, 113, 113, 0.1);
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-xs {
    padding: 4px 8px;
    font-size: 11px;
}

.btn-label {
    display: inline;
}

/* ─── Editor Container ─── */
.editor-container {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0;
}

/* ─── Editor Pane ─── */
.editor-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.pane-header {
    display: flex;
    flex-direction: column;
    padding: 6px 12px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    gap: 4px;
    flex-shrink: 0;
}

.pane-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 28px;
}

.pane-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}

.pane-title i {
    color: var(--accent);
}

.pane-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    padding: 2px 0;
}

.pane-actions {
    display: flex;
    gap: 4px;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 2px;
}

.toolbar-divider {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 4px;
    flex-shrink: 0;
}

.toolbar-btn {
    width: 30px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 4px;
    transition: all var(--duration) var(--ease);
    font-size: 12px;
}

.toolbar-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.toolbar-btn:active {
    background: var(--bg-active);
}

.pane-toolbar select {
    padding: 4px 6px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 11px;
    cursor: pointer;
    outline: none;
    max-width: 110px;
}

.pane-toolbar select:focus {
    border-color: var(--border-focus);
}

.color-picker {
    width: 26px;
    height: 26px;
    padding: 0;
    border: 2px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    background: none;
}

.color-picker::-webkit-color-swatch-wrapper {
    padding: 1px;
}

.color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 2px;
}

/* ─── WYSIWYG Content ─── */
.wysiwyg-content {
    flex: 1;
    padding: 24px 28px;
    overflow-y: auto;
    outline: none;
    font-size: 15px;
    line-height: 1.8;
    color: var(--text-primary);
    background: var(--bg-base);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.wysiwyg-content:focus {
    box-shadow: inset 0 0 0 2px rgba(124, 106, 239, 0.1);
}

.wysiwyg-content h1 {
    font-size: 28px;
    margin: 16px 0 12px;
    font-weight: 700;
    color: var(--text-primary);
}

.wysiwyg-content h2 {
    font-size: 24px;
    margin: 14px 0 10px;
    font-weight: 600;
    color: var(--text-primary);
}

.wysiwyg-content h3 {
    font-size: 20px;
    margin: 12px 0 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.wysiwyg-content h4 {
    font-size: 17px;
    margin: 10px 0 6px;
    font-weight: 600;
    color: var(--text-primary);
}

.wysiwyg-content p {
    margin: 8px 0;
}

.wysiwyg-content a {
    color: var(--accent);
    text-decoration: underline;
}

.wysiwyg-content img {
    max-width: 100%;
    margin: 8px 0;
}

.wysiwyg-content blockquote {
    border-left: 3px solid var(--accent);
    padding: 8px 16px;
    margin: 12px 0;
    background: var(--accent-muted);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-secondary);
}

.wysiwyg-content pre {
    background: var(--bg-elevated);
    padding: 16px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 13px;
    margin: 12px 0;
}

.wysiwyg-content code {
    background: var(--bg-elevated);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 13px;
}

.wysiwyg-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 12px 0;
}

.wysiwyg-content th,
.wysiwyg-content td {
    border: 1px solid var(--border-light);
    padding: 8px 12px;
    text-align: left;
}

.wysiwyg-content th {
    background: var(--bg-elevated);
    font-weight: 600;
}

.wysiwyg-content ul,
.wysiwyg-content ol {
    padding-left: 24px;
    margin: 8px 0;
}

.wysiwyg-content hr {
    border: none;
    border-top: 1px solid var(--border-light);
    margin: 20px 0;
}

/* ─── HTML Content (CodeMirror) ─── */
.html-content {
    flex: 1;
    font-size: 13px;
    line-height: 1.7;
    border: none;
    outline: none;
    resize: none;
}

/* CodeMirror container fills pane */
.editor-pane .CodeMirror {
    flex: 1;
    height: auto;
    background: var(--bg-base);
    color: #c9d1d9;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.7;
}

/* Gutters */
.editor-pane .CodeMirror-gutters {
    background: #12141e;
    border-right: 1px solid var(--border);
    padding-right: 2px;
}

.editor-pane .CodeMirror-linenumber {
    color: var(--text-muted);
    font-size: 11px;
    padding: 0 6px 0 4px;
}

/* Cursor */
.editor-pane .CodeMirror-cursor {
    border-left: 2px solid var(--accent);
}

/* Selection */
.editor-pane .CodeMirror-selected,
.editor-pane .CodeMirror-focused .CodeMirror-selected {
    background: rgba(124, 106, 239, 0.2);
}

/* Active line */
.editor-pane .CodeMirror-activeline-background {
    background: rgba(255, 255, 255, 0.03);
}

/* Matching tags */
.editor-pane .CodeMirror-matchingtag {
    background: rgba(124, 106, 239, 0.15);
    border-bottom: 1px solid var(--accent);
}

/* Matching brackets */
.editor-pane .CodeMirror-matchingbracket {
    color: var(--accent) !important;
    font-weight: bold;
    border-bottom: 1px solid var(--accent);
}

.editor-pane .CodeMirror-nonmatchingbracket {
    color: var(--danger) !important;
}

/* Fold gutter */
.editor-pane .CodeMirror-foldmarker {
    color: var(--accent);
    text-shadow: none;
    font-family: var(--font-mono);
    cursor: pointer;
}

.editor-pane .CodeMirror-foldgutter-open,
.editor-pane .CodeMirror-foldgutter-folded {
    color: var(--text-muted);
    cursor: pointer;
}

.editor-pane .CodeMirror-foldgutter-open:hover,
.editor-pane .CodeMirror-foldgutter-folded:hover {
    color: var(--accent);
}

/* ─── Syntax Highlighting Colors ─── */

/* HTML Tags */
.editor-pane .cm-tag {
    color: #ff7b72;
}

/* Attributes */
.editor-pane .cm-attribute {
    color: #79c0ff;
}

/* Strings (attribute values) */
.editor-pane .cm-string {
    color: #a5d6ff;
}

/* String-2 (template strings) */
.editor-pane .cm-string-2 {
    color: #d2a8ff;
}

/* Comments */
.editor-pane .cm-comment {
    color: #6e7681;
    font-style: italic;
}

/* CSS Property */
.editor-pane .cm-property {
    color: #79c0ff;
}

/* CSS/JS Keywords */
.editor-pane .cm-keyword {
    color: #ff7b72;
}

/* Numbers */
.editor-pane .cm-number {
    color: #ffa657;
}

/* Def (function def, etc.) */
.editor-pane .cm-def {
    color: #d2a8ff;
}

/* Variable */
.editor-pane .cm-variable {
    color: #c9d1d9;
}

.editor-pane .cm-variable-2 {
    color: #ffa657;
}

/* Qualifier (CSS class/id) */
.editor-pane .cm-qualifier {
    color: #7ee787;
}

/* Builtin */
.editor-pane .cm-builtin {
    color: #ffa657;
}

/* Atom (true, false, null etc.) */
.editor-pane .cm-atom {
    color: #79c0ff;
}

/* Meta (@media etc.) */
.editor-pane .cm-meta {
    color: #d2a8ff;
}

/* Error */
.editor-pane .cm-error {
    color: var(--danger);
}

/* ─── Autocomplete Hints ─── */
.CodeMirror-hints {
    background: var(--bg-elevated) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: var(--shadow-lg) !important;
    font-family: var(--font-mono) !important;
    font-size: 12px !important;
    color: var(--text-primary) !important;
    z-index: 10001 !important;
    max-height: 200px !important;
    overflow-y: auto !important;
}

.CodeMirror-hint {
    padding: 4px 10px !important;
    color: var(--text-primary) !important;
    border-radius: 3px !important;
}

.CodeMirror-hint-active {
    background: var(--accent) !important;
    color: white !important;
}

/* Scrollbar in CodeMirror */
.editor-pane .CodeMirror-vscrollbar::-webkit-scrollbar {
    width: 6px;
}

.editor-pane .CodeMirror-vscrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.editor-pane .CodeMirror-vscrollbar::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}

.editor-pane .CodeMirror-hscrollbar::-webkit-scrollbar {
    height: 6px;
}

.editor-pane .CodeMirror-hscrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.editor-pane .CodeMirror-hscrollbar::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}

/* ─── Pane Resizer ─── */
.pane-resizer {
    width: 6px;
    background: var(--border);
    cursor: col-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--duration) var(--ease);
    flex-shrink: 0;
    position: relative;
}

.pane-resizer:hover,
.pane-resizer.active {
    background: var(--accent);
}

.resizer-handle {
    width: 2px;
    height: 40px;
    background: var(--text-muted);
    border-radius: 2px;
    opacity: 0.5;
}

.pane-resizer:hover .resizer-handle {
    opacity: 0;
}

/* ─── Status Bar ─── */
.statusbar {
    height: var(--statusbar-height);
    min-height: var(--statusbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-muted);
    flex-shrink: 0;
}

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

.status-divider {
    color: var(--border);
}

/* ─── Toast ─── */
.toast {
    position: fixed;
    top: 24px;
    right: 24px;
    padding: 12px 20px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 10000;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s var(--ease);
    backdrop-filter: blur(8px);
}

.toast.hidden {
    display: none;
}

.toast.success i {
    color: var(--success);
}

.toast.error i {
    color: var(--danger);
}

.toast.info i {
    color: var(--info);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ─── Modal ─── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5000;
    animation: fadeIn 0.2s var(--ease);
}

.modal-overlay.hidden {
    display: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 560px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: modalSlide 0.3s var(--ease);
}

.modal-sm {
    max-width: 400px;
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--duration) var(--ease);
}

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

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

/* Template Sections */
.template-save-section {
    margin-bottom: 24px;
}

.template-save-section h4,
.template-list-section h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.template-save-form {
    display: flex;
    gap: 8px;
}

.template-input {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 13px;
    outline: none;
}

.template-input:focus {
    border-color: var(--border-focus);
}

.template-input::placeholder {
    color: var(--text-muted);
}

.template-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 300px;
    overflow-y: auto;
}

.template-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: all var(--duration) var(--ease);
}

.template-item:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
}

.template-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.template-item-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.template-item-date {
    font-size: 11px;
    color: var(--text-muted);
}

.template-item-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    margin-left: 12px;
}

.empty-state-sm {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 13px;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        z-index: 200;
        transform: translateX(-100%);
        transition: transform var(--duration) var(--ease);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    .sidebar-mobile-toggle {
        display: flex;
    }

    .editor-container {
        flex-direction: column;
    }

    .pane-resizer {
        width: 100%;
        height: 6px;
        cursor: row-resize;
    }

    .resizer-handle {
        width: 40px;
        height: 2px;
    }

    .btn-label {
        display: none;
    }

    .pane-toolbar {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 4px;
    }

    .topbar {
        padding: 0 12px;
    }

    .title-input {
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .pane-header {
        flex-direction: column;
        height: auto;
        padding: 8px;
        gap: 6px;
    }
}

/* ─── Loading animation ─── */
@keyframes pulse {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

.loading {
    animation: pulse 1.5s infinite var(--ease);
}

/* ─── Saving indicator ─── */
.saving {
    position: relative;
}

.saving::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(124, 106, 239, 0.05);
    animation: pulse 0.8s infinite;
    border-radius: inherit;
    pointer-events: none;
}