﻿/* [2026-04-15] 目的：雲端印刷檔彈窗（UploadPhotoPopup）樣式獨立為元件，供商品詳情與編輯器等多頁引用 */
/* [2026-04-17] 目的：手機阻斷捲動串接到底層（overscroll-behavior）；內層列表區慣性捲動（-webkit-overflow-scrolling） */
/* [2026-04-17] 目的：可捲範圍擴及「取消／確認」以上整段（標題列＋工具列＋用量＋檔案區），避免僅半張卡高度可滑 */

#UploadPhotoPopup.PopupWindow {
    overscroll-behavior: contain;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

#UploadPhotoPopup .PopupContent {
    width: min(1020px, 92vw);
    max-height: calc(100vh - 32px);
    height: min(780px, calc(100vh - 32px)) !important;
    margin: 0;
    padding: 0;
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    box-shadow: 0 24px 56px rgba(0, 0, 0, 0.16);
    overflow: hidden;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#UploadPhotoPopup .PopupContent > .nipLine {
    flex-shrink: 0;
}

#UploadPhotoPopup .PopupTitleTr {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    background: #fff;
    font-size: 16px;
    font-weight: 900;
    color: var(--text, #111);
}

#UploadPhotoPopup .PopupSubContent {
    padding: 0 18px 16px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1 1 auto;
    overflow: hidden;
}

#UploadPhotoPopup .PopupSubContent > .upload-drive-layout {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
}

#UploadPhotoPopup .PopupSubContent > .PopupLine {
    flex-shrink: 0;
}

#UploadPhotoPopup .PopupSubContent > .FuncBlock {
    flex-shrink: 0;
}

#UploadPhotoPopup .upload-drive-layout__head {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 12px;
}

#UploadPhotoPopup .upload-drive-layout__title {
    font-size: 18px;
    line-height: 1.35;
    font-weight: 900;
    color: var(--text, #111);
}

#UploadPhotoPopup .upload-drive-layout__sub {
    font-size: 13px;
    line-height: 1.6;
    color: var(--muted, #6b7280);
}

#UploadPhotoPopup .upload-drive-source-tabs {
    display: inline-flex;
    align-self: flex-start;
    gap: 4px;
    padding: 4px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.06);
}

#UploadPhotoPopup .upload-drive-source-tab {
    min-width: 128px;
    height: 34px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: #475569;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 900;
}

#UploadPhotoPopup .upload-drive-source-tab b {
    min-width: 22px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.08);
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    line-height: 1;
}

#UploadPhotoPopup .upload-drive-source-tab.is-active {
    background: #fff;
    border-color: rgba(15, 23, 42, 0.08);
    color: #0f172a;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

#UploadPhotoPopup .upload-drive-source-tab.is-active b {
    background: #f97316;
    color: #fff;
}

#UploadPhotoPopup .upload-drive-toolbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    gap: 10px;
    align-items: center;
}

#UploadPhotoPopup .upload-drive-toolbar__upload {
    height: 36px;
    border-radius: 9px;
    border: 1px solid var(--border-soft);
    background: #111;
    color: #fff;
    font-size: 13px;
    font-weight: 900;
    padding: 0 14px;
    cursor: pointer;
}

#UploadPhotoPopup .upload-drive-toolbar__search-wrap {
    min-width: 0;
}

#UploadPhotoPopup .upload-drive-toolbar__search,
#UploadPhotoPopup .upload-drive-toolbar__sort {
    width: 100%;
    height: 36px;
    border-radius: 9px;
    border: 1px solid var(--border-soft);
    background: rgba(255, 255, 255, 0.92);
    color: #111;
    font-size: 13px;
    font-weight: 700;
    padding: 0 12px;
    outline: none;
}

#UploadPhotoPopup .upload-drive-toolbar__search-btn {
    height: 36px;
    border-radius: 9px;
    border: 1px solid var(--border-soft);
    background: #fff;
    color: #111;
    font-size: 13px;
    font-weight: 800;
    padding: 0 12px;
    cursor: pointer;
}

