/* JIT Page Builder Stylesheet */
/* CMS Visual Page Builder Module */

:root {
    --brand-primary: #800000;
    --brand-secondary: #4a4a4a;
    --brand-accent-orange: #ff6200;
    --brand-accent-blue: #005f87;
    --brand-light: #f5f5f5;
    --brand-dark: #2a2a2a;
}

.page-builder {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--brand-light);
}

/* Responsive adjustments */
@media (max-width: 900px) {
    .builder-main { flex-direction: column; }
    .component-palette { width: 100%; order: 1; }
    .section-editor { order: 2; padding: 12px; }
    .preview-pane { order: 3; width: 100%; height: 320px; }
}

.builder-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: white;
    border-bottom: 1px solid #ddd;
}

.builder-actions,
.builder-save {
    display: flex;
    gap: 10px;
    align-items: center;
}

.builder-title {
    flex: 1;
    text-align: center;
}

.builder-title input {
    font-size: 1.2rem;
    font-weight: bold;
    text-align: center;
    border: 1px solid transparent;
    padding: 5px 10px;
    border-radius: 4px;
}

.builder-title input:hover {
    border-color: #ddd;
}

.status-badge {
    padding: 5px 15px;
    border-radius: 20px;
    background: #6c757d;
    color: white;
    font-size: 0.85rem;
}

.builder-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.component-palette {
    width: 250px;
    background: white;
    border-right: 1px solid #ddd;
    padding: 20px;
    overflow-y: auto;
}

.component-category {
    margin-bottom: 2rem;
}

.component-category h4 {
    font-size: 0.9rem;
    text-transform: uppercase;
    color: #666;
    margin-bottom: 10px;
}

.component-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.component-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: grab;
    transition: all 0.2s;
}

.component-item:hover {
    border-color: var(--brand-primary);
    background: #f8f8f8;
}

.component-item:active {
    cursor: grabbing;
}

.section-editor {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.section-item {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.section-item.dragging {
    opacity: 0.6;
    transform: scale(0.995);
    box-shadow: 0 6px 14px rgba(0,0,0,0.12);
}

.drag-handle {
    cursor: grab;
    padding: 6px 8px;
    border-radius: 4px;
    background: #f6f8fa;
    margin-right: 8px;
    display: inline-flex;
    align-items: center;
}

.section-header .left {
    display:flex; align-items:center; gap:8px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.section-actions {
    display: flex;
    gap: 5px;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: #666;
}

.preview-pane {
    width: 50%;
    padding: 20px;
    background: #e0e0e0;
}

/* Modal used across builder and pages list */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
    z-index: 10000;
}
.modal > div {
    background: #fff;
    width: 92%;
    max-width: 920px;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}

/* Small button variants for compact UI */
.btn-sm { padding: 6px 10px; font-size: 0.85rem; border-radius: 6px; }

/* Table action spacing */
.table .btn { margin-right: 6px; }
.table .btn:last-child { margin-right: 0; }

/* Media picker items */
.media-picker-item img { display:block; }

/* Improve form control spacing inside builder */
.page-builder .form-group { margin-bottom: 12px; }
.page-builder .form-group label { font-size: 0.9rem; margin-bottom: 6px; }

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    font-size: 0.9rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.code-editor {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}
