/* ==================================================
   貓貓拼圖計畫：照片裁切器（測試版）
   純前端版，不需修改後端 ASP
================================================== */

.catPhotoUpload {
  margin-top: 12px;
}

/* ==================================================
   照片上傳按鈕
   電腦版 / 手機版統一樣式
================================================== */

.catPhotoUpload input[type="file"] {
  width: 100%;
  max-width: 100%;

  padding: 8px;

  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;

  color: #555;
  font-size: 15px;

  box-sizing: border-box;
}


/* Chrome / Edge / Firefox */
.catPhotoUpload input[type="file"]::file-selector-button {
  padding: 11px 18px;
  margin-right: 12px;

  background: #a86432;
  border: 0;
  border-radius: 6px;

  color: #fff;
  font-size: 15px;
  font-weight: 700;

  cursor: pointer;

  transition: background 0.2s ease;
}

.catPhotoUpload input[type="file"]::file-selector-button:hover {
  background: #8f5427;
}


/* Safari / 部分 WebKit 瀏覽器 */
.catPhotoUpload input[type="file"]::-webkit-file-upload-button {
  padding: 11px 18px;
  margin-right: 12px;

  background: #a86432;
  border: 0;
  border-radius: 6px;

  color: #fff;
  font-size: 15px;
  font-weight: 700;

  cursor: pointer;
}


/* ==================================================
   手機版
================================================== */
@media screen and (max-width: 767px) {

  .catPhotoUpload input[type="file"] {
    padding: 7px;

    font-size: 16px;
  }

  .catPhotoUpload input[type="file"]::file-selector-button,
  .catPhotoUpload input[type="file"]::-webkit-file-upload-button {
    padding: 13px 20px;

    font-size: 16px;
  }

}
.catPhotoHint {
  margin-top: 8px;
  color: #777;
  font-size: 14px;
  line-height: 1.7;
}

.catPhotoStatus {
  display: none;
  margin-top: 12px;
  padding: 10px 14px;
  background: #f1f8f2;
  border-left: 4px solid #61a66a;
  border-radius: 6px;
  color: #3f6b45;
  line-height: 1.7;
}

.catPhotoStatus.is-show {
  display: block;
}

.catPhotoFinalPreview {
  display: none;
  width: min(320px, 100%);
  margin-top: 14px;
}

.catPhotoFinalPreview.is-show {
  display: block;
}

.catPhotoPreviewStage {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #eee;
  border-radius: 10px;
}

.catPhotoPreviewStage img.catPhotoPreviewImage,
.catPhotoPreviewStage img.catPhotoPreviewMask {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.catPhotoPreviewStage img.catPhotoPreviewImage {
  object-fit: cover;
}

.catPhotoPreviewStage img.catPhotoPreviewMask {
  pointer-events: none;
}

.catPhotoPreviewActions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.catPhotoMiniBtn {
  appearance: none;
  border: 1px solid #bbb;
  background: #fff;
  color: #444;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
}

.catPhotoMiniBtn:hover {
  background: #f7f7f7;
}

/* ===== 裁切彈窗 ===== */
.catCropModal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.72);
  box-sizing: border-box;
}

.catCropModal.is-open {
  display: flex;
}

