/**
 * Printing Page Styles
 * Template: page-templates/page-printing.php
 */

/* ── CSS 變量（與主題綠色調統一） ── */
:root {
    --primary-color: #46CDCF;      /* 主題品牌綠（對應 --brand） */
    --primary-dark:  #2fb1b3;      /* 深綠（對應 --brand-3） */
    --primary-light: #97e3e4;      /* 淺綠（對應 --brand-4） */
    --primary-bg:    rgba(70,205,207,.12);  /* 品牌綠背景 */
    --black:         #17393a;      /* 深色文字（對應 --ink） */
    --text:          #315455;      /* 正文色（對應 --text） */
    --muted:         #9c9c9c;      /* 次要文字（對應 --muted） */
    --red:           #dc3545;      /* 刪除/錯誤色 */
    --medium-gray:   #6c757d;      /* 中等灰色 */
    --white:         #ffffff;
    --heading-color: #17393a;
}

/* ── 步驟進度條（核心樣式） ── */
.print-steps { position: relative; }
.print-steps-track {
    position: absolute; top: 38px; left: calc(10% + 11px); right: calc(10% + 11px);
    height: 2px; background: rgba(0,0,0,0.1); border-radius: 3px; z-index: 0;
}
.print-steps-bar {
    height: 100%; background: var(--primary-color);
    border-radius: 2px; transition: width 0.45s cubic-bezier(.4,0,.2,1); width: 0%;
}
.print-steps-items { display: flex; justify-content: space-between; position: relative; z-index: 1; }
.print-step-item { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: 1; cursor: default; }

/* 步驟圓點 */
.step-dot {
    width: 80px; height: 80px; border-radius: 50%; background: white;
    border: 2px solid rgba(0,0,0,0.1); display: flex; align-items: center; justify-content: center;
    font-size: 2.4rem; font-weight: 700; color: rgba(0,0,0,0.5); transition: all 0.35s ease; position: relative;
}
.print-step-item.active .step-dot{ border-color: var(--primary-color); border-width: .4rem;}
.print-step-item.done .step-dot .fa-check:before{ display: block;}
.print-step-item .step-dot .fa-check:before,
.print-step-item.active .step-dot .fa-check:before { display: none; }
.print-step-item.done .step-dot { border-color: var(--primary-color); background: var(--primary-color); color: white; }
.step-icon-active, .step-icon-done, .step-num { position: absolute; transition: opacity 0.2s ease; }
.step-icon-active, .step-icon-done { opacity: 0; }
.step-num {  opacity: 1; font-size: 2.5rem; }
.print-step-item.active .step-num{ color: var(--primary-color);}
.print-step-item.active .step-num,
.print-step-item.active .step-icon-active ,
.print-step-item.done .step-icon-done     { opacity: 1; }
.print-step-item.done .step-num, .print-step-item.done .step-icon-active { opacity: 0; }

.step-label { font-size: 1rem; color: rgba(0,0,0,0.4); font-weight: 400; white-space: nowrap; transition: color 0.3s; }
.print-step-item.active .step-label, .print-step-item.done .step-label { color: var(--primary-color); font-weight: 600; }

/* ── 面板 ── */
@keyframes panelIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

.panel-num {
    font-size: 2.8rem; font-weight: 600; line-height: .8; min-width: 54px; letter-spacing: -2px; color:var(--black); margin: 0 .6rem 0 0;
}

/* ── 上傳區 ── */
.upload-area {
    border: 2px dashed var(--primary-color); border-radius: 12px;
    background: color-mix(in srgb, var(--primary-color) 10%, transparent); cursor: pointer; transition: all 0.3s; overflow: hidden;
}
.upload-area:hover, .upload-area.drag-over { background: white; box-shadow: 0 0 0 4px var(--primary-color); }
.upload-area-inner { padding: 2rem; text-align: center; }
.upload-area-inner i { font-size: 3.6rem; color: var(--primary-color); display: block; margin-bottom: 0.75rem; }