#UploadPhotoPopup .upload-drive-toolbar__sort {
    min-width: 138px;
}

/* [2026-04-15] 目的：雲端庫彙總用量列（檔數、印素、寬×高加總） */
#UploadPhotoPopup .upload-drive-usage {
    font-size: 12px;
    line-height: 1.55;
    font-weight: 700;
    color: var(--muted, #6b7280);
    padding: 8px 12px;
    border-radius: 10px;
    background: rgba(17, 17, 17, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

#UploadPhotoPopup .upload-drive-file-input {
    display: none !important;
}

#UploadPhotoPopup #UploadPhotoBlock {
    height: auto;
    max-height: min(46vh, 430px);
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 12px 0 10px;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.66);
}

#UploadPhotoPopup .UploadPhotoBlockInner {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 14px;
    padding: 12px;
}

#UploadPhotoPopup .upload-drive-col {
    min-width: 0;
    width: 100%;
}

#UploadPhotoPopup .upload-drive-col__title {
    font-size: 13px;
    font-weight: 900;
    color: var(--text, #111);
    margin-bottom: 8px;
}

#UploadPhotoPopup .upload-drive-col__hint {
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--muted, #6b7280);
}

#UploadPhotoPopup .DrvierUploadDiv {
    width: 100%;
    height: 164px;
    border: 1px dashed rgba(31, 111, 235, 0.45);
    border-radius: 12px;
    background: rgba(31, 111, 235, 0.05);
    float: none;
    margin: 0;
    display: block;
    vertical-align: top;
}

#UploadPhotoPopup .DriverUPLabel {
    width: 100%;
    height: 100%;
    display: block;
    padding-right: 0;
}

#UploadPhotoPopup .PrintUpload {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    border-radius: 12px;
    color: transparent;
}

#UploadPhotoPopup #DriveFileContenter {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    gap: 12px;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    margin-left: 0;
    vertical-align: top;
    min-height: 148px;
}

#UploadPhotoPopup #DriveFileContenter .ModulePhoto {
    width: 100%;
    height: auto;
    min-height: 164px;
    margin: 0;
    float: none;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
    text-align: left;
}

#UploadPhotoPopup #DriveFileContenter .ModulePhoto.is-selected {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
}

#UploadPhotoPopup #DriveFileContenter .ModulePhoto.is-selected .drive-card__img-wrap::after {
    content: "已選";
    position: absolute;
    left: 8px;
    bottom: 8px;
    padding: 4px 8px;
    border-radius: 999px;
    background: #2563eb;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
}

#UploadPhotoPopup #DriveFileContenter .ModulePhoto .DriveIMG {
    width: 100%;
    height: 112px;
    display: block;
    object-fit: contain;
    filter: drop-shadow(0 0 1px rgba(15, 23, 42, 0.6));
}

#UploadPhotoPopup #DriveFileContenter .ModulePhoto .DriverPhotoDel {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(17, 17, 17, 0.78);
    color: #fff;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 12px;
    cursor: pointer;
}

#UploadPhotoPopup #DriveFileContenter .ModulePhoto .FileName {
    width: calc(100% - 20px);
    margin: 10px 10px 8px;
    float: none;
    display: block;
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    padding: 6px 8px;
    font-size: 12px;
    line-height: 1.3;
}

#UploadPhotoPopup #DriveFileContenter .ModulePhoto .Button {
    float: none;
    width: calc(100% - 20px);
    margin: 0 10px 10px;
    min-height: 30px;
    font-size: 12px;
    line-height: 30px;
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    text-align: center;
    background: #f7f8fb;
}

#UploadPhotoPopup .upload-drive-empty {
    margin-top: 10px;
    padding: 14px 12px;
    border-radius: 10px;
    border: 1px dashed var(--border-soft);
    background: rgba(255, 255, 255, 0.7);
    color: var(--muted, #6b7280);
    font-size: 13px;
    line-height: 1.6;
    text-align: center;
}

