.customise-item-modal {
  .ant-modal-content,
  .pisell-lowcode-modal-content {
    padding: 0;
    border-radius: 16px;
    overflow: hidden;
  }

  .ant-modal-body,
  .pisell-lowcode-modal-body {
    padding: 0;
  }

  &-content {
    position: relative;
    overflow: visible;
    background: #fff;
    padding-top: 24px;
  }

  &-header {
    display: flex;
    align-items: center;
    justify-content: start;
    padding: 0 24px 24px 0;
    margin-bottom: 16px;
    position: relative;
  }

  &-title {
    font-size: 20px;
    font-weight: 600;
    color: #000;
    margin: 0;
    text-align: center;
  }

  &-close {
    position: absolute;
    right: 8px;
    top: 20%;
    transform: translateY(-50%);
    border: none;
    box-shadow: none;
    padding: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: normal;
    
    &:hover {
      background: #f5f5f5;
      border-radius: 6px;
    }
  }

  &-body {
    display: flex;
    padding: 0 24px 16px;
    gap: 32px;
    min-height: 480px;
  }

  &-illustration {
    flex: 0 0 240px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-right: 24px;
  }

  .customise-item-illustration-image {
    width: 220px;
    height: 220px;
    object-fit: contain;
  }

  &-form {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
  }

  .customise-item-form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;

    &:last-child {
      margin-top: auto;
    }
  }

  .customise-item-form-label {
    font-size: 14px;
    font-weight: 500;
    color: #000;
    margin-bottom: 4px;
  }

  .customise-item-product-name-input {
    height: 48px;
    border-radius: 8px;
    border: 1px solid #d9d9d9;
    font-size: 14px;

    &:focus,
    &:hover {
      border-color: #722ed1;
    }

    &.ant-input-focused {
      border-color: #722ed1;
      box-shadow: 0 0 0 2px rgba(114, 46, 209, 0.1);
    }
  }

  .customise-item-vouchers-checkbox {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;

    .vouchers-label {
      font-size: 16px;
      color: #000;
      flex: 1;
      margin: 0;
      cursor: pointer;
      user-select: none;
      outline: none;
      -webkit-tap-highlight-color: transparent;
      
      &:focus,
      &:active {
        color: #000;
        outline: none;
      }
    }

    .vouchers-checkbox-input {
      flex-shrink: 0;
    }
    .pisell-lowcode-checkbox-inner {
      width: 24px!important;
      height: 24px!important;
    }
    .pisell-lowcode-checkbox-inner::after {
      width: 9px!important;
      height: 14px!important;
    }
  }

  // 价格选项样式
  .customise-item-price-option {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: 16px;
    row-gap: 8px;
    align-items: center;
    margin-bottom: 20px;
  }

  .customise-item-price-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .customise-item-radio {
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
    border-radius: 50%;
    border: 2px solid #d9d9d9;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    flex-shrink: 0;
    /* iPad 兼容性修复 */
    -webkit-appearance: none;
    appearance: none;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    /* 确保圆形在所有设备上正确显示 */
    -webkit-border-radius: 50%;
    position: relative;
    /* 修复 flexbox 居中问题 */
    -webkit-box-align: center;
    -webkit-box-pack: center;
    -webkit-align-items: center;
    -webkit-justify-content: center;
    grid-column: 1;
    grid-row: 2;

    .radio-dot {
      width: 8px;
      height: 8px;
      min-width: 8px;
      min-height: 8px;
      border-radius: 50%;
      background: transparent;
      transition: all 0.2s ease;
      flex-shrink: 0;
      /* iPad 兼容性修复 */
      -webkit-border-radius: 50%;
      box-sizing: border-box;
      position: absolute;
      top: 50%;
      left: 50%;
      -webkit-transform: translate(-50%, -50%);
      transform: translate(-50%, -50%);
    }

    &.active {
      &.purple {
        border-color: #722ed1;
        
        .radio-dot {
          background: #722ed1;
        }
      }

      &.red {
        border-color: #ff4d4f;
        
        .radio-dot {
          background: #ff4d4f;
        }
      }
    }

    /* 触摸设备优化 */
    @media (pointer: coarse) {
      /* 增加触摸区域 */
      &::before {
        content: '';
        position: absolute;
        top: -10px;
        left: -10px;
        right: -10px;
        bottom: -10px;
        z-index: -1;
      }
    }

    /* WebKit 特定修复 */
    @supports (-webkit-appearance: none) {
      /* 修复 WebKit 中的按钮默认样式 */
      font-family: inherit;
      font-size: inherit;
      line-height: inherit;
      color: inherit;
      background-color: #fff;
      
      /* 禁用 WebKit 的默认触摸高亮 */
      -webkit-tap-highlight-color: transparent;
      
      /* 确保边框渲染正确 */
      -webkit-background-clip: padding-box;
      background-clip: padding-box;
    }

    /* iOS Safari 特定修复 */
    @supports (-webkit-touch-callout: none) {
      /* 禁用长按菜单 */
      -webkit-touch-callout: none;
      -webkit-user-select: none;
      user-select: none;
      
      /* 确保点击事件正常 */
      pointer-events: auto;
      
      /* 修复 iOS 上的按钮样式问题 */
      border-style: solid;
      border-width: 2px;
    }
  }

  .customise-item-price-title {
    grid-column: 2;
    grid-row: 1;
    font-size: 14px;
    font-weight: 500;
    color: #D0D5DD;
    transition: all 0.2s ease;

    &.purple {
      color: #722ed1;
    }

    &.red {
      color: #ff4d4f;
    }
  }

  .customise-item-price-input {
    grid-column: 2;
    grid-row: 2;
    display: flex;
    align-items: center;
    width: calc(100% - 32px);
    height: 48px;
    padding: 14px 16px;
    border: 2px solid #d9d9d9;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    box-sizing: content-box;
    line-height: normal;

    &.active {
      &.purple {
        border-color: #722ed1;
        background: #f9f0ff;
      }

      &.red {
        border-color: #ff4d4f;
        background: #fff2f0;
      }
    }

    .price-currency {
      font-size: 16px;
      font-weight: 600;
      color: #8c8c8c;
      margin-right: 8px;
      flex-shrink: 0;
    }

    .price-minus {
      font-size: 20px;
      font-weight: 600;
      color: #ff4d4f;
      margin-right: 4px;
      flex-shrink: 0;
      margin-top: -4px;
    }

    .price-input-display {
      flex: 1;
      font-size: 24px;
      font-weight: 600;
      color: #8c8c8c;
      text-align: right;
      padding: 0;
      display: flex;
      align-items: center;
      justify-content: flex-end;
      min-height: 32px;

      &.placeholder {
        color: #D0D5DD!important;
      }

      &:empty::before {
        content: attr(data-placeholder);
        color: #bfbfbf;
        font-weight: normal;
      }
    }

    &.active.purple .price-currency {
      color: #722ed1;
    }

    &.active.purple .price-input-display {
      color: #722ed1;
    }

    &.active.red .price-currency {
      color: #ff4d4f;
    }

    &.active.red .price-input-display {
      color: #ff4d4f;
    }

    // VirtualKeyInput 样式覆盖
    .virtual-keyboard-input-wrap {
      border: none;
      background: transparent;
      
      .virtual-keyboard-input {
        background: transparent;
        border: none;
        padding: 0;
      }

      .virtual-keyboard-input-delete {
        display: none; // 隐藏删除按钮，因为我们已经有自己的删除逻辑
      }
    }

    .virtual-keyboard-price-input {
      width: 100%;
      display: flex;
      align-items: center;
      cursor: pointer;
    }
  }

  &-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 24px 24px;
  }


  &-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 0;
    padding: 0;
  }

  .customise-item-quantity-selector-fixed {
    position: static;
    z-index: 10;
  }

  .customise-item-cancel-btn {
    min-width: 100px;
    height: 48px;
    border-radius: 8px;
    border: 1px solid #d9d9d9;
    background: #fff;
    color: #000;
    font-weight: 500;

    &:hover {
      border-color: #722ed1;
      color: #722ed1;
      background: #f9f0ff;
    }
  }

  .customise-item-save-btn {
    min-width: 120px;
    height: 48px;
    border-radius: 8px;
    background: #722ed1;
    border-color: #722ed1;
    font-weight: 500;

    &:hover {
      background: #9254de;
      border-color: #9254de;
    }

    &:disabled {
      background: #f5f5f5;
      border-color: #d9d9d9;
      color: #bfbfbf;
    }
  }
}

