/* Finepedia Elementor-style Page Builder */
:root {
    --fpb-teal: #33b5b5;
    --fpb-teal-dark: #2aa8a8;
    --fpb-panel-bg: #1a2e35;
    --fpb-panel-text: #c8e0e0;
    --fpb-canvas-bg: #e8eaed;
    --fpb-header-h: 52px;
    --fpb-left-w: 280px;
    --fpb-right-w: 300px;
}

* { box-sizing: border-box; }
body.fpb-body { margin: 0; font-family: "Titillium Web", Titillium, Arial, sans-serif; overflow: hidden; height: 100vh; }

.fpb-app { display: flex; flex-direction: column; height: 100vh; }

/* Toolbar */
.fpb-toolbar {
    height: var(--fpb-header-h);
    background: var(--fpb-panel-bg);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    flex-shrink: 0;
    z-index: 100;
}
.fpb-toolbar a { color: #ccc; text-decoration: none; font-size: 0.85rem; }
.fpb-toolbar a:hover { color: #fff; }
.fpb-toolbar-title { font-weight: 700; margin-left: 16px; }
.fpb-toolbar-actions { display: flex; gap: 8px; align-items: center; }
.fpb-btn {
    border: none; border-radius: 6px; padding: 8px 16px; font-size: 0.85rem;
    font-weight: 600; cursor: pointer; font-family: inherit;
}
.fpb-btn-ghost { background: rgba(255,255,255,0.1); color: #fff; }
.fpb-btn-ghost:hover { background: rgba(255,255,255,0.18); }
.fpb-btn-primary { background: var(--fpb-teal); color: #fff; }
.fpb-btn-primary:hover { background: var(--fpb-teal-dark); }
.fpb-device-btns { display: flex; gap: 4px; }
.fpb-device-btn {
    background: transparent; border: 1px solid rgba(255,255,255,0.2); color: #ccc;
    padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 0.8rem;
}
.fpb-device-btn.active { background: var(--fpb-teal); border-color: var(--fpb-teal); color: #fff; }

/* Workspace */
.fpb-workspace { display: flex; flex: 1; min-height: 0; }

/* Left panel */
.fpb-panel-left {
    width: var(--fpb-left-w); background: var(--fpb-panel-bg); color: var(--fpb-panel-text);
    display: flex; flex-direction: column; flex-shrink: 0; border-right: 1px solid rgba(255,255,255,0.08);
}
.fpb-panel-tabs { display: flex; border-bottom: 1px solid rgba(255,255,255,0.1); }
.fpb-panel-tab {
    flex: 1; padding: 12px 8px; text-align: center; font-size: 0.75rem; font-weight: 600;
    background: transparent; border: none; color: #888; cursor: pointer; text-transform: uppercase;
}
.fpb-panel-tab.active { color: var(--fpb-teal); border-bottom: 2px solid var(--fpb-teal); }
.fpb-panel-content { flex: 1; overflow-y: auto; padding: 12px; }
.fpb-panel-content::-webkit-scrollbar { width: 4px; }
.fpb-panel-content::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }

.fpb-widget-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fpb-widget-item, .fpb-preset-item, .fpb-template-item {
    background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px; padding: 12px 8px; text-align: center; cursor: grab;
    font-size: 0.75rem; transition: background 0.15s, border-color 0.15s;
}
.fpb-widget-item:hover, .fpb-preset-item:hover, .fpb-template-item:hover {
    background: rgba(51,181,181,0.15); border-color: var(--fpb-teal);
}
.fpb-widget-item i, .fpb-preset-item i { display: block; font-size: 1.4rem; margin-bottom: 6px; color: var(--fpb-teal); }
.fpb-cat-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: #888; margin: 12px 0 8px; font-weight: 700; }

/* Canvas */
.fpb-canvas-wrap {
    flex: 1; background: var(--fpb-canvas-bg); overflow-y: auto; padding: 24px;
    display: flex; justify-content: center;
}
.fpb-canvas {
    background: #fff; width: 100%; max-width: 1140px; min-height: 600px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.1); transition: max-width 0.3s;
}
.fpb-canvas.device-tablet { max-width: 768px; }
.fpb-canvas.device-mobile { max-width: 375px; }

/* Builder elements on canvas */
.fpb-el-section {
    position: relative; border: 2px solid transparent; min-height: 40px;
    transition: border-color 0.15s;
}
.fpb-el-section:hover { border-color: rgba(51,181,181,0.4); }
.fpb-el-section.selected { border-color: var(--fpb-teal); }
.fpb-el-section .fpb-el-label {
    position: absolute; top: 0; left: 0; background: var(--fpb-teal); color: #fff;
    font-size: 0.65rem; padding: 2px 8px; font-weight: 700; text-transform: uppercase;
    opacity: 0; pointer-events: none; z-index: 5;
}
.fpb-el-section:hover .fpb-el-label, .fpb-el-section.selected .fpb-el-label { opacity: 1; }

.fpb-el-row { display: flex; flex-wrap: wrap; margin: 0 -10px; }
.fpb-el-col {
    padding: 10px; position: relative; border: 1px dashed transparent; min-height: 50px;
}
.fpb-el-col:hover { border-color: rgba(51,181,181,0.3); }
.fpb-el-col.selected { border-color: var(--fpb-teal); background: rgba(51,181,181,0.04); }
.fpb-el-col.empty::after {
    content: 'Drop widget here'; display: block; text-align: center; color: #bbb;
    font-size: 0.8rem; padding: 20px; font-style: italic;
}

.fpb-el-widget {
    position: relative; padding: 8px; border: 1px solid transparent; cursor: pointer;
    border-radius: 4px;
}
.fpb-el-widget:hover { border-color: rgba(51,181,181,0.4); }
.fpb-el-widget.selected { border-color: var(--fpb-teal); box-shadow: 0 0 0 1px var(--fpb-teal); }

.fpb-section-actions {
    position: absolute; top: 4px; right: 4px; display: none; gap: 4px; z-index: 10;
}
.fpb-el-section:hover .fpb-section-actions, .fpb-el-section.selected .fpb-section-actions { display: flex; }
.fpb-section-actions button {
    background: var(--fpb-panel-bg); color: #fff; border: none; border-radius: 4px;
    width: 28px; height: 28px; cursor: pointer; font-size: 0.85rem;
}
.fpb-section-actions button:hover { background: var(--fpb-teal); }

.fpb-add-section-btn {
    display: block; width: 100%; margin-top: 16px; padding: 14px;
    border: 2px dashed #ccc; background: transparent; border-radius: 8px;
    color: #888; cursor: pointer; font-size: 0.9rem; font-weight: 600;
}
.fpb-add-section-btn:hover { border-color: var(--fpb-teal); color: var(--fpb-teal); }

/* Right panel */
.fpb-panel-right {
    width: var(--fpb-right-w); background: #fff; border-left: 1px solid #e8eaed;
    display: flex; flex-direction: column; flex-shrink: 0; overflow-y: auto;
}
.fpb-panel-right-header {
    padding: 14px 16px; border-bottom: 1px solid #eee; font-weight: 700;
    font-size: 0.9rem; background: #fafafa;
}
.fpb-panel-right-body { padding: 16px; flex: 1; }
.fpb-control { margin-bottom: 14px; }
.fpb-control label { display: block; font-size: 0.8rem; font-weight: 600; color: #555; margin-bottom: 4px; }
.fpb-control input, .fpb-control select, .fpb-control textarea {
    width: 100%; padding: 8px 10px; border: 1px solid #ddd; border-radius: 6px;
    font-size: 0.85rem; font-family: inherit;
}
.fpb-control input:focus, .fpb-control select:focus, .fpb-control textarea:focus {
    outline: none; border-color: var(--fpb-teal); box-shadow: 0 0 0 2px rgba(51,181,181,0.15);
}
.fpb-empty-settings { color: #999; font-size: 0.85rem; text-align: center; padding: 40px 16px; }

/* Sortable */
.sortable-ghost { opacity: 0.4; }
.sortable-drag { opacity: 0.85; }

/* Toast */
.fpb-toast {
    position: fixed; bottom: 24px; right: 24px; background: var(--fpb-panel-bg); color: #fff;
    padding: 12px 20px; border-radius: 8px; font-size: 0.85rem; z-index: 9999;
    transform: translateY(100px); opacity: 0; transition: all 0.3s;
}
.fpb-toast.show { transform: translateY(0); opacity: 1; }

/* Frontend rendered builder */
.fp-builder-boxed { max-width: 1140px; margin: 0 auto; padding: 0 15px; }
.fp-builder-full { width: 100%; }
.fp-builder-row { display: flex; flex-wrap: wrap; margin: 0 -10px; }
.fp-builder-col { padding: 10px; box-sizing: border-box; }
.fp-builder-section { width: 100%; }

@media (max-width: 768px) {
    .fpb-panel-left, .fpb-panel-right { display: none; }
    .fpb-canvas-wrap { padding: 8px; }
    .fp-builder-row { flex-direction: column; }
    .fp-builder-col { flex: 0 0 100% !important; max-width: 100% !important; }
    .fp-posts-grid { grid-template-columns: 1fr !important; }
}
