/* ═══════════════════════════════════════════════
   Section Block – Front-end Styles
   ═══════════════════════════════════════════════ */

.nx-section-block {
  position: relative;
  width: 100%;
  overflow: hidden;
}

/* Container width options */
.nx-section-container {
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--nx-spacing-md, 20px);
  padding-right: var(--nx-spacing-md, 20px);
}

.nx-section-full { width: 100%; }

.nx-section-narrow {
  width: 100%;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--nx-spacing-md, 20px);
  padding-right: var(--nx-spacing-md, 20px);
}

.nx-section-wide {
  width: 100%;
  max-width: 1600px;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--nx-spacing-md, 20px);
  padding-right: var(--nx-spacing-md, 20px);
}

.nx-section-custom {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--nx-spacing-md, 20px);
  padding-right: var(--nx-spacing-md, 20px);
}

/* Flex utilities */
.nx-section-container.nx-flex,
.nx-section-full.nx-flex,
.nx-section-narrow.nx-flex,
.nx-section-wide.nx-flex,
.nx-section-custom.nx-flex { display: flex !important; }

.nx-flex-row { flex-direction: row !important; }
.nx-flex-row-reverse { flex-direction: row-reverse !important; }
.nx-flex-column { flex-direction: column !important; }
.nx-flex-column-reverse { flex-direction: column-reverse !important; }

.nx-flex-nowrap { flex-wrap: nowrap !important; }
.nx-flex-wrap { flex-wrap: wrap !important; }
.nx-flex-wrap-reverse { flex-wrap: wrap-reverse !important; }

.nx-justify-start { justify-content: flex-start !important; }
.nx-justify-end { justify-content: flex-end !important; }
.nx-justify-center { justify-content: center !important; }
.nx-justify-between { justify-content: space-between !important; }
.nx-justify-around { justify-content: space-around !important; }
.nx-justify-evenly { justify-content: space-evenly !important; }

.nx-items-stretch { align-items: stretch !important; }
.nx-items-start { align-items: flex-start !important; }
.nx-items-end { align-items: flex-end !important; }
.nx-items-center { align-items: center !important; }
.nx-items-baseline { align-items: baseline !important; }

.nx-content-stretch { align-content: stretch !important; }
.nx-content-start { align-content: flex-start !important; }
.nx-content-end { align-content: flex-end !important; }
.nx-content-center { align-content: center !important; }
.nx-content-between { align-content: space-between !important; }
.nx-content-around { align-content: space-around !important; }

/* Background overlay */
.nx-section-block.has-background-overlay { position: relative; z-index: 1; }

.nx-section-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: -1;
}

/* Video background */
.nx-section-video {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  z-index: -2;
  pointer-events: none;
  will-change: transform;
  backface-visibility: hidden;
}

.nx-section-video.nx-video-lazy {
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}
.nx-section-video.nx-video-lazy[data-loaded="true"] { opacity: 1; }

.nx-section-block.has-background-overlay .nx-section-overlay { z-index: -1; }
.nx-section-block.has-background-overlay .nx-section-video { z-index: -2; }

.nx-section-block.has-background-overlay > .nx-section-container,
.nx-section-block.has-background-overlay > .nx-section-narrow,
.nx-section-block.has-background-overlay > .nx-section-wide,
.nx-section-block.has-background-overlay > .nx-section-full,
.nx-section-block.has-background-overlay > .nx-section-custom {
  position: relative;
  z-index: 2;
}

/* Divider */
.nx-section-divider {
  position: absolute;
  left: 0; width: 100%;
  overflow: hidden;
  line-height: 0;
  z-index: 1;
}
.nx-section-divider svg {
  position: relative;
  display: block;
  width: calc(100% + 1.3px);
}
.nx-section-divider-top { top: 0; }
.nx-section-divider-bottom { bottom: 0; }

/* Height utilities */
.nx-section-block[style*="height"] {
  display: flex;
  align-items: stretch;
}
.nx-section-block[style*="height"] > .nx-section-container,
.nx-section-block[style*="height"] > .nx-section-narrow,
.nx-section-block[style*="height"] > .nx-section-wide,
.nx-section-block[style*="height"] > .nx-section-full,
.nx-section-block[style*="height"] > .nx-section-custom {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
}

