.kedl-photo-fields {
  width: 100%;
  max-width: 560px;
  margin: 24px 0;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
}

.kedl-photo-fields h3 {
  margin: 0 0 16px;
}

.kedl-photo-dimensions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.kedl-photo-field {
  margin: 0 0 14px;
}

.kedl-photo-field label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

.kedl-photo-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.kedl-photo-input-wrapper input[type="number"] {
  width: 100%;
  max-width: 160px;
}

.kedl-photo-unit {
  opacity: 0.8;
  white-space: nowrap;
}

.kedl-photo-options {
  margin-top: 18px;
}

.kedl-photo-options h3 {
  margin: 0 0 16px;
}

.kedl-photo-custom-select {
  position: relative;
  width: 100%;
  max-width: 360px;
}

.kedl-photo-custom-select-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid #bbb;
  background: #fff;
  color: #222;
  cursor: pointer;
  text-align: left;
}

.kedl-photo-custom-select-menu {
  position: absolute;
  z-index: 99999;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  max-height: 240px;
  overflow: auto;
  border: 1px solid #bbb;
  background: #fff;
  color: #222;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.16);
}

.kedl-photo-custom-select-option {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  color: #222;
  text-align: left;
  cursor: pointer;
}

.kedl-photo-custom-select-option:hover,
.kedl-photo-custom-select-option:focus {
  background: #f0f0f0;
}

.kedl-photo-live-price {
  margin: 18px 0;
  font-size: 1.1em;
}

.kedl-photo-upload {
  margin-top: 18px;
}

.kedl-photo-upload label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.kedl-photo-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.kedl-photo-file-button {
  margin-right: 10px;
}

.kedl-photo-file-name {
  display: inline-block;
  max-width: 100%;
  word-break: break-word;
}

.kedl-photo-help {
  margin-top: 8px;
  font-size: 0.9em;
  opacity: 0.8;
}

.kedl-photo-preview {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
}

.kedl-photo-preview h4 {
  margin: 0 0 12px;
}

.kedl-photo-preview-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kedl-photo-preview-image {
  display: block;
  max-width: 100%;
  max-height: 280px;
  object-fit: contain;
  border-radius: 4px;
  background: #fff;
}

.kedl-photo-preview-filename {
  margin: 0;
  font-weight: 600;
  word-break: break-word;
}

.kedl-photo-clear-file {
  width: fit-content;
}

@media (max-width: 640px) {
  .kedl-photo-dimensions-grid {
    grid-template-columns: 1fr;
  }
}

.kedl-photo-custom-select-toggle:focus,
.kedl-photo-custom-select-option:focus {
  outline: 2px solid #f58220;
  outline-offset: 1px;
}

.kedl-photo-custom-select.is-open .kedl-photo-custom-select-menu {
  display: block;
}

/* Kedl Photo form layout fixes */
.single-product form.cart:has(.kedl-photo-fields) {
  display: block !important;
}

.single-product form.cart .kedl-photo-fields ~ .kedl-photo-quantity-label {
  display: block;
  margin: 18px 0 6px;
  font-weight: 600;
}

.single-product form.cart .kedl-photo-fields ~ .quantity {
  display: block !important;
  float: none !important;
  clear: both !important;
  width: auto !important;
  height: auto !important;
  margin: 0 0 14px !important;
  padding: 0 !important;
  vertical-align: baseline !important;
}

.single-product form.cart .kedl-photo-fields ~ .quantity input.qty {
  display: inline-block !important;
  width: 80px !important;
  max-width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  padding: 6px 8px !important;
  line-height: 1.4 !important;
}

.single-product form.cart .kedl-photo-fields ~ .single_add_to_cart_button {
  display: inline-block !important;
  float: none !important;
  clear: both !important;
  width: auto !important;
  max-width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 14px 24px !important;
  line-height: 1.2 !important;
  vertical-align: baseline !important;
}

/* Custom dropdown alignment fixes */
.kedl-photo-custom-select,
.kedl-photo-custom-select * {
  box-sizing: border-box;
}

.kedl-photo-custom-select-toggle,
.kedl-photo-custom-select-option {
  margin: 0 !important;
  border-radius: 0;
  font: inherit;
  -webkit-appearance: none;
  appearance: none;
}

.kedl-photo-custom-select-option {
  padding-left: 12px !important;
  padding-right: 12px !important;
  text-indent: 0 !important;
}

/* Kedl Photo editor */
.kedl-photo-fields--editor {
  max-width: none !important;
  width: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  background: transparent !important;
}

.kedl-photo-fields--editor .kedl-photo-upload,
.kedl-photo-fields--editor .kedl-photo-preview {
  display: none !important;
}

.kedl-editor-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(7, 12, 18, 0.97);
  color: #fff;
}

body.kedl-editor-open {
  overflow: hidden;
}

