
dialog#dnx-palette-dialog[open],
dialog#dnx-analytics-dialog[open],
dialog#dnx-b2b-palette-dialog[open],
dialog#dnx-b2b-analytics-dialog[open],
dialog.dnx-crop-dialog[open] {
  display: flex !important;
}
/**
 * Daynex Site Editor Enhancements (E-Commerce & B2B)
 * Unified suite for Color Palettes, Image Cropper, Rich Text, Product Layouts, Split Sliders, Maps, and Analytics.
 */

/* 1. PALETTE & COLOR PICKER */
.dnx-palette-manager {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--surface, #ffffff);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}
.dnx-palette-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.dnx-palette-header h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
}
.dnx-preset-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
@media (max-width: 600px) {
  .dnx-preset-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
.dnx-preset-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  color: #334155;
  transition: all 0.15s ease;
  text-align: left;
}
.dnx-preset-btn:hover {
  border-color: #3b82f6;
  background: #f8fafc;
}
.dnx-preset-btn.active {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}
.dnx-preset-dots {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}
.dnx-preset-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.1);
}
.dnx-variant-toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.dnx-variant-btn {
  flex: 1;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
}
.dnx-variant-btn.active {
  background: #1e293b;
  color: #ffffff;
  border-color: #1e293b;
}

/* Color Variables Grid */
.dnx-color-vars-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 6px;
}
.dnx-color-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dnx-color-item label {
  font-size: 10.5px;
  font-weight: 600;
  color: #64748b;
}
.dnx-color-input-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 3px 6px;
  background: #ffffff;
}
.dnx-color-input-wrap input[type="color"] {
  -webkit-appearance: none;
  border: 0;
  width: 26px;
  height: 24px;
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
  background: transparent;
}
.dnx-color-input-wrap input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}
.dnx-color-input-wrap input[type="color"]::-webkit-color-swatch {
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 4px;
}
.dnx-color-input-wrap input[type="text"] {
  flex: 1;
  border: 0;
  font-size: 11px;
  font-family: monospace;
  color: #1e293b;
  min-width: 0;
  outline: none;
  text-transform: uppercase;
}

/* Section Specific Color Override Toggle */
.dnx-section-color-override {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-top: 8px;
}

/* 2. RICH TEXT TOOLBAR */
.dnx-rich-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-bottom: 0;
  border-top-left-radius: 8px;
  border-top-right-left: 8px;
}
.dnx-rich-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: #ffffff;
  color: #334155;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.dnx-rich-btn:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
}
.dnx-rich-btn.active {
  background: #2563eb;
  color: #ffffff;
}
.dnx-rich-content {
  min-height: 120px;
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid #cbd5e1;
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
  padding: 12px;
  background: #ffffff;
  font-size: 13px;
  line-height: 1.6;
  outline: none;
}
.dnx-rich-content:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

/* 3. SMART IMAGE CROPPER MODAL */
.dnx-crop-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.dnx-crop-dialog {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: 90vh;
}
.dnx-crop-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid #e2e8f0;
}
.dnx-crop-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}
.dnx-crop-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}
.dnx-crop-canvas-wrap {
  width: 100%;
  height: 300px;
  background: #0f172a;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  cursor: grab;
}
.dnx-crop-canvas-wrap:active {
  cursor: grabbing;
}
.dnx-crop-canvas-wrap canvas {
  max-width: 100%;
  max-height: 100%;
}
.dnx-crop-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dnx-crop-ratio-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.dnx-crop-ratio-btn {
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  cursor: pointer;
}
.dnx-crop-ratio-btn.active {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
}
.dnx-crop-zoom-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.dnx-crop-zoom-row span {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  min-width: 60px;
}
.dnx-crop-zoom-row input[type="range"] {
  flex: 1;
}
.dnx-crop-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}