/* 文件列表 */
.file-list-items {
    border-bottom: 1px solid color-mix(in srgb, var(--primary-color) 30%, transparent);
    background: color-mix(in srgb, var(--primary-color) 10%, transparent);
    max-height: 400px;
    overflow-y: auto;
}
.file-list { border-top: 1px solid color-mix(in srgb, var(--primary-color) 30%, transparent); overflow: hidden; }
.file-item { display: flex; align-items: center; gap: 0.5rem; border-bottom: 1px solid color-mix(in srgb, var(--primary-color) 30%, transparent); font-size: 0.875rem; }
.file-item:last-child { border-bottom: none; }
.file-item-name { flex: 1; word-break: break-all; min-width: 0; }
.file-item-size { color: #6c757d; white-space: nowrap; }
.file-item-del  { color: var(--red); cursor: pointer; padding: 2px 6px; border-radius: 4px; transition: all 0.2s; }
.file-item-del:hover { background-color:var(--white); }
.upload-reqs i{ width: 1.4rem; text-align: center;}

/* ── 選項芯片 ── */
.option-chip {
    display: flex; flex-direction: column; align-items: center; padding: 0.65rem 1.2rem;
    border: 2px solid #e9ecef; border-radius: 10px;
    color: var(--black); cursor: pointer; transition: all 0.2s; user-select: none; background: white; min-width: 80px; text-align: center;
}
.option-chip:hover { border-color: var(--primary-color); background: color-mix(in srgb, var(--primary-color) 10%, transparent); color: var(--primary-color); }
.qtyGroup .selected .option-chip { border-color: var(--primary-color); background: var(--primary-color); color: white; }
.qtyGroup .selected .option-chip .chip-sub { color: rgba(255,255,255,0.8); }
.chip-sub { font-size: 0.8rem; font-weight: 400; color: #6c757d; margin-top: 2px; display: block; }
.option-chip .chip-sub{ color: var(--primary-color);}

/* ── 加工選項 ── */
.finishing-check {
    display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.9rem;
    border: 2px solid #e9ecef; border-radius: 8px; cursor: pointer;
    font-size: 1rem; transition: all 0.2s; user-select: none; background: white;
}
.finishing-check:hover { border-color: var(--primary-color); background: color-mix(in srgb, var(--primary-color) 10%, transparent); }
.finishing-check input[type=checkbox],
.finishing-check input[type=radio] { accent-color: var(--primary-color); width: 15px; height: 15px; }
.finishing-check:has(input:checked) { border-color: var(--primary-color); background: color-mix(in srgb, var(--primary-color) 10%, transparent); }
.finishing-check .finishing-price { color: var(--medium-gray); font-weight: 200; }
.finishing-check:has(input:checked) .finishing-price { color: var(--primary-color); }

/* ── 第二步：抽屜式分組配置 ── */
#step2FileCount {
    font-size: 0.875rem;
    padding: 0.4rem 0.8rem;
}

.v965-drawer-list {
    display: flex;
    flex-direction: column;
    border-top: 1px solid color-mix(in srgb, var(--black) 10%, transparent);
}

.fg-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}
.fg-name {
    font-weight: 500;
    color: #212529;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
}
.fg-size { color: #adb5bd; font-size: 0.72rem; }

.fg-config {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem;
    margin-top: 0.15rem;
}
.fg-badge {
    display: inline-block;
    padding: 0.1rem 0.35rem;
    border-radius: 0.25rem;
    font-size: 0.68rem;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}
.fg-size-badge { background: #e3f2fd; color: #1565c0; }
.fg-material-badge { background: #e8f5e9; color: #2e7d32; }
.fg-finish-badge { background: #fff3e0; color: #e65100; }
.fg-qty-badge { background: #f3e5f5; color: #7b1fa2; }
.fg-none-badge { background: #f8f9fa; color: #adb5bd; border: 1px dashed #dee2e6; }

#step2EmptyHint {
    display: flex;
}

.v965-step2-accordion {
    overflow: hidden;
}

@media (max-width: 767.98px) {
    .v965-drawer-list {
        gap: 0.75rem;
    }
    .v965-group-card {
        border-top: 1px solid #e9ecef;
        overflow: hidden;
    }
    .group-header-btn {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
    .option-chip {
        min-width: 70px;
        padding: 0.6rem 0.8rem;
        font-size: 0.85rem;
    }
    .chip-sub {
        font-size: 0.7rem;
    }
}

.v965-group-card {
    border-bottom: 1px solid color-mix(in srgb, var(--black) 10%, transparent);
}

.group-header-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.6rem;
    background: color-mix(in srgb, var(--black) 2%, white);
    border: none;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s;
}
.group-header-btn:focus { outline: none; box-shadow: none; }
.group-header-btn:not(.collapsed) {
    background: color-mix(in srgb, var(--primary-color) 20%, transparent);
    border-top: 2px solid color-mix(in srgb, var(--primary-color) 30%, transparent);
    border-bottom: 2px solid color-mix(in srgb, var(--primary-color) 30%, transparent);
}

.group-name-wrap {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 20%;
}
.group-card-thumb-wrap {
    width: 220px;
    height: 120px;
}
.group-card-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.group-card-icon {
    color: #adb5bd;
}

.group-name:hover { background: #e9ecef; }
.group-name-input {
    font-weight: 700;
    font-size: 0.9rem;
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    padding: 2px 4px;
    width: 120px;
}

.group-file-badge {
    font-size: 0.7rem;
    font-weight: 600;
}

.group-subtotal {
    font-size: 0.75rem;
    font-weight: 700;
}

.group-delete-btn {
    font-size: 1.2rem;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background 0.15s;
}
.group-delete-btn:hover { background: #fff0f0; }

.v965-sec-arrow {
    transition: transform 0.25s ease;
}
.group-header-btn:not(.collapsed) .v965-sec-arrow {
    transform: rotate(180deg);
}

.v965-sec-body {
    display: none;
}
.group-header-btn:not(.collapsed) + .v965-sec-body {
    display: block;
    animation: fadeSlideIn 0.2s ease-out;
}
@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.group-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ── 訂單摘要 ── */
.order-summary { background: color-mix(in srgb, var(--primary-color) 30%, transparent); border: 1px solid var(--primary-color); border-radius: 12px; padding: 1.5rem; }
.order-summary-title { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--primary-color); margin-bottom: 1rem; }
.summary-row { display: flex; justify-content: space-between; font-size: 0.875rem; padding: 0.4rem 0; }
.summary-key { color: #6c757d; }
.summary-val { font-weight: 500; color: #212529; text-align: right; max-width: 60%; word-break: break-all; }
.summary-divider { border-top: 1px dashed rgba(0,0,0,0.15); margin: 0.75rem 0; }
.summary-total-row { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 1rem; padding-top: 0.4rem; }
.summary-total-price { font-size: 1.75rem; font-weight: 900; color: var(--primary-color); }

.summary-group-block {
    padding: 0.75rem;
    background: var(--white);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    border-left: 3px solid var(--primary-color);
}
.summary-group-block[data-color="1"] { border-left-color: #2e7d32; }
.summary-group-block[data-color="2"] { border-left-color: #e65100; }
.summary-group-block[data-color="3"] { border-left-color: #7b1fa2; }
.summary-group-block[data-color="4"] { border-left-color: #1565c0; }
.summary-group-title {
    font-weight: 700;
    font-size: 0.85rem;
    color: #212529;
    margin-bottom: 0.35rem;
}
.summary-group-title .badge {
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 0.4rem;
}
.summary-group-detail {
    font-size: 0.8rem;
    color: #6c757d;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.75rem;
}
.summary-group-price {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-left: auto;
}

/* ── 成功動畫 ── */
.success-icon i { font-size: 4rem; color: var(--primary-color); animation: pop 0.5s cubic-bezier(.46,.07,.19,.97) both; }
@keyframes pop { 0% { transform: scale(0.5); opacity: 0; } 80% { transform: scale(1.1); } 100% { transform: scale(1); opacity: 1; } }
@media (max-width: 576px) {
    .panel-num { font-size: 1.8rem; min-width: 40px; }
    .option-chip { min-width: 60px; padding: 0.5rem 0.8rem; font-size: 0.85rem; }
    .summary-total-price { font-size: 1.4rem; }
    .step-label { font-size: 0.8rem; }
    .print-steps-track { top: 24px; }
    .step-dot { width: 50px; height: 50px; border: 2px solid rgba(0,0,0,0.1);font-size: 1.4rem; }
    .step-num { font-size: 1.5rem; }
}

/* ── 價格摘要 ── */
.price-summary {
    background: #f8f9fa;
    border-radius: 0.75rem;
    padding: 1rem;
}
.price-summary .text-secondary {
    color: #6c757d !important;
}
.price-summary .border-top {
    border-color: #dee2e6 !important;
}

/* ── 價格公式化展示 ── */
.price-formula-wrap {
    background: #f8f9fa;
}
.price-formula-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}
.formula-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
}
.formula-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--heading-color, #444);
    line-height: 1.2;
}
.formula-label {
    font-size: 0.7rem;
    color: #999;
    white-space: nowrap;
    margin-top: 2px;
}
.formula-operator {
    font-size: 1.1rem;
    font-weight: 700;
    color: #a2a2a2;
    padding-bottom: 16px;
}
.formula-total {
    padding: 6px 14px 4px;
}
.formula-total-value {
    color: var(--primary-color) !important;
    font-size: 1.4rem !important;
}
.formula-total .formula-label {
    color: #999;
}

/* ── 文件摘要橫幅 ── */
.file-summary-banner {
    background: #f8f9fa;
    border-radius: 0.75rem;
    padding: 1rem;
}
.file-summary-banner .badge {
    font-weight: 500;
}

/* ── 垂直滾輪選擇器 ── */
.vertical-picker-container {
    display: flex;
    height: 260px;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    border: 1px solid #dee2e6;
}
.vertical-picker-column {
    flex: 1;
    position: relative;
    overflow: hidden;
    border-right: 1px solid #e0e0e0;
}
.vertical-picker-column:last-child {
    border-right: none;
}
.vertical-picker-column::before {
    content: attr(data-title);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 13px;
    color: #666;
    background: #fff;
    padding: 10px 0;
    z-index: 2;
}
.vertical-picker-scroll {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-top: 104px;
    padding-bottom: 104px;
}
.vertical-picker-scroll::-webkit-scrollbar {
    display: none;
}
.vertical-picker-item {
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    scroll-snap-align: center;
    cursor: pointer;
    transition: all 0.2s;
    color: #333;
    user-select: none;
}
.vertical-picker-item:hover {
    background: #f5f5f5;
}
.vertical-picker-item.selected {
    background: var(--black);
    color: #fff;
    font-weight: 600;
}
.vertical-picker-column::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 52px;
    transform: translateY(-50%);
    border-top: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
    pointer-events: none;
    z-index: 1;
}
@media (max-width: 576px) {
    .vertical-picker-container {
        height: 260px;
    }
    .vertical-picker-item {
        height: 52px;
        font-size: 14px;
    }
    .vertical-picker-column::after {
        height: 52px;
    }
    .site-footer .card{
        display: flex!important;
        flex-direction:column!important; 
    }
}

/* ── 覆寫 Bootstrap 藍色爲品牌綠色 ── */
.btn-primary {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
}
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background-color: var(--primary-dark) !important;
    border-color: var(--primary-dark) !important;
}
.btn-outline-primary {
    color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    border: 1px solid var(--primary-color);
}
.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: #fff !important;
}
.text-primary {
    color: var(--primary-color) !important;
}
.border-primary {
    border-color: var(--primary-color) !important;
}
.bg-primary {
    background-color: var(--primary-color) !important;
}
.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 0.25rem rgba(70, 205, 207, 0.25) !important;
}
/* 頁面標題區域 */
.entry-header h1 {
    color: var(--black);
}
.entry-header .text-muted {
    color: var(--text) !important;
}

/* ── 版頭版尾：修復 Bootstrap 全局樣式干擾 ── */

/* 1. container 重置爲主題定義：清除 Bootstrap 的 max-width 和 padding */
.container {
    max-width: none;
    padding-left: 0;
    padding-right: 0;
}
/* 版尾容器保持自有 padding */
.site-footer .container {
    padding: 22px 36px;
}

/* 2. 版尾 .card 覆蓋 Bootstrap 的 flex-direction: column */
.site-footer .card {
    display: flex;
    flex-direction: row;
    position: static;
    min-width: auto;
    height: auto;
    word-wrap: normal;
    background-clip: unset;
}

/* 3. 頁頭按鈕不被 Bootstrap 的 .btn 干擾 */
.site-header .btn {
    border-radius: 999px;
    font-weight: 800;
    transition: transform 0.28s ease, box-shadow 0.28s ease, background 0.28s ease, border-color 0.28s ease;
}

/* 4. 所有 section 重置 Padding（Bootstrap 不設 padding，但保險起見） */
section {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* 5. 鏈接不顯示下劃線（Bootstrap 默認下劃線） */
a:not(.btn) {
    text-decoration: none !important;
}

/* 6. h3/p 間距與主題統一 */
.sg-body h3 {
    margin: 0;
    font-weight: 700;
}
.sg-body p {
    margin: 0;
}