/* Position utilities */
.nx-position-static { position: static !important; }
.nx-position-relative { position: relative !important; }
.nx-position-absolute { position: absolute !important; }
.nx-position-fixed { position: fixed !important; }
.nx-position-sticky { position: sticky !important; }

.nx-overflow-visible { overflow: visible !important; }
.nx-overflow-hidden { overflow: hidden !important; }
.nx-overflow-scroll { overflow: scroll !important; }
.nx-overflow-auto { overflow: auto !important; }

/* Responsive */
@media (max-width: 1024px) {
  .nx-blocks-hidden-tablet { display: none !important; }
}

@media (max-width: 767px) {
  .nx-section-container,
  .nx-section-narrow,
  .nx-section-wide,
  .nx-section-custom {
    padding-left: var(--nx-spacing-sm, 10px);
    padding-right: var(--nx-spacing-sm, 10px);
  }
  .nx-blocks-hidden-mobile { display: none !important; }
  .nx-section-video { transform: scale(1.05); }
}

/* Responsive flex mobile */
@media (max-width: 768px) {
  .nx-mobile-flex-row { flex-direction: row !important; }
  .nx-mobile-flex-row-reverse { flex-direction: row-reverse !important; }
  .nx-mobile-flex-column { flex-direction: column !important; }
  .nx-mobile-flex-column-reverse { flex-direction: column-reverse !important; }
  .nx-mobile-justify-start { justify-content: flex-start !important; }
  .nx-mobile-justify-end { justify-content: flex-end !important; }
  .nx-mobile-justify-center { justify-content: center !important; }
  .nx-mobile-justify-between { justify-content: space-between !important; }
  .nx-mobile-justify-around { justify-content: space-around !important; }
  .nx-mobile-justify-evenly { justify-content: space-evenly !important; }
  .nx-mobile-items-stretch { align-items: stretch !important; }
  .nx-mobile-items-start { align-items: flex-start !important; }
  .nx-mobile-items-end { align-items: flex-end !important; }
  .nx-mobile-items-center { align-items: center !important; }
  .nx-mobile-items-baseline { align-items: baseline !important; }
}

@supports not (object-fit: cover) {
  .nx-section-video {
    position: absolute;
    top: 50%; left: 50%;
    min-width: 100%; min-height: 100%;
    width: auto; height: auto;
    transform: translate(-50%, -50%);
  }
}

/* ═══════════════════════════════════════════════
   Section Block – EDITOR UI Styles
   ═══════════════════════════════════════════════ */

