/* Template editor — isolated full-screen layout (no site header/footer) */
:root {
    --bg-deep: #030712;
    --bg-base: #0a0f1e;
    --bg-elevated: #111827;
    --cyan: #22d3ee;
    --gold-soft: #f5d061;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    --border: rgba(148, 163, 184, 0.12);
    --editor-bar-h: 60px;
    --transition: 0.25s ease;
    --font: 'Segoe UI', Tahoma, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body.editor-layout {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    background: var(--bg-deep);
    color: var(--text);
    font-family: var(--font);
}

/* Never show site chrome on editor page */
body.editor-layout .site-header,
body.editor-layout .site-footer,
body.editor-layout .back-top,
body.editor-layout .announce-overlay,
body.editor-layout .announce-panel {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
}

.template-editor {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    width: 100%;
    background: var(--bg-base);
}

.template-editor__bar {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    min-height: var(--editor-bar-h);
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elevated);
    z-index: 1000;
}

.template-editor__bar-start,
.template-editor__bar-end {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.template-editor__bar-end {
    margin-inline-start: auto;
}

.template-editor__back {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.template-editor__back:hover { color: var(--cyan); }

.template-editor__title {
    font-size: 1rem;
    margin: 0;
    font-weight: 600;
}

.template-editor__pages {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.template-editor__tab {
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    padding: 6px 14px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.85rem;
    font-family: inherit;
    transition: var(--transition);
}

.template-editor__tab.is-active,
.template-editor__tab:hover {
    border-color: rgba(34, 211, 238, 0.45);
    color: var(--cyan);
    background: rgba(34, 211, 238, 0.08);
}

.template-editor__note {
    margin: 0;
    font-size: 0.75rem;
    color: var(--text-dim);
    display: none;
    max-width: 260px;
    line-height: 1.35;
}

.template-editor__download {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--gold-soft), #e4b429);
    color: #0a0f1e;
    font-weight: 700;
    font-size: 0.88rem;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}

.template-editor__download:hover { filter: brightness(1.05); }
.template-editor__download:disabled { opacity: 0.65; cursor: wait; }

.template-editor__canvas {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    position: relative;
}

.template-editor__loading {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(3, 7, 18, 0.8);
    z-index: 900;
    font-size: 2rem;
    color: var(--cyan);
}

.template-editor__loading.is-hidden { display: none; }

/* GrapesJS fills remaining space only */
.template-editor__canvas .gjs-editor {
    height: 100% !important;
}

.template-editor__canvas .gjs-cv-canvas {
    height: 100% !important;
    width: 100% !important;
    top: 0 !important;
}

.template-editor__canvas .gjs-frame-wrapper,
.template-editor__canvas .gjs-cv-canvas__frames {
    height: 100% !important;
}

@media (min-width: 1100px) {
    .template-editor__note { display: block; }
}

@media (max-width: 640px) {
    .template-editor__title { display: none; }
}