.customise-item-drawer-phone {
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;

  &.pisell-lowcode-drawer-content-wrapper,
  .pisell-lowcode-drawer-content-wrapper,
  .ant-drawer-content-wrapper {
    max-width: none !important;
  }

  .pisell-lowcode-drawer-content,
  .ant-drawer-content {
    border-radius: 16px 16px 0 0;
    overflow: hidden;
  }

  .pisell-lowcode-drawer-body,
  .ant-drawer-body {
    padding: 0 !important;
  }

  .customise-item-modal-content-phone {
    display: flex;
    flex-direction: column;
    border-radius: 16px 16px 0 0;
    padding-top: 0;
  }

  .customise-item-modal-body {
    flex-direction: column;
    padding: 16px 12px;
    gap: 12px;
    min-height: unset;
  }

  .customise-item-modal-illustration {
    display: none;
  }

  .customise-item-illustration-placeholder {
    width: 120px;
    height: 120px;
  }

  .customise-item-modal-header {
    padding: 4px 16px 8px;
    margin-bottom: 0;
    flex-shrink: 0;
  }

  .customise-item-modal-title {
    width: 100%;
    font-size: 18px;
    line-height: 24px;
  }

  .customise-item-modal-form {
    gap: 14px;
  }

  .customise-item-form-label,
  .customise-item-price-title {
    font-size: 13px;
  }

  .customise-item-product-name-input {
    height: 44px;
  }

  .customise-item-vouchers-checkbox {
    min-height: 36px;

    .vouchers-label {
      font-size: 15px;
    }
  }

  .customise-item-price-option {
    column-gap: 12px;
    row-gap: 6px;
    margin-bottom: 12px;
  }

  .customise-item-price-input {
    height: 48px;
    padding: 10px 12px;
    width: 100%;
    box-sizing: border-box;

    .price-input-display {
      font-size: 20px;
      min-width: 0;
      word-break: break-all;
    }
  }

  .customise-item-modal-footer {
    flex: 1;
    min-width: 0;
    margin-top: 0;
    padding: 0;
  }

  .customise-item-save-btn {
    width: 100%;
    min-width: 0;
  }

  .customise-item-modal-actions {
    position: static;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 12px calc(12px + env(safe-area-inset-bottom));
  }

  .customise-item-quantity-selector-fixed {
    position: static;
    display: flex;
    justify-content: center;
    flex: 0 0 auto;
    padding: 0;

    .customise-item-quantity-selector {
      .quantity-btn {
        width: 36px;
        height: 36px;
        font-size: 16px;
      }

      .quantity-number {
        min-width: 36px;
        height: 36px;
        font-size: 14px;
      }
    }
  }
}

// iPad 特定修复
@media (max-device-width: 1366px) and (-webkit-min-device-pixel-ratio: 1) {
  .customise-item-modal {
    .customise-item-radio {
      /* 强制硬件加速 */
      -webkit-transform: translateZ(0);
      transform: translateZ(0);
      /* 确保在 iPad 上正确渲染 */
      will-change: transform;

      .radio-dot {
        /* 强制硬件加速 */
        -webkit-transform: translate(-50%, -50%) translateZ(0);
        transform: translate(-50%, -50%) translateZ(0);
        will-change: transform, background;
      }
    }
  }
}

// 修复数量按钮样式，确保它看起来可点击
.customise-item-quantity-selector {
  .quantity-number {
    cursor: pointer;
    transition: background-color 0.15s ease;
    border: none;
    outline: none;

    &:hover:not(:disabled) {
      background: #f0f0f0;
    }

    &:active:not(:disabled) {
      background: #e6e6e6;
    }

    &:disabled {
      cursor: not-allowed;
      opacity: 0.6;
    }
  }
}

 