/* Editor block wrapper */
.editor-styles-wrapper .nx-section-block-editor {
  position: relative;
  border: 2px dashed transparent;
  border-radius: 4px;
  min-height: 120px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.editor-styles-wrapper .nx-section-block-editor:hover {
  border-color: rgba(0, 124, 186, 0.3);
}
.editor-styles-wrapper .block-editor-block-list__block.is-selected .nx-section-block-editor {
  border-color: #007cba;
  box-shadow: 0 0 0 1px rgba(0, 124, 186, 0.15);
}
.editor-styles-wrapper .nx-section-block-editor .block-editor-inner-blocks {
  min-height: 80px;
}

/* ── Tab bar ── */
.nx-tab-bar {
  display: flex;
  gap: 0;
  background: #f0f0f0;
  border-radius: 6px;
  padding: 3px;
  margin: 0 0 12px 0;
}
.nx-tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 4px;
  border: none;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  color: #757575;
  font-size: 11px;
  font-weight: 500;
  transition: all 0.15s ease;
  line-height: 1;
}
.nx-tab-btn:hover {
  color: #1e1e1e;
  background: rgba(255, 255, 255, 0.5);
}
.nx-tab-btn.is-active {
  background: #fff;
  color: #007cba;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.nx-tab-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Sub tabs (for background) ── */
.nx-sub-tabs {
  display: flex;
  gap: 0;
  background: #f6f7f7;
  border-radius: 4px;
  padding: 2px;
  margin-bottom: 12px;
}
.nx-sub-tab {
  flex: 1;
  padding: 6px 8px;
  border: none;
  background: transparent;
  border-radius: 3px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  color: #757575;
  transition: all 0.15s ease;
}
.nx-sub-tab:hover {
  color: #1e1e1e;
}
.nx-sub-tab.is-active {
  background: #fff;
  color: #007cba;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* ── Device switcher ── */
.nx-device-switcher {
  display: flex;
  justify-content: center;
  gap: 4px;
  background: #f6f7f7;
  border-radius: 6px;
  padding: 3px;
  margin-bottom: 12px;
}
.nx-device-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  color: #757575;
  transition: all 0.15s ease;
}
.nx-device-btn:hover {
  background: rgba(255, 255, 255, 0.5);
  color: #1e1e1e;
}
.nx-device-btn.is-active {
  background: #fff;
  color: #007cba;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* ── Spacing box model (DevTools-style) ── */
.nx-spacing-box {
  position: relative;
  margin-bottom: 4px;
}
.nx-spacing-box-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #757575;
  margin-bottom: 8px;
}
.nx-spacing-box-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e8f0e8;
  border: 2px dashed #b4d2b4;
  border-radius: 6px;
  min-height: 100px;
  padding: 28px;
}
.nx-spacing-center {
  background: #d4e8f0;
  border: 2px dashed #a0c4d4;
  border-radius: 4px;
  padding: 10px 16px;
  font-size: 10px;
  font-weight: 600;
  color: #5a8494;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  min-width: 80px;
  text-align: center;
}
.nx-spacing-input {
  position: absolute;
  width: 48px;
  height: 24px;
  border: 1px solid transparent;
  background: transparent;
  text-align: center;
  font-size: 11px;
  font-family: monospace;
  color: #3a6a3a;
  border-radius: 3px;
  transition: all 0.15s ease;
  outline: none;
}
.nx-spacing-input:hover {
  border-color: #b4d2b4;
  background: rgba(255, 255, 255, 0.7);
}
.nx-spacing-input:focus {
  border-color: #007cba;
  background: #fff;
  box-shadow: 0 0 0 1px #007cba;
  color: #1e1e1e;
}
.nx-spacing-top { top: 4px; left: 50%; transform: translateX(-50%); }
.nx-spacing-bottom { bottom: 4px; left: 50%; transform: translateX(-50%); }
.nx-spacing-left { left: 4px; top: 50%; transform: translateY(-50%); }
.nx-spacing-right { right: 4px; top: 50%; transform: translateY(-50%); }

/* ── Position grid (3×3) ── */
.nx-position-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  width: 80px;
  margin: 0 auto 12px;
}
.nx-position-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #ddd;
  background: #f6f7f7;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  padding: 0;
}
.nx-position-dot span {
  display: block;
  width: 6px;
  height: 6px;
  background: #bbb;
  border-radius: 50%;
  transition: all 0.15s ease;
}
.nx-position-dot:hover {
  border-color: #007cba;
}
.nx-position-dot:hover span {
  background: #007cba;
}
.nx-position-dot.is-active {
  border-color: #007cba;
  background: #007cba;
}
.nx-position-dot.is-active span {
  background: #fff;
  width: 8px;
  height: 8px;
}

/* ── Gradient swatches ── */
.nx-gradient-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.nx-gradient-swatch {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
}
.nx-gradient-swatch:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.nx-gradient-swatch.is-active {
  border-color: #007cba;
  box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.3);
  transform: scale(1.1);
}

/* ── Image preview ── */
.nx-img-preview {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 12px;
  border: 1px solid #e0e0e0;
}
.nx-img-preview img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 160px;
  object-fit: cover;
}
.nx-img-actions {
  display: flex;
  gap: 6px;
  padding: 8px;
  background: rgba(0, 0, 0, 0.02);
  border-top: 1px solid #e0e0e0;
}

/* ── Upload zone ── */
.nx-upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px;
  border: 2px dashed #d0d0d0;
  border-radius: 8px;
  cursor: pointer;
  color: #757575;
  transition: all 0.2s ease;
  text-align: center;
}
.nx-upload-zone:hover {
  border-color: #007cba;
  color: #007cba;
  background: rgba(0, 124, 186, 0.02);
}
.nx-upload-zone span {
  font-size: 12px;
}