.catCropDialog {
  width: min(760px, 100%);
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-sizing: border-box;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

.catCropTitle {
  margin: 0 0 6px;
  color: #333;
  font-size: 22px;
  font-weight: 700;
}

.catCropIntro {
  margin: 0 0 14px;
  color: #666;
  font-size: 14px;
  line-height: 1.7;
}

.catCropStage {
  position: relative;
  width: min(560px, 100%);
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  overflow: hidden;
  background: #222;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#catCropCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

.catCropOverlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.catCropControls {
  width: min(560px, 100%);
  margin: 16px auto 0;
}

.catCropQuality {
  display: none;
  margin: 0 0 12px;
  padding: 11px 14px;
  border-radius: 8px;
  line-height: 1.6;
  font-size: 14px;
}

.catCropQuality.is-show {
  display: block;
}

.catCropQuality strong {
  display: block;
  font-size: 15px;
  margin-bottom: 3px;
}

.catCropQuality small {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  opacity: 0.9;
}

.catCropQuality--good {
  background: #eff8f0;
  color: #2f6d38;
  border-left: 4px solid #67b36f;
}

.catCropQuality--ok {
  background: #f4f9ee;
  color: #547437;
  border-left: 4px solid #98bb55;
}

.catCropQuality--warn {
  background: #fff8eb;
  color: #8a6633;
  border-left: 4px solid #d6a84a;
}

.catCropQuality--low {
  background: #fff2e8;
  color: #9d5633;
  border-left: 4px solid #dd8a5b;
}

.catCropZoomRow {
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  gap: 8px;
  align-items: center;
}

.catCropZoomRow button {
  width: 36px;
  height: 36px;
  border: 1px solid #bbb;
  background: #fff;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

#catCropZoom {
  width: 100%;
}

.catCropActions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.catCropBtn {
  appearance: none;
  border: 0;
  padding: 10px 18px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
}

.catCropBtn--secondary {
  background: #e9e9e9;
  color: #444;
}

.catCropBtn--primary {
  background: #a86432;
  color: #fff;
}

.catCropError {
  display: none;
  width: 100%;
  margin: 10px auto 0;
  padding: 9px 12px;
  background: #fff2f2;
  border-radius: 6px;
  color: #b43232;
  font-size: 14px;
  line-height: 1.6;
}

.catCropError.is-show {
  display: block;
}




/* ==================================================
   畫質提示內的共用重要警語
   白底＋紅字，和外層提示做明顯區隔
================================================== */

.catCropQualityCommon {
  margin-top: 12px;
  padding: 10px 12px;

  background: #fff;
 /* border-left: 4px solid #d9534f;*/
  border-radius: 6px;

  color: #c23b32;
  font-size: 13px;
  line-height: 1.7;
}

.catCropQualityCommon::before {
  content: "⚠ 重要提醒";
  display: block;

  margin-bottom: 5px;

  color: #c23b32;
  font-size: 14px;
  font-weight: 700;
}

.catCropQualityCommon p {
  margin: 3px 0;
}

/* 每一條提醒 */
.catCropQualityCommon p {
  margin: 3px 0;
}

body.catCropLock {
  overflow: hidden;
}

@media screen and (max-width: 767px) {
  .catCropModal {
    padding: 0;
    align-items: stretch;
  }

  .catCropDialog {
    width: 100%;
    max-height: 100vh;
    min-height: 100vh;
    border-radius: 0;
    padding: 16px 14px 32px;
  }

  .catCropTitle {
    font-size: 20px;
  }

  .catCropActions {
    justify-content: stretch;
  }

  .catCropBtn {
    flex: 1 1 0;
  }
}
/* ==================================================
   手機版：放大「選擇檔案」按鈕
================================================== */
@media screen and (max-width: 767px) {

  .catPhotoUpload input[type="file"] {
    width: 100%;
    font-size: 16px;
  }

  /* Chrome / Edge / Firefox */
  .catPhotoUpload input[type="file"]::file-selector-button {
    padding: 12px 18px;
    margin-right: 10px;

    font-size: 16px;
    font-weight: 700;

    border: 0;
    border-radius: 7px;

    background: #a86432;
    color: #fff;

    cursor: pointer;
  }

  /* Safari / 部分手機瀏覽器 */
  .catPhotoUpload input[type="file"]::-webkit-file-upload-button {
    padding: 12px 18px;
    margin-right: 10px;

    font-size: 16px;
    font-weight: 700;

    border: 0;
    border-radius: 7px;

    background: #a86432;
    color: #fff;
  }
}

/* ==================================================
   修正手機版：裁切完成後預覽圖片被壓扁
================================================== */

.catPhotoPreviewStage {
  width: 100%;
  aspect-ratio: 1 / 1;
  height: auto !important;
}

.catPhotoPreviewStage .catPhotoPreviewImage,
.catPhotoPreviewStage .catPhotoPreviewMask {
  position: absolute;
  inset: 0;

  width: 100% !important;
  height: 100% !important;
  max-width: none !important;

  object-fit: cover;
}

/* 拼圖遮罩不要被其他 img CSS 影響 */
.catPhotoPreviewStage .catPhotoPreviewMask {
  object-fit: fill;
}


/* ==================================================
   手機版再強制一次
================================================== */
@media screen and (max-width: 767px) {

  .catPhotoFinalPreview {
    width: 100%;
    max-width: 320px;
  }

  .catPhotoPreviewStage {
    width: 100%;
    aspect-ratio: 1 / 1;
    height: auto !important;
  }

  .catPhotoPreviewStage .catPhotoPreviewImage {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
  }

}