#UploadPhotoPopup .upload-drive-more {
    margin-top: 12px;
    text-align: center;
}

#UploadPhotoPopup .upload-drive-more__btn {
    height: 34px;
    border-radius: 9px;
    border: 1px solid var(--border-soft);
    background: #fff;
    color: #111;
    font-size: 13px;
    font-weight: 800;
    padding: 0 14px;
    cursor: pointer;
}

#UploadPhotoPopup .FuncBlock {
    text-align: right;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-soft);
    background: #fff;
}

#UploadPhotoPopup .FuncBlockInline {
    display: inline-flex;
    gap: 10px;
}

#UploadPhotoPopup .FuncBlockInline .Button {
    width: auto;
    min-width: 84px;
    height: 34px;
    line-height: 34px;
    border-radius: 8px;
    border: 1px solid var(--border-soft);
    background: #fff;
    font-size: 13px;
    font-weight: 800;
    padding: 0 12px;
    float: none;
    cursor:pointer;
}

/* 卡片圖片區 - position:relative 讓刪除／預覽按鈕正確定位 */
#UploadPhotoPopup #DriveFileContenter .ModulePhoto .drive-card__img-wrap {
    position: relative;
    background-color: #fff;
    background-image:
        linear-gradient(45deg, #e5e7eb 25%, transparent 25%),
        linear-gradient(-45deg, #e5e7eb 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e5e7eb 75%),
        linear-gradient(-45deg, transparent 75%, #e5e7eb 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    border-bottom: 1px solid #cbd5e1;
    overflow: hidden;
}

/* 預覽按鈕（左上角，與刪除按鈕對稱） */
#UploadPhotoPopup #DriveFileContenter .ModulePhoto .DriverPhotoPreview {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(17, 17, 17, 0.72);
    color: #fff;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 12px;
    cursor: pointer;
    user-select: none;
}

/* 上傳中遮罩 */
#UploadPhotoPopup .PopupContent {
    position: relative;
}

.drive-uploading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 30;
    border-radius: 16px;
}

.drive-uploading-overlay__box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.drive-uploading-overlay__spinner {
    width: 38px;
    height: 38px;
    border: 3px solid rgba(17, 17, 17, 0.15);
    border-top-color: #111;
    border-radius: 50%;
    animation: driveSpinAnim 0.72s linear infinite;
}

@keyframes driveSpinAnim {
    to { transform: rotate(360deg); }
}

.drive-uploading-overlay__text {
    font-size: 14px;
    font-weight: 800;
    color: #111;
    letter-spacing: 0.02em;
}

/* 預覽全圖遮罩 */
.drive-preview-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 30;
    border-radius: 16px;
    cursor: zoom-out;
}

.drive-preview-overlay__img {
    max-width: 88%;
    max-height: 84%;
    object-fit: contain;
    border-radius: 8px;
    cursor: default;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

.drive-preview-overlay__close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    font-size: 16px;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

@media (max-width: 820px) {
    #UploadPhotoPopup .upload-drive-toolbar {
        grid-template-columns: 1fr;
    }
    #UploadPhotoPopup .UploadPhotoBlockInner {
        grid-template-columns: 1fr;
    }
}
/* [2026-08-03] 目的：簡易編輯器共用 Drive 元件時，AI 商品照縮圖提供一致的雲端儲存按鈕。 */
.design-overlay .ai-photo-result__save {
    position: absolute;
    z-index: 3;
    top: 8px;
    right: 58px;
    border: 1px solid rgba(255,255,255,.9);
    border-radius: 7px;
    background: rgba(37,99,235,.9);
    color: #fff;
    padding: 5px 9px;
    cursor: pointer;
    font-size: 12px;
}
.design-overlay .ai-photo-result__save:hover { background: #1d4ed8; }
.design-overlay .ai-photo-result__save:disabled { cursor: default; opacity: .8; }