.kedl-editor-shell {
  position: relative;
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  height: 100vh;
  padding: 24px 24px 24px 42px;
  gap: 18px;
}

.kedl-editor-sidebar {
  border: 1px solid rgba(237, 190, 140, 0.35);
  background: rgba(10, 15, 20, 0.96);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.kedl-editor-sidebar-scroll {
  overflow: auto;
  padding: 18px;
  flex: 1 1 auto;
}

.kedl-editor-sidebar .kedl-photo-fields h3,
.kedl-editor-sidebar .kedl-photo-options h3,
.kedl-editor-sidebar .kedl-photo-field label,
.kedl-editor-sidebar .kedl-photo-unit,
.kedl-editor-sidebar .kedl-photo-live-price,
.kedl-editor-sidebar .kedl-photo-live-price * {
  color: #fff !important;
}

.kedl-editor-sidebar input[type="number"],
.kedl-editor-sidebar input[type="text"],
.kedl-editor-sidebar select,
.kedl-editor-sidebar .kedl-custom-select-toggle {
  width: 100%;
  max-width: none;
  background: rgba(255, 255, 255, 0.14) !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  color: #fff !important;
}

.kedl-editor-sidebar .kedl-custom-select-menu {
  color: #111;
  z-index: 100005;
}

.kedl-editor-stage-wrap {
  position: relative;
  min-width: 0;
}

.kedl-editor-toolbar {
  position: absolute;
  top: 44px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 3;
}

.kedl-editor-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 10px;
  z-index: 3;
}

.kedl-editor-actions .button.alt {
  background: #e56f12;
  border-color: #e56f12;
  color: #fff;
}

.kedl-editor-stage {
  position: relative;
  height: calc(100vh - 48px);
  border: 1px solid rgba(237, 190, 140, 0.35);
  background: rgba(13, 18, 24, 1);
  overflow: hidden;
}

.kedl-editor-workarea {
  position: absolute;
  inset: 64px 24px 24px 24px;
  overflow: hidden;
  cursor: grab;
}

.kedl-editor-workarea.is-dragging {
  cursor: grabbing;
}

.kedl-editor-image {
  position: absolute;
  user-select: none;
  -webkit-user-drag: none;
  max-width: none !important;
}

.kedl-editor-crop {
  position: absolute;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.36);
  z-index: 2;
}

.kedl-editor-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, transparent 33.33%, rgba(255,255,255,0.34) 33.33%, rgba(255,255,255,0.34) 33.8%, transparent 33.8%, transparent 66.66%, rgba(255,255,255,0.34) 66.66%, rgba(255,255,255,0.34) 67.1%, transparent 67.1%),
    linear-gradient(to bottom, transparent 33.33%, rgba(255,255,255,0.34) 33.33%, rgba(255,255,255,0.34) 33.8%, transparent 33.8%, transparent 66.66%, rgba(255,255,255,0.34) 66.66%, rgba(255,255,255,0.34) 67.1%, transparent 67.1%);
}

.kedl-editor-bleed {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.45);
  display: none;
  z-index: 1;
}

.kedl-editor-ruler {
  position: absolute;
  color: #6fa8ff;
  font-size: 12px;
  z-index: 4;
  pointer-events: none;
}

.kedl-editor-ruler-top {
  left: 42px;
  right: 24px;
  top: 4px;
  height: 24px;
  border-top: 1px solid rgba(237, 190, 140, 0.35);
}

.kedl-editor-ruler-left {
  top: 24px;
  bottom: 24px;
  left: 10px;
  width: 24px;
  border-left: 1px solid rgba(237, 190, 140, 0.35);
}

.kedl-editor-ruler-tick {
  position: absolute;
}

.kedl-editor-ruler-top .kedl-editor-ruler-tick {
  top: 2px;
  transform: translateX(-50%);
}

.kedl-editor-ruler-left .kedl-editor-ruler-tick {
  left: 2px;
  transform: translateY(-50%);
}

.kedl-editor-ruler-unit {
  position: absolute;
  top: -2px;
  left: 4px;
  font-weight: 700;
}

.kedl-editor-ruler-left .kedl-editor-ruler-unit {
  left: 0;
  top: 4px;
}

.kedl-editor-dpi {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 14px 18px 18px;
  font-size: 0.98rem;
}

.kedl-editor-dpi-help {
  margin-top: 8px;
  font-size: 0.88rem;
  line-height: 1.4;
  color: rgba(255,255,255,0.8);
}

[data-kedl-editor-dpi-value].is-low {
  color: #ff5757;
}

@media (max-width: 980px) {
  .kedl-editor-shell {
    grid-template-columns: 1fr;
    padding-left: 24px;
  }

  .kedl-editor-sidebar {
    max-height: 45vh;
  }

  .kedl-editor-ruler-left {
    display: none;
  }
}


