/* ==========================================================================
   DBC Associate — Visual Builder & Live Redesign Studio CSS
   Inline Content Editing, Theme Switching, Device Preview & Section Reordering
   ========================================================================== */

/* ── Floating Studio Dock Toolbar (Docked at Bottom to Avoid Occluding Top Nav) ── */
.builder-toolbar {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(22, 22, 24, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 0.45rem 0.85rem;
  border-radius: 9999px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  color: #f4f4f5;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.8rem;
  user-select: none;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.builder-toolbar.collapsed {
  transform: translateX(-50%) translateY(140%);
}

.toolbar-brand {
  font-weight: 700;
  letter-spacing: 0.1em;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: #facc15;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.5rem;
  border-right: 1px solid rgba(255, 255, 255, 0.18);
}

.toolbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  color: #e4e4e7;
  font-size: 0.76rem;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
  border: 1px solid transparent;
}

.toolbar-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.toolbar-btn.active {
  background: #2563eb;
  color: #ffffff;
  border-color: #3b82f6;
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.5);
}

.toolbar-btn-save {
  background: #15803d;
  color: #ffffff;
  font-weight: 600;
}

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

.toolbar-toggle-handle {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  background: rgba(22, 22, 24, 0.92);
  color: #facc15;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 9999px;
  padding: 0.45rem 0.95rem;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  backdrop-filter: blur(10px);
}

/* ── Inline Content Editing States ── */
body.edit-mode-active [data-editable="true"] {
  outline: 1.5px dashed rgba(37, 99, 235, 0.45);
  outline-offset: 3px;
  cursor: text;
  transition: outline 0.2s ease, background-color 0.2s ease;
  border-radius: 3px;
}

body.edit-mode-active [data-editable="true"]:hover {
  outline: 2px solid #2563eb;
  background-color: rgba(37, 99, 235, 0.06);
}

body.edit-mode-active [data-editable="true"]:focus {
  outline: 2px solid #2563eb;
  background-color: rgba(37, 99, 235, 0.1);
}

body.edit-mode-active img[data-editable-img="true"] {
  cursor: pointer;
  position: relative;
  outline: 2px dashed rgba(245, 158, 11, 0.6);
  outline-offset: 2px;
}

body.edit-mode-active img[data-editable-img="true"]:hover {
  outline: 3px solid #f59e0b;
}

/* ── Live Formatting Bubble ── */
.editor-bubble-toolbar {
  position: absolute;
  z-index: 10001;
  display: none;
  background: #18181b;
  color: #ffffff;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
  font-size: 0.8rem;
  gap: 0.25rem;
  align-items: center;
}

.bubble-btn {
  padding: 0.25rem 0.5rem;
  color: #d4d4d8;
  border-radius: 4px;
}

.bubble-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* ── Redesign Studio Drawer / Modal ── */
.redesign-modal {
  position: fixed;
  top: 0;
  right: 0;
  width: 24rem;
  max-width: 90vw;
  height: 100vh;
  background: #ffffff;
  color: #18181b;
  z-index: 10002;
  box-shadow: -10px 0 35px rgba(0, 0, 0, 0.15);
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.redesign-modal.open {
  transform: translateX(0);
}

.redesign-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #e4e4e7;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.redesign-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #09090b;
}

.redesign-close {
  font-size: 1.4rem;
  color: #71717a;
  cursor: pointer;
  padding: 0.25rem;
}

.redesign-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.redesign-group {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.redesign-group-title {
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #71717a;
}

.theme-preset-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border: 1px solid #e4e4e7;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.theme-preset-card:hover {
  border-color: #2563eb;
  background: #f8fafc;
}

.theme-preset-card.active {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.theme-color-swatches {
  display: flex;
  gap: 0.35rem;
}

.theme-swatch {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.1);
}

.color-picker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid #f4f4f5;
  font-size: 0.88rem;
}

.color-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.color-input-wrap input[type="color"] {
  -webkit-appearance: none;
  border: none;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  cursor: pointer;
  background: none;
}

.color-input-wrap input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-input-wrap input[type="color"]::-webkit-color-swatch {
  border: 1px solid rgba(0,0,0,0.2);
  border-radius: 50%;
}

/* ── Device Simulation Frame ── */
.preview-device-wrapper {
  transition: max-width 0.4s cubic-bezier(0.16, 1, 0.3, 1), margin 0.4s ease, box-shadow 0.4s ease;
  width: 100%;
}

.device-tablet .preview-device-wrapper {
  max-width: 768px;
  margin: 4.5rem auto 3rem;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
  border-radius: 20px;
  overflow: hidden;
  border: 12px solid #27272a;
}

.device-mobile .preview-device-wrapper {
  max-width: 390px;
  margin: 4.5rem auto 3rem;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
  border-radius: 36px;
  overflow: hidden;
  border: 12px solid #27272a;
}

/* ── Toast Notifications ── */
.builder-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  z-index: 10005;
  background: #18181b;
  color: #ffffff;
  padding: 0.75rem 1.5rem;
  border-radius: 9999px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.builder-toast.show {
  transform: translateX(-50%) translateY(0);
}
