/* Image wrapper */
.ksf-rel {
  position: relative;
  display: inline-block;
}

.ksf-rel img {
  display: block;
  width: 100%;
  height: auto;
}

/* Overlay frame – position and size are driven by percentage values from the backend */
.ksf-overlay {
  position: absolute;
  left: 0;
  top: 0;
  width: 40%;
  height: 15%;
  transform: none;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  box-sizing: border-box;
  overflow: hidden;
}

/* Text should wrap only at natural word boundaries, no hyphenation */
.ksf-text {
  display: block;
  width: 100%;
  max-height: 100%;
  white-space: normal;
  word-break: normal;
  overflow-wrap: normal;
  hyphens: none;
  line-height: 1.1;
}

/* Input container */
.ksf-input {
  margin: 1px 0;
}

.ksf-input label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

.ksf-input input[type="text"] {
  width: 100%;
  padding: 8px;
}

/* Toggle visibility for overlay and input */
#ks-personalize-overlay {
  display: none;
}
#ks-personalize-input {
  display: none;
}

.ks-ov-active #ks-personalize-overlay {
  display: block;
}
.ks-ov-active #ks-personalize-input {
  display: block;
}

.ks-ov-active #ks-single-product-images,
.ks-ov-active .elementor-widget-woocommerce-product-images {
  display: none !important;
}

/* Active state for main trigger button */
#ks-personalize.ks-on,
#ks-personalize.ks-on.elementor-button {
  background-color: #fbb !important;
  border-color: #fbb !important;
  color: #020202 !important;
}

/* Placeholder sizing on large screens */
#ks_personalize_text::placeholder {
  font-size: 14px;
}

/* Placeholder sizing for tablets */
@media (max-width: 1023px) and (min-width: 768px) {
  #ks_personalize_text::placeholder {
    font-size: 11px;
  }
}

/* Placeholder sizing for mobile */
@media (max-width: 767px) {
  #ks_personalize_text::placeholder {
    font-size: 10px;
  }
}

/* WebKit placeholder fallback */
#ks_personalize_text::-webkit-input-placeholder {
  font-size: 16px;
}

@media (max-width: 1023px) and (min-width: 768px) {
  #ks_personalize_text::-webkit-input-placeholder {
    font-size: 12px;
  }
}

@media (max-width: 767px) {
  #ks_personalize_text::-webkit-input-placeholder {
    font-size: 10px;
  }
}

#ks-personalize-input {
  background-color: #efefef !important;
  padding: 10px;
}

/* Header row: toggle buttons + label in one line */
.ksf-input-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  margin-bottom: 0;
  flex-wrap: wrap;
}

.ksf-input-label {
  font-weight: 600;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Toggle button group */
.ksf-toggle-group {
  display: inline-flex;
}

/* Individual toggle buttons */
.ksf-toggle-btn {
  color: grey !important;
  border-top: 1px solid grey !important;
  border-right: 1px solid grey !important;
  border-left: 1px solid grey !important;
  border-bottom: 1px solid grey !important;
  background: white;
  padding: 3px 9px !important;
  margin: 5px 1px;
  font-size: 12px;
  line-height: 1.4;
  cursor: pointer;
  white-space: nowrap;
}

.ksf-toggle-btn:hover {
  background-color: grey !important;
  color: white !important;
}

/* Active toggle state */
.ksf-toggle-btn.is-active {
  background: grey !important;
  color: #fff !important;
}

/* Initials mode: visual uppercase hint */
.ksf-input--initials #ks_personalize_text {
  text-transform: uppercase;
}

/* Placeholders slightly smaller in initials mode */

/* Desktop */
.ksf-input--initials #ks_personalize_text::placeholder {
  font-size: 12px;
}

/* Tablet */
@media (max-width: 1023px) and (min-width: 768px) {
  .ksf-input--initials #ks_personalize_text::placeholder {
    font-size: 9px;
  }
}

/* Mobile */
@media (max-width: 767px) {
  .ksf-input--initials #ks_personalize_text::placeholder {
    font-size: 8px;
  }
}

/* WebKit placeholders in initials mode */
.ksf-input--initials #ks_personalize_text::-webkit-input-placeholder {
  font-size: 14px;
}

@media (max-width: 1023px) and (min-width: 768px) {
  .ksf-input--initials #ks_personalize_text::-webkit-input-placeholder {
    font-size: 10px;
  }
}

@media (max-width: 767px) {
  .ksf-input--initials #ks_personalize_text::-webkit-input-placeholder {
    font-size: 8px;
  }
}