/* editor tweaks requested */
.kedl-editor-sidebar .kedl-photo-upload {
  display: none !important;
}

.kedl-editor-dpi {
  padding: 16px 18px 20px;
  font-size: 1.15rem;
  line-height: 1.45;
}

.kedl-editor-dpi strong {
  display: inline-block;
  font-size: 1.2rem;
}

.kedl-editor-dpi [data-kedl-editor-dpi-value] {
  font-size: 1.35rem;
  font-weight: 700;
}

.kedl-editor-dpi-help {
  margin-top: 10px;
  font-size: 1rem;
  line-height: 1.55;
  color: rgba(255,255,255,0.92);
}

.kedl-editor-toolbar .button {
  white-space: nowrap;
}


.kedl-editor-loading {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: rgba(7, 12, 18, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
}

.kedl-editor-loading-box {
  width: min(92vw, 460px);
  background: rgba(12, 18, 24, 0.98);
  border: 1px solid rgba(237, 190, 140, 0.35);
  border-radius: 10px;
  padding: 26px 24px;
  text-align: center;
  color: #fff;
  box-shadow: 0 18px 40px rgba(0,0,0,0.35);
}

.kedl-editor-spinner {
  width: 44px;
  height: 44px;
  margin: 0 auto 14px;
  border: 4px solid rgba(255,255,255,0.18);
  border-top-color: #ff6a00;
  border-radius: 50%;
  animation: kedl-photo-spin 0.85s linear infinite;
}

.kedl-editor-loading-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.kedl-editor-loading-text {
  font-size: 0.98rem;
  line-height: 1.5;
  color: rgba(255,255,255,0.9);
}

@keyframes kedl-photo-spin {
  to { transform: rotate(360deg); }
}

.kedl-editor-loading[hidden] {
  display: none !important;
}


.kedl-editor-actions .button[disabled],
.kedl-editor-actions .button.is-disabled-by-dpi {
  opacity: 0.45 !important;
  cursor: not-allowed !important;
  filter: grayscale(0.45);
}

.kedl-editor-actions .button.is-disabled-by-dpi.alt {
  background: #777 !important;
  border-color: #777 !important;
}

/* Choice images on product options */
.kedl-photo-choice-images {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.kedl-photo-choice-image {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  border: 2px solid transparent;
  background: transparent;
  padding: 4px;
  cursor: pointer;
  max-width: 110px;
}

.kedl-photo-choice-image img {
  width: 90px;
  height: 70px;
  object-fit: cover;
  display: block;
}

.kedl-photo-choice-image span {
  font-size: 0.78rem;
  line-height: 1.2;
  text-align: center;
}

.kedl-photo-choice-image.is-selected {
  border-color: #222;
}

.kedl-photo-option-disabled {
  opacity: 0.58;
}

.kedl-photo-option-disabled [data-kedl-custom-select-toggle],
.kedl-photo-option-disabled [data-kedl-choice-image-option] {
  cursor: not-allowed !important;
}

.kedl-photo-option-disabled [data-kedl-custom-select-menu] {
  display: none !important;
}

.kedl-photo-option-disabled [data-kedl-choice-image-option] {
  opacity: 0.65;
  pointer-events: none;
}

.kedl-photo-fields--editor .kedl-photo-editor-hidden-option {
  display: none !important;
}

/* DPI analysis refinements */
.kedl-editor-dpi strong {
  display: block !important;
  font-size: 1.65rem !important;
  line-height: 1.15 !important;
  margin-bottom: 10px !important;
}

.kedl-editor-dpi-line {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 1.05rem;
}

.kedl-editor-dpi-status {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  display: inline-block;
  flex: 0 0 12px;
  background: #888;
}

.kedl-editor-dpi-status.is-green { background: #22c55e; }
.kedl-editor-dpi-status.is-yellow { background: #facc15; }
.kedl-editor-dpi-status.is-red { background: #ef4444; }

.kedl-editor-dpi-help {
  font-size: 1.08rem !important;
  line-height: 1.55 !important;
}

/* Production guide text replacement */
.kedl-guide-production-note {
  display: block !important;
  color: #111 !important;
  font-size: 0.72em !important;
  line-height: 1.25 !important;
  margin-top: 2px !important;
  text-decoration: none !important;
  pointer-events: none !important;
  font-weight: 400 !important;
}

/* Hide express checkout wallets on product/cart/checkout */
#wc-stripe-payment-request-wrapper,
#wc-stripe-payment-request-button-separator,
.wc-stripe-payment-request-wrapper,
.StripeElement--paymentRequestButton,
.wcpay-express-checkout-wrapper,
.wc-block-components-express-payment,
.wc-block-components-express-payment-continue-rule,
[id*="payment-request"],
[class*="payment-request"],
[id*="express-checkout"],
[class*="express-checkout"] {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  min-height: 0 !important;
  max-height: 0 !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
}
