/* =============================================
   訂單確認 Modal 元件樣式 (New UI)
   ============================================= */

/* --- 遮罩層 --- */
.order-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;

    /* 預設隱藏 */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.order-confirm-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

/* --- Modal 卡片 --- */
.order-confirm-modal {
    background: #fcfbfb; /* Very light background for the modal */
    border-radius: 24px;
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    position: relative;

    /* 進場動畫 */
    transform: translateY(24px) scale(0.97);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.order-confirm-overlay.is-open .order-confirm-modal {
    transform: translateY(0) scale(1);
}

/* 關閉按鈕 */
.close-modal-x {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    font-size: 24px;
    color: #888888;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 50%;
    transition: background 0.2s;
}

.close-modal-x:hover {
    background: #eeeeee;
    color: #2D2D2D;
}

/* --- 頂部標題區 --- */
.order-confirm-header {
    text-align: center;
    padding: 32px 24px 16px;
}

.order-confirm-icon-wrapper {
    margin-bottom: 8px;
    display: flex;
    justify-content: center;
}

.order-confirm-title {
    font-size: 22px;
    font-weight: 700;
    color: #8b6e5e;
    margin: 0 0 8px;
}

.order-confirm-subtitle {
    font-size: 13px;
    color: #555555;
    line-height: 1.4;
    margin: 0;
}

/* --- Body 內容區 --- */
.order-confirm-body {
    padding: 0 24px 20px;
}

/* 區塊標題 */
.order-section-title {
    font-size: 14px;
    font-weight: 700;
    color: #2D2D2D;
    margin-bottom: 12px;
    margin-top: 24px;
}
.order-confirm-body > .order-section-title:first-child {
    margin-top: 12px;
}

/* 訂單資訊表格 */
.order-meta {
    background: transparent;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.order-meta-row {
    display: flex;
    border-bottom: 1px solid #e0e0e0;
}
.order-meta-row:last-child {
    border-bottom: none;
}

.order-meta-label {
    flex: 0 0 80px;
    background: #f5f5f5;
    padding: 6px 12px;
    font-size: 13px;
    color: #555555;
    border-right: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.order-meta-value {
    flex: 1;
    background: #ffffff;
    padding: 6px 12px;
    font-size: 13px;
    color: #555555;
    text-align: right;
    word-break: break-all;
}

/* 商品明細列表 */
.order-items-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.order-item-row {
    background: #f5f5f5;
    border-radius: 8px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.order-item-img-placeholder {
    width: 48px;
    height: 48px;
    background: #e0e0e0;
    border: 1px solid #cccccc;
    border-radius: 4px;
    flex-shrink: 0;
    object-fit: cover;
}

.order-item-info {
    flex: 1;
    min-width: 0; /* allows truncation if needed */
}

.order-item-name {
    font-size: 14px;
    font-weight: 600;
    color: #2D2D2D;
    margin-bottom: 4px;
}

.order-item-spec {
    font-size: 12px;
    color: #888888;
}

.order-item-price {
    font-size: 14px;
    font-weight: 600;
    color: #555555;
    white-space: nowrap;
}

/* 優惠與運費 */
.order-discount-shipping {
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-bottom: 1px solid #2D2D2D;
    padding-bottom: 8px;
}

.order-fee-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #555555;
}

/* 應付金額 */
.order-final-total-area {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 24px;
}

.final-total-label {
    font-size: 14px;
    color: #555555;
    margin-bottom: 4px;
}

.final-total-amount {
    font-size: 24px;
    font-weight: 700;
    color: #8b6e5e;
}

/* 後續行動指示區塊 */
.order-instruction-box {
    background: #f5f5f5;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.instruction-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.instruction-steps {
    font-size: 12px;
    color: #2D2D2D;
    line-height: 1.6;
}

/* --- Footer 按鈕區 --- */
.order-confirm-footer {
    padding: 0 24px 32px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 複製訂單資訊按鈕 (帶有呼吸燈動畫) */
.copy-order-btn {
    width: 100%;
    padding: 14px;
    background: #8b6e5e;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    animation: pulseButton 1.5s infinite;
}

.copy-order-btn:hover {
    background: #7a5e50;
    animation: none; /* 滑鼠移上去時停止動畫 */
}

.copy-order-btn.copied {
    background: #4caf50;
    animation: none;
}

/* 複製按鈕內部文字狀態切換 */
.copy-order-btn .btn-text-copied { display: none; }
.copy-order-btn.copied .btn-text-default { display: none; }
.copy-order-btn.copied .btn-text-copied {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* 前往 IG 私訊按鈕 */
.go-ig-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 12px;
    background: #ffffff;
    color: #8b6e5e;
    border: 1px solid #8b6e5e;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.go-ig-btn:hover {
    background: #fdfaf8;
}

/* 呼吸燈動畫 Keyframes */
@keyframes pulseButton {
    0% {
        box-shadow: 0 0 0 0 rgba(139, 110, 94, 0.7);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(139, 110, 94, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(139, 110, 94, 0);
    }
}
