/* Meritcom Universal Drag & Drop Section & Block Builder v10.0.0 */
:root {
  --msb-blue: #2563EB;
  --msb-purple: #7C3AED;
  --msb-dark: #0F172A;
  --msb-panel: #1E293B;
  --msb-border: rgba(148, 163, 184, 0.35);
}

.msb-top-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 54px;
  background: linear-gradient(90deg, #090D16 0%, #172554 50%, #1E1B4B 100%);
  border-bottom: 1px solid var(--msb-border);
  color: #F8FAFC;
  z-index: 2147483640;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  font-family: 'Noto Serif Bengali', Arial, sans-serif;
}
body.msb-studio-active { padding-top: 54px !important; }

.msb-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; }
.msb-pulse { width: 10px; height: 10px; border-radius: 50%; background: #22C55E; box-shadow: 0 0 10px #22C55E; }

.msb-center-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.msb-tool-btn {
  background: rgba(30, 41, 59, 0.95);
  color: #E2E8F0;
  border: 1px solid var(--msb-border);
  padding: 6px 11px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.msb-tool-btn.active, .msb-tool-btn:hover { background: var(--msb-blue); color: #FFFFFF; border-color: var(--msb-blue); }
.msb-btn-add { background: linear-gradient(135deg, #F59E0B, #D97706); color: #0F172A; border: none; font-weight: 700; }
.msb-btn-save { background: linear-gradient(135deg, #10B981, #059669); color: #FFFFFF; border: none; font-weight: 700; }
.msb-btn-exit { background: rgba(239, 68, 68, 0.25); color: #FCA5A5; border: 1px solid rgba(239, 68, 68, 0.5); }

body.msb-preview-tablet .pa-wrap, body.msb-preview-tablet .pa-ad-1280x50-wrap { max-width: 820px !important; }
body.msb-preview-mobile .pa-wrap, body.msb-preview-mobile .pa-ad-1280x50-wrap { max-width: 420px !important; }

.msb-editable-section {
  position: relative !important;
  transition: outline 0.15s ease, box-shadow 0.15s ease;
}
body.msb-studio-active .msb-editable-section {
  outline: 2px dashed #2563EB !important;
  outline-offset: 4px;
  overflow: visible !important;
  min-height: 44px;
}
body.msb-studio-active .msb-editable-section:hover {
  outline: 2px solid #7C3AED !important;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.14);
}

.msb-draggable-card { position: relative !important; }
body.msb-studio-active .msb-draggable-card {
  outline: 1.5px dotted rgba(124, 58, 237, 0.65);
  outline-offset: 2px;
}
.msb-dragging { opacity: 0.45 !important; transform: scale(0.985); }
.msb-drag-over { outline: 3px solid #10B981 !important; box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.22) !important; }

body.msb-studio-active [contenteditable="true"] {
  cursor: text !important;
  border-radius: 4px;
  padding: 2px 5px;
  background: rgba(255, 214, 10, 0.15);
  outline: 1px dashed rgba(245, 158, 11, 0.75);
}
body.msb-studio-active [contenteditable="true"]:focus {
  background: rgba(255, 214, 10, 0.32);
  outline: 2px solid #F59E0B;
}
body.msb-studio-active .msb-editable-section img {
  cursor: pointer !important;
  outline: 2px solid transparent;
}
body.msb-studio-active .msb-editable-section img:hover {
  outline: 2px solid #10B981 !important;
}

.msb-sec-toolbar {
  display: none;
  position: absolute;
  top: -16px;
  right: 8px;
  z-index: 2147483630;
  background: linear-gradient(135deg, #0F172A, #1E293B);
  color: #FFFFFF;
  border: 1.5px solid #60A5FA;
  border-radius: 22px;
  padding: 3px 8px;
  gap: 5px;
  align-items: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  pointer-events: auto !important;
}
body.msb-studio-active .msb-sec-toolbar { display: inline-flex !important; }

.msb-drag-handle {
  cursor: grab;
  padding: 2px 7px;
  font-size: 12px;
  font-weight: 700;
  color: #FCD34D;
  user-select: none;
}
.msb-drag-handle:active { cursor: grabbing; }

.msb-mini-btn {
  background: rgba(255, 255, 255, 0.14);
  color: #FFFFFF;
  border: none;
  padding: 4px 9px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  pointer-events: auto !important;
}
.msb-mini-btn:hover { background: #2563EB; }
.msb-mini-btn.cat-btn { background: #059669; color: #FFFFFF; }
.msb-mini-btn.cat-btn:hover { background: #047857; }
.msb-mini-btn.add-btn { background: #D97706; color: #FFFFFF; }
.msb-mini-btn.danger:hover { background: #DC2626; }

.msb-cat-pill {
  background: rgba(16, 185, 129, 0.25);
  color: #6EE7B7;
  border: 1px solid rgba(16, 185, 129, 0.5);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 700;
}

.msb-inplace-popover {
  position: fixed;
  top: 70px;
  right: 20px;
  width: 390px;
  max-width: 94vw;
  max-height: calc(100vh - 90px);
  background: rgba(15, 23, 42, 0.98);
  color: #F8FAFC;
  border: 1.5px solid #60A5FA;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65);
  z-index: 2147483645;
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Noto Serif Bengali', Arial, sans-serif;
}
.msb-inplace-popover.open { display: flex !important; }

.msb-pop-head {
  background: linear-gradient(135deg, #2563EB, #7C3AED);
  padding: 12px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.msb-pop-head h4 { font-size: 14px; font-weight: 700; color: #FFFFFF; }

.msb-pop-body {
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.msb-field label { display: block; font-size: 12px; font-weight: 600; color: #93C5FD; margin-bottom: 4px; }
.msb-field input, .msb-field textarea, .msb-field select {
  width: 100%;
  background: #1E293B;
  color: #FFFFFF;
  border: 1px solid #475569;
  border-radius: 7px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
}
.msb-field input[type="color"] { height: 36px; padding: 2px; cursor: pointer; }

.msb-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.78);
  backdrop-filter: blur(6px);
  z-index: 2147483646;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.msb-modal-backdrop.open { display: flex !important; }

.msb-modal-card {
  background: #0F172A;
  color: #F8FAFC;
  border: 1.5px solid #60A5FA;
  border-radius: 14px;
  width: 600px;
  max-width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7);
  font-family: 'Noto Serif Bengali', Arial, sans-serif;
}
.msb-widget-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 14px 0;
}
@media (max-width: 560px) { .msb-widget-grid { grid-template-columns: repeat(2, 1fr); } }

.msb-widget-tile {
  background: #1E293B;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 11px 6px;
  text-align: center;
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.msb-widget-tile:hover, .msb-widget-tile.selected {
  border-color: #3B82F6;
  background: rgba(37, 99, 235, 0.28);
}

.msb-custom-block-wrap {
  background: var(--pa-card-bg, #FFFFFF);
  border: 1px solid var(--pa-line, #E2E8F0);
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
}
.msb-video-embed {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: 8px;
}
.msb-video-embed iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; }

.msb-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #059669;
  color: #FFFFFF;
  padding: 10px 22px;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 700;
  z-index: 2147483647;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
}
.msb-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
