/**
 * DY Signature — 簽名板樣式（適用於手機／微信／桌面）
 * 與 assets/js/dy-signature.js 配套
 */

/* 簽名畫布：阻擋頁面滾動、選取與長按選單 */
.dy-sig-canvas,
.dy-sig-modal-canvas {
    display: block;
    width: 100%;
    background: #FFFFFF;
    touch-action: none;
    -ms-touch-action: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: contain;
}

.dy-sig-canvas {
    height: 180px;
    border: 1px dashed #CBD5E1;
    border-radius: 12px;
    cursor: crosshair;
}

/* 工具列（放大簽名 / 清除重簽；「上傳簽名圖片」預設停用，僅於開啟 fallbackUpload 時出現） */
.dy-sig-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.dy-sig-btn {
    -webkit-appearance: none;
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 16px;
    border: 1px solid #CBD5E1;
    border-radius: 10px;
    background: #F8FAFC;
    color: #334155;
    font-size: 15px;
    line-height: 1.2;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.dy-sig-btn:active {
    background: #E2E8F0;
}

.dy-sig-btn-primary {
    background: #2563EB;
    border-color: #2563EB;
    color: #FFFFFF;
}

.dy-sig-btn-primary:active {
    background: #1D4ED8;
}

.dy-sig-upload {
    position: relative;
    overflow: hidden;
}

/* 提示與錯誤 */
.dy-sig-hint {
    margin-top: 6px;
    font-size: 13px;
    color: #64748B;
}

.dy-sig-error {
    margin-top: 8px;
    font-size: 14px;
    line-height: 1.6;
    color: #DC2626;
}

/* 全屏簽名 */
.dy-sig-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    background: rgba(15, 23, 42, 0.78);
    box-sizing: border-box;
    overscroll-behavior: contain;
    overflow: hidden;
}

/* 直向持機時：整個放大框旋轉 90°，即時以橫向全屏書寫 */
.dy-sig-modal.is-rotated {
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    transform: translate(-50%, -50%) rotate(90deg);
    -webkit-transform: translate(-50%, -50%) rotate(90deg);
    transform-origin: center center;
    -webkit-transform-origin: center center;
}

.dy-sig-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #FFFFFF;
    font-size: 16px;
    font-weight: 600;
}

.dy-sig-modal-close {
    -webkit-appearance: none;
    appearance: none;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.16);
    color: #FFFFFF;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

/* 簽名舞台：佔滿標題列與按鈕列以外的全部空間 */
.dy-sig-modal-stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    overflow: hidden;
}

.dy-sig-modal-canvas {
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    border-radius: 12px;
    border: none;
    margin: 0;
}

.dy-sig-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: auto;
}

.dy-sig-modal-actions .dy-sig-btn {
    flex: 1 1 0;
    max-width: 200px;
    background: #FFFFFF;
    border-color: #FFFFFF;
}

.dy-sig-modal-actions .dy-sig-btn-primary {
    background: #2563EB;
    border-color: #2563EB;
    color: #FFFFFF;
}

@media (max-width: 768px) {
    .dy-sig-canvas {
        height: 150px;
    }
}