/* ── Video info card ── */
.nx-video-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: #f6f7f7;
  border-radius: 8px;
  margin-bottom: 12px;
  border: 1px solid #e0e0e0;
}
.nx-video-info > span {
  flex: 1;
  font-size: 12px;
  word-break: break-all;
  color: #555;
}
.nx-video-info .nx-img-actions {
  width: 100%;
  background: transparent;
  border-top: 1px solid #e0e0e0;
  margin-top: 4px;
  padding: 8px 0 0;
}

/* Poster thumbnail */
.nx-poster-thumb {
  display: block;
  max-width: 120px;
  border-radius: 6px;
  margin: 8px 0;
  border: 1px solid #e0e0e0;
}

/* ── Content Width options ── */
.nx-width-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}
.nx-width-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 6px;
  border: 1.5px solid #ddd;
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.nx-width-option strong {
  font-size: 11px;
  color: #1e1e1e;
}
.nx-width-option span {
  font-size: 10px;
  color: #999;
}
.nx-width-option:hover {
  border-color: #007cba;
}
.nx-width-option.is-active {
  border-color: #007cba;
  background: rgba(0, 124, 186, 0.05);
}
.nx-width-option.is-active strong {
  color: #007cba;
}

/* ── Icon buttons (flex direction, justify, align, position) ── */
.nx-icon-btns {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.nx-icon-btns--wide {
  gap: 3px;
}
.nx-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 32px;
  padding: 0 8px;
  border: 1.5px solid #ddd;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  color: #555;
  transition: all 0.15s ease;
}
.nx-icon-btn--text {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 0 10px;
}
.nx-icon-btn:hover {
  border-color: #007cba;
  color: #007cba;
}
.nx-icon-btn.is-active {
  border-color: #007cba;
  background: #007cba;
  color: #fff;
}

/* ── Section heading ── */
.nx-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 14px 0 8px;
}
.nx-section-heading h3 {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #757575;
}
.nx-reset-btn {
  font-size: 11px !important;
  color: #cc1818 !important;
}

/* ── Divider section ── */
.nx-divider-section {
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
}
.nx-divider-section:last-child {
  border-bottom: none;
}
.nx-divider-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.nx-divider-header > span {
  font-size: 12px;
  font-weight: 600;
  color: #1e1e1e;
}
.nx-divider-header .components-toggle-control {
  margin-bottom: 0;
}

/* Divider shape picker */
.nx-divider-shapes {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}
.nx-divider-shape {
  width: 48px;
  height: 32px;
  border: 1.5px solid #ddd;
  background: #f6f7f7;
  border-radius: 4px;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: flex-end;
  color: #888;
  transition: all 0.15s ease;
}
.nx-divider-shape svg {
  display: block;
  width: 100%;
  height: auto;
}
.nx-divider-shape:hover {
  border-color: #007cba;
  color: #007cba;
}
.nx-divider-shape.is-active {
  border-color: #007cba;
  background: rgba(0, 124, 186, 0.06);
  color: #007cba;
}

/* Divider preview in sidebar */
.nx-divider-preview {
  display: block;
  width: 100%;
  border-radius: 4px;
  background: #f6f7f7;
}
.nx-divider-preview.is-flipped {
  transform: scaleY(-1);
}

/* Divider preview in editor canvas */
.nx-section-block-editor .nx-divider-preview {
  position: absolute;
  left: 0;
  width: 100%;
  z-index: 1;
  pointer-events: none;
}
.nx-section-block-editor .nx-divider-preview:not(.is-flipped) {
  top: 0;
}
.nx-section-block-editor .nx-divider-preview.is-flipped {
  bottom: 0;
}

/* ── Visibility grid ── */
.nx-visibility-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.nx-vis-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #f6f7f7;
  border-radius: 6px;
}
.nx-vis-item span {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
}
.nx-vis-item .components-toggle-control {
  margin-bottom: 0;
}

/* ── Position inputs ── */
.nx-pos-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.nx-pos-inputs .components-base-control {
  margin-bottom: 0;
}