/* ================================================================
   WildMagPro Layout Block Builder — composer.css
   Frontend + builder responsive styles.
   ================================================================ */

/* Base frontend structure */
.wlb-frontend-wrap {
  width: 100%;
}

.wlb-frontend-wrap .wlb-section {
  padding: 0;
  margin: 0;
}

.wlb-render-anchor {
  display: block;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  overflow: hidden !important;
}

.wlb-frontend-wrap .wlb-row,
.wlb-frontend-wrap .wlb-col {
  min-width: 0;
}

.wlb-frontend-wrap .wlb-col > * {
  max-width: 100%;
}

/* Frontend image block */
.wlb-builder-image,
.wlb-builder-image-link {
  display: block;
  width: 100%;         /* stretch to fill the column */
  max-width: 100%;
  line-height: 0;      /* collapse inline-block gap under img */
}

/* The image itself always fills the column width and never overflows.
   object-fit:cover ensures any aspect-ratio image crops gracefully.
   height:auto is the default; a per-block inline height override
   from the PHP renderer will win via specificity when the user sets
   an explicit height — no !important needed. */
.wlb-builder-image-media {
  display: block;
  width: 100%;         /* always fill column — overrides main.css `img { width:100% }` cleanly */
  max-width: 100%;
  /* NOTE: height intentionally NOT set here — inline style from the block
     data applies height when the user has defined one. Setting height:auto
     here would override any user-defined pixel height via the inline style. */
  object-fit: cover;   /* cover if an explicit height is set inline */
  object-position: center center;
  border-radius: 12px;
}

/* When alignment=full the wrapper and img must both be 100% wide */
.wlb-builder-image-align-full {
  width: 100%;
}
.wlb-builder-image-align-full .wlb-builder-image-media {
  width: 100%;
  border-radius: 0;    /* full-bleed looks better without radius */
}

/* Frontend blog block */
.wlb-builder-blog-card {
  position: relative;
  width: 100%;
  max-width: 100%;
}

/* Thumb container — height/aspect-ratio is applied via inline style by the
   PHP/JS renderer so each block can have an independent value.
   The class only sets non-dimensional layout properties. */
.wlb-builder-blog-thumb {
  display: block;
  width: 100%;
  overflow: hidden;
  flex-shrink: 0;
  line-height: 0;
  /* NOTE: aspect-ratio and height are set via inline style per-block.
     Do NOT add aspect-ratio or height here — it would override the
     per-block inline value and break custom height settings. */
}

/* The actual <img> always fills and crops to the container */
.wlb-builder-blog-thumb-image {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  object-fit: cover;
  object-position: center center;
}

.wlb-builder-blog-content {
  min-width: 0;
}

.wlb-builder-blog-title {
  word-break: break-word;
}

.wlb-builder-blog-title a {
  color: inherit;
  text-decoration: none;
}

.wlb-builder-blog-excerpt {
  word-break: break-word;
}

.wlb-builder-blog-button {
  white-space: nowrap;
}

/* Frontend ad block */
.wlb-builder-ad,
.wlb-builder-ad-embed,
.wlb-builder-ad-link {
  display: block;
  max-width: 100%;
}

.wlb-builder-ad img,
.wlb-builder-ad iframe,
.wlb-builder-ad ins,
.wlb-builder-ad object,
.wlb-builder-ad embed,
.wlb-builder-ad video,
.wlb-builder-ad canvas,
.wlb-builder-ad svg {
  max-width: 100% !important;
}

.wlb-builder-ad img,
.wlb-builder-ad video {
  /* height intentionally not set here — the container's min-height and the
     ad image's own inline style (from PHP/JS renderer) control the height.
     Setting height:auto here would override any user-defined pixel height. */
  display: block;
}

.wlb-builder-ad iframe {
  display: block;
  margin-left: auto;
  margin-right: auto;
  border: 0;
}

.wlb-builder-ad .adsbygoogle,
.wlb-builder-ad ins.adsbygoogle {
  max-width: 100% !important;
}

/* Picker item hover */
.wlb-picker-item:hover {
  border-color: #3b82f6 !important;
  background: #f0f7ff !important;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.12);
}

.wlb-picker-item:hover div {
  background: #3b82f6 !important;
}

.wlb-picker-item:hover span {
  color: #3b82f6 !important;
}

/* Slot button hover */
.wlb-slot-btn:hover {
  border-color: #3b82f6 !important;
  color: #3b82f6 !important;
  background: #eff6ff !important;
}

