/* frontend-editor.css — Front-end block editor styles (admin only) */

/* ── Edit mode indicator ─────────────────────────────────────────── */
body.liq-editing {
    /* Subtle border around viewport when in edit mode */
    outline: 2px solid rgba(59, 130, 246, 0.5);
    outline-offset: -2px;
}

/* ── Block outlines and selection ────────────────────────────────── */
body.liq-editing .liq-editable-block {
    position: relative;
    outline: 1px dashed rgba(148, 163, 184, 0.3);
    outline-offset: 2px;
    transition: outline-color 0.15s ease;
    cursor: pointer;
    min-height: 24px;
}

body.liq-editing .liq-editable-block:hover {
    outline-color: rgba(59, 130, 246, 0.6);
}

body.liq-editing .liq-editable-block.liq-block-selected {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* ── Block toolbar (move, settings, delete) ──────────────────────── */
.liq-block-toolbar {
    position: absolute;
    top: -32px;
    right: 4px;
    display: flex;
    gap: 2px;
    background: #1e293b;
    border-radius: 6px;
    padding: 2px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.liq-block-selected .liq-block-toolbar {
    opacity: 1;
    pointer-events: auto;
}

.liq-block-toolbar button {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1;
}

.liq-block-toolbar button:hover {
    background: #334155;
    color: #e2e8f0;
}

/* ── Drag handle ─────────────────────────────────────────────────── */
.liq-block-toolbar .liq-drag-handle {
    cursor: grab;
}

.liq-block-toolbar .liq-drag-handle:active {
    cursor: grabbing;
}

/* ── Drop indicator ──────────────────────────────────────────────── */
.liq-drop-indicator {
    height: 3px;
    background: #3b82f6;
    border-radius: 2px;
    margin: 4px 0;
    transition: opacity 0.15s ease;
}

/* ── Block palette sidebar ───────────────────────────────────────── */
.liq-palette {
    position: fixed;
    top: 68px; /* below admin toolbar */
    right: 0;
    width: 280px;
    height: calc(100vh - 68px);
    background: #0f172a;
    color: #e2e8f0;
    border-left: 1px solid #334155;
    z-index: 99997;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 13px;
}

.liq-palette.open {
    transform: translateX(0);
}

.liq-palette-header {
    padding: 16px;
    border-bottom: 1px solid #334155;
    font-weight: 700;
    font-size: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.liq-palette-category {
    padding: 8px 16px 4px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    font-weight: 600;
}

.liq-palette-item {
    padding: 8px 16px;
    cursor: grab;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #1e293b;
    transition: background 0.1s ease;
}

.liq-palette-item:hover {
    background: #1e293b;
}

.liq-palette-item:active {
    cursor: grabbing;
}

.liq-palette-icon {
    width: 32px;
    height: 32px;
    background: #1e293b;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.liq-palette-label {
    font-weight: 500;
}

.liq-palette-desc {
    font-size: 11px;
    color: #64748b;
    margin-top: 2px;
}

/* ── Save bar ────────────────────────────────────────────────────── */
.liq-save-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #1e293b;
    border-top: 1px solid #334155;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    z-index: 99998;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.liq-save-bar button {
    padding: 8px 20px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}

.liq-save-bar .liq-btn-save {
    background: #22c55e;
    color: #fff;
}

.liq-save-bar .liq-btn-save:hover {
    background: #16a34a;
}

.liq-save-bar .liq-btn-discard {
    background: none;
    border: 1px solid #475569;
    color: #94a3b8;
}

.liq-save-bar .liq-btn-discard:hover {
    color: #e2e8f0;
    border-color: #64748b;
}

/* ── Device preview ──────────────────────────────────────────────── */
.liq-preview-frame {
    margin: 0 auto;
    transition: max-width 0.3s ease;
    box-sizing: border-box;
}

body.liq-preview-tablet .site-main,
body.liq-preview-tablet main {
    max-width: 768px !important;
    margin: 0 auto !important;
    box-shadow: 0 0 0 1px #334155;
}

body.liq-preview-mobile .site-main,
body.liq-preview-mobile main {
    max-width: 390px !important;
    margin: 0 auto !important;
    box-shadow: 0 0 0 1px #334155;
}

/* ── Inline text editing ─────────────────────────────────────────── */
.liq-editable-block [contenteditable="true"] {
    outline: none;
    min-height: 1em;
}

.liq-editable-block [contenteditable="true"]:focus {
    box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.3);
    border-radius: 2px;
}

/* ── Insert between blocks ───────────────────────────────────────── */
.liq-insert-zone {
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s ease;
}

body.liq-editing .liq-insert-zone:hover {
    opacity: 1;
}

.liq-insert-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #3b82f6;
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.liq-insert-btn:hover {
    background: #2563eb;
}

/* ── Floating settings panel ─────────────────────────────────────── */
.liq-settings-panel {
    position: fixed;
    top: 80px;
    right: 20px;
    width: 300px;
    max-height: calc(100vh - 160px);
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 99998;
    overflow-y: auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 13px;
    color: #e2e8f0;
}

.liq-settings-panel-header {
    padding: 12px 16px;
    border-bottom: 1px solid #334155;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.liq-settings-panel-body {
    padding: 12px 16px;
}

.liq-settings-field {
    margin-bottom: 12px;
}

.liq-settings-field label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    margin-bottom: 4px;
}

.liq-settings-field input,
.liq-settings-field textarea,
.liq-settings-field select {
    width: 100%;
    padding: 6px 10px;
    background: #0f172a;
    border: 1px solid #475569;
    border-radius: 4px;
    color: #e2e8f0;
    font-size: 13px;
    box-sizing: border-box;
}

.liq-settings-field textarea {
    min-height: 60px;
    resize: vertical;
}

/* ── Smart block overlay — toolbar for full-width sections ──────── */
[data-smart-block].liq-editable-block .liq-block-toolbar {
    top: 8px;
    right: 8px;
    z-index: 100;
}

[data-smart-block].liq-editable-block {
    transition: outline-color 0.15s ease;
}

[data-smart-block].liq-editable-block:hover {
    outline-color: rgba(59, 130, 246, 0.6);
}