/* 4. PRODUCT BLOCK DISPLAY SETTINGS */
.dnx-product-view-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 8px 0 14px;
}
.dnx-view-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
  text-align: center;
}
.dnx-view-option svg {
  width: 24px;
  height: 24px;
  color: #64748b;
}
.dnx-view-option span {
  font-size: 11px;
  font-weight: 600;
  color: #334155;
}
.dnx-view-option.active {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}
.dnx-view-option.active svg,
.dnx-view-option.active span {
  color: #2563eb;
}

/* 5. MULTI & SPLIT SLIDER CONFIG */
.dnx-slider-layout-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.dnx-layout-card {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
  text-align: center;
  background: #ffffff;
}
.dnx-layout-card.active {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
}
.dnx-layout-preview-single {
  height: 28px;
  background: #bfdbfe;
  border-radius: 4px;
  margin-bottom: 6px;
}
.dnx-layout-preview-split-left {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 4px;
  height: 28px;
  margin-bottom: 6px;
}
.dnx-layout-preview-split-left span:first-child {
  background: #bfdbfe;
  border-radius: 4px;
}
.dnx-layout-preview-split-left span:last-child {
  background: #93c5fd;
  border-radius: 4px;
}
.dnx-layout-preview-split-right {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 4px;
  height: 28px;
  margin-bottom: 6px;
}
.dnx-layout-preview-split-right span:first-child {
  background: #93c5fd;
  border-radius: 4px;
}
.dnx-layout-preview-split-right span:last-child {
  background: #bfdbfe;
  border-radius: 4px;
}

.dnx-slides-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.dnx-slide-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
}
.dnx-slide-thumb {
  width: 44px;
  height: 32px;
  border-radius: 4px;
  object-fit: cover;
  background: #f1f5f9;
}

/* 6. GOOGLE MAPS VALIDATOR & PREVIEW */
.dnx-map-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
}
.dnx-map-preview-wrap {
  width: 100%;
  height: 180px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  background: #ffffff;
}
.dnx-map-preview-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
}
.dnx-map-status {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
}
.dnx-map-status.valid {
  background: #dcfce7;
  color: #15803d;
}
.dnx-map-status.invalid {
  background: #fee2e2;
  color: #b91c1c;
}

/* 7. SOCIAL CHANNELS MATRIX */
.dnx-social-matrix {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
  margin-top: 6px;
}
.dnx-social-matrix th,
.dnx-social-matrix td {
  padding: 8px 6px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}
.dnx-social-matrix th {
  font-weight: 700;
  color: #475569;
  background: #f8fafc;
}
.dnx-social-matrix input[type="text"] {
  width: 100%;
  padding: 4px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 11px;
}

/* 8. MINI SITE ANALYTICS PANEL */
.dnx-analytics-panel {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}
.dnx-analytics-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 12px 0 16px;
}
@media (max-width: 768px) {
  .dnx-analytics-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
.dnx-kpi-card {
  padding: 10px 12px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}
.dnx-kpi-card small {
  display: block;
  font-size: 10px;
  color: #64748b;
  margin-bottom: 2px;
}
.dnx-kpi-card strong {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}
.dnx-traffic-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dnx-traffic-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
}
.dnx-traffic-label {
  width: 120px;
  color: #334155;
  font-weight: 500;
}
.dnx-traffic-bar-bg {
  flex: 1;
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}
.dnx-traffic-bar-fill {
  height: 100%;
  background: #3b82f6;
  border-radius: 4px;
}
.dnx-traffic-val {
  width: 40px;
  text-align: right;
  color: #64748b;
  font-weight: 600;
}

.site-preview-window.tablet {
  max-width: 768px !important;
  margin: 0 auto;
}

/* Ergonomic Button Loading States & Mobile 390 Refinements */
button.is-loading, .btn.is-loading, [data-loading="true"] {
  position: relative !important;
  pointer-events: none !important;
  opacity: 0.8 !important;
}
button.is-loading::after, .btn.is-loading::after, [data-loading="true"]::after {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 8px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -2px;
  animation: dnx-btn-spin 0.65s linear infinite;
}
@keyframes dnx-btn-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 480px) {
  .metric-strip {
    grid-template-columns: 1fr !important;
  }
  .page-head {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
  }
  .heading-actions {
    width: 100% !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
}

