/* ==========================================================================
   Ubay.shop — Elementor-Style Visual Drag & Drop Page Builder Styles
   ========================================================================== */

.bld-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: #E2E8F0;
}

/* Top Builder Toolbar */
.bld-topbar {
  height: 58px;
  background: var(--ub-navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
  z-index: 30;
}

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

.bld-brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 0.94rem;
  padding-right: 10px;
  border-right: 1px solid rgba(255, 255, 255, 0.16);
}
.bld-brand-badge span { color: #60A5FA; }

.bld-device-group {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.08);
  padding: 3px;
  border-radius: 10px;
  gap: 3px;
}
.bld-device-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: #CBD5E1;
  font-size: 0.78rem;
  font-weight: 600;
}
.bld-device-btn.active {
  background: var(--ub-primary);
  color: #fff;
}

.bld-status-pill {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #93C5FD;
}
.bld-status-pill.dirty { background: rgba(245, 158, 11, 0.22); color: #FCD34D; }
.bld-status-pill.published { background: rgba(34, 197, 94, 0.22); color: #86EFAC; }

/* Main Workspace */
.bld-workspace {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Left Elementor Inspector Panel */
.bld-sidebar {
  width: 348px;
  background: #fff;
  border-right: 1px solid var(--ub-gray-200);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 4px 0 18px rgba(15, 23, 42, 0.05);
  z-index: 20;
}

.bld-sidebar-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--ub-gray-200);
  background: var(--ub-gray-50);
}
.bld-sidebar-tab {
  padding: 12px 8px;
  border: none;
  background: transparent;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ub-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-bottom: 2.5px solid transparent;
}
.bld-sidebar-tab.active {
  color: var(--ub-primary);
  background: #fff;
  border-bottom-color: var(--ub-primary);
}

.bld-sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

/* Inspector Subtabs (Content / Style / Responsive) */
.bld-subtabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--ub-gray-100);
  padding: 4px;
  border-radius: 10px;
  margin-bottom: 16px;
  gap: 4px;
}
.bld-subtab {
  padding: 7px 6px;
  border: none;
  border-radius: 7px;
  background: transparent;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--ub-slate);
}
.bld-subtab.active {
  background: #fff;
  color: var(--ub-primary);
  box-shadow: var(--shadow-xs);
}

/* Add Elements Grid */
.bld-elements-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}
.bld-element-tile {
  background: var(--ub-gray-50);
  border: 1.5px solid var(--ub-gray-200);
  border-radius: 12px;
  padding: 13px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  text-align: center;
  cursor: grab;
  transition: all 0.15s;
}
.bld-element-tile:hover {
  border-color: var(--ub-primary);
  background: var(--ub-primary-soft);
  color: var(--ub-primary);
  transform: translateY(-1px);
}
.bld-element-tile span {
  font-size: 0.76rem;
  font-weight: 700;
}

/* Structure Navigator */
.bld-nav-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.bld-nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1.5px solid var(--ub-gray-200);
  background: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s;
}
.bld-nav-item.selected {
  border-color: var(--ub-primary);
  background: var(--ub-primary-soft);
  color: var(--ub-primary);
}
.bld-nav-item.drag-over {
  border-top: 3px solid var(--ub-primary);
}
.bld-nav-item .nav-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bld-nav-actions { display: flex; gap: 3px; }
.bld-nav-actions button {
  border: none;
  background: transparent;
  padding: 4px;
  border-radius: 6px;
  color: var(--ub-muted);
}
.bld-nav-actions button:hover { background: var(--ub-gray-100); color: var(--ub-navy); }

/* Template Cards */
.bld-template-card {
  border: 1.5px solid var(--ub-gray-200);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 14px;
  background: #fff;
  transition: all 0.16s;
}
.bld-template-card:hover {
  border-color: var(--ub-primary);
  box-shadow: var(--shadow-sm);
}
.bld-template-swatch-bar {
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  color: #fff;
  font-weight: 800;
  font-size: 0.86rem;
}
.bld-template-body {
  padding: 12px 14px;
}
.bld-template-body p {
  margin: 0 0 10px;
  font-size: 0.78rem;
  color: var(--ub-muted);
}

/* Inspector Controls */
.bld-group-title {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ub-muted);
  margin: 14px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--ub-gray-200);
}
.bld-color-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.bld-color-row input[type="color"] {
  width: 38px;
  height: 36px;
  padding: 2px;
  border: 1.5px solid var(--ub-gray-300);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}
.bld-spacing-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

/* Center Live Canvas Stage */
.bld-stage {
  flex: 1;
  overflow: auto;
  padding: 24px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background:
    radial-gradient(#CBD5E1 1px, transparent 1px) 0 0 / 20px 20px,
    #E2E8F0;
}

.bld-canvas-frame {
  width: 100%;
  max-width: 1280px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.16);
  overflow: hidden;
  transition: width 0.25s ease, max-width 0.25s ease;
  min-height: 80vh;
}
.bld-canvas-frame.builder-preview-tablet {
  width: 768px;
  max-width: 768px;
  border: 8px solid #1E293B;
  border-radius: 26px;
}
.bld-canvas-frame.builder-preview-mobile {
  width: 390px;
  max-width: 390px;
  border: 10px solid #0F172A;
  border-radius: 34px;
}

/* Selectable / Draggable Canvas Section Wrapper */
.bld-sec-wrap {
  position: relative;
  transition: outline 0.12s ease;
}
.bld-sec-wrap:hover {
  outline: 2px dashed #3B82F6;
  outline-offset: -2px;
}
.bld-sec-wrap.is-selected {
  outline: 2.5px solid #1D4ED8;
  outline-offset: -2px;
  z-index: 5;
}
.bld-sec-wrap.drag-target-top::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: #1D4ED8;
  z-index: 25;
}

.bld-sec-toolbar {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: none;
  align-items: center;
  gap: 2px;
  background: #1D4ED8;
  color: #fff;
  padding: 3px 6px;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(29, 78, 216, 0.35);
  font-size: 0.72rem;
  font-weight: 700;
}
.bld-sec-wrap:hover > .bld-sec-toolbar,
.bld-sec-wrap.is-selected > .bld-sec-toolbar {
  display: inline-flex;
}

.bld-sec-toolbar .drag-handle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  cursor: grab;
  border-right: 1px solid rgba(255, 255, 255, 0.25);
  margin-right: 3px;
}
.bld-sec-toolbar button {
  border: none;
  background: transparent;
  color: #fff;
  padding: 4px 5px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
}
.bld-sec-toolbar button:hover { background: rgba(255, 255, 255, 0.2); }

@media (max-width: 1180px) {
  .bld-topbar { padding: 0 10px; gap: 6px; }
  .bld-topbar-center .bld-device-btn span { display: none; }
  .bld-status-pill { display: none; }
}
@media (max-width: 960px) {
  .bld-sidebar { width: 290px; }
}