/* Block toolbar visibility on hover */
.wlb-block-toolbar {
  opacity: 0;
  transition: opacity 0.15s;
}

.wlb-filled:hover .wlb-block-toolbar {
  opacity: 1;
}

/* Section toolbar visibility on hover */
.wlb-section-toolbar {
  opacity: 0;
  transition: opacity 0.15s;
}

.wlb-section-edit:hover .wlb-section-toolbar {
  opacity: 1;
}

/* Section toolbar button hover */
.wlb-section-toolbar button:hover {
  background: #3b82f6 !important;
  color: #fff !important;
  border-color: #3b82f6 !important;
}

.wlb-tb-delete:hover {
  background: #ef4444 !important;
  border-color: #ef4444 !important;
}

/* Edit button hover */
.wlb-tb-edit:hover {
  background: #2563eb !important;
}

/* Form input focus */
.wlb-form input:focus,
.wlb-form textarea:focus,
.wlb-form select:focus {
  border-color: #3b82f6 !important;
  outline: none !important;
  background: #fff !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Form submit hover */
.wlb-form-submit:hover {
  background: #2563eb !important;
}

.wlb-form-cancel:hover {
  border-color: #ef4444 !important;
  color: #ef4444 !important;
}

/* Publish bar button hovers */
#wlbResetBtn:hover {
  background: #ef4444 !important;
  color: #fff !important;
  border-color: #ef4444 !important;
}

#wlbPublishBtn:hover {
  background: #2563eb !important;
}

/* Picker close hover */
#wlbPickerClose:hover {
  background: #ef4444 !important;
  color: #fff !important;
}

/* Tablet and below */
@media (max-width: 768px) {
  .wlb-row,
  .wlb-frontend-wrap .wlb-row {
    flex-direction: column !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .wlb-col,
  .wlb-frontend-wrap .wlb-col {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 0 14px !important;
  }

  .wlb-frontend-wrap .wlb-section + .wlb-section {
    margin-top: 2px;
  }

  .wlb-builder-image,
  .wlb-builder-blog-card,
  .wlb-builder-ad {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  .wlb-builder-image-media {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    object-fit: cover !important;
    object-position: center center !important;
  }

  .wlb-builder-blog-card {
    min-height: 0 !important;
    border-radius: 12px !important;
  }

  .wlb-builder-blog-thumb {
    /* aspect-ratio and height are per-block inline styles — do NOT override here */
    overflow: hidden !important;
  }

  .wlb-builder-blog-thumb-image {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center center !important;
  }

  .wlb-builder-blog-content {
    padding: 14px !important;
  }

  .wlb-builder-blog-title {
    margin-bottom: 8px !important;
    font-size: 20px !important;
    line-height: 1.32 !important;
  }

  .wlb-builder-blog-excerpt {
    font-size: 14px !important;
    line-height: 1.65 !important;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .wlb-builder-blog-actions {
    padding-top: 12px !important;
  }

  .wlb-builder-blog-button {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    padding: 9px 16px !important;
    font-size: 13px !important;
    line-height: 1.2;
  }

  .wlb-builder-ad {
    overflow: hidden;
  }

  .wlb-builder-ad,
  .wlb-builder-ad-embed,
  .wlb-builder-ad-placeholder {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 0 !important;
  }

  .wlb-builder-ad img,
  .wlb-builder-ad iframe,
  .wlb-builder-ad ins,
  .wlb-builder-ad object,
  .wlb-builder-ad embed,
  .wlb-builder-ad video,
  .wlb-builder-ad canvas,
  .wlb-builder-ad svg {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
  }
}

/* Small phones */
@media (max-width: 480px) {
  .wlb-col,
  .wlb-frontend-wrap .wlb-col {
    padding-bottom: 12px !important;
  }

  .wlb-builder-blog-thumb {
    /* aspect-ratio and height are per-block inline styles — do NOT override here */
    overflow: hidden !important;
  }

  .wlb-builder-blog-thumb-image {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center center !important;
  }

  .wlb-builder-blog-content {
    padding: 12px !important;
  }

  .wlb-builder-blog-title {
    font-size: 18px !important;
  }

  .wlb-builder-blog-excerpt {
    -webkit-line-clamp: 3;
    font-size: 13px !important;
    line-height: 1.55 !important;
  }

  .wlb-builder-blog-button {
    padding: 8px 14px !important;
    font-size: 12px !important;
  }
}
