/* ==========================================================================
   iSee Education — 購買表單 main.css
   重構版本 2026-05
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@100..900&display=swap');

/* ── Reset ── */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Noto Sans TC', sans-serif;
}

/* ── Page ── */
body {
    background: linear-gradient(90deg, #F7F2E4, #F7F2E4);
    /* FIX 1: wrapper 頂天立地，body 無上下留白 */
    min-height: 100vh;
}

.wrapper {
    max-width: 1200px;
    margin: auto;
    background: #fff;
    box-shadow: 0 0 10px #e1d3aa, 0 0 20px #e1d3aa;
    /* FIX 1: 移除 padding-top，wrapper 從頂部起算不留空白 */
    padding-bottom: 40px;
}

/* ── Version badge ── */
.version {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 16px;
    color: #9c8673;
}

/* ==========================================================================
   Header
   ========================================================================== */

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    /* FIX 1: margin-top: 0 讓 header 貼齊頂部 */
    padding: 10px 50px;
    border-bottom: 2px solid #064F43;
    width: 80%;
    margin: 0 auto;
}

.header img {
    width: 350px;
}

.header h1 {
    color: #064F43;
    font-size: 30px;
    /* 原版字體大小 */
    letter-spacing: 2px;
    line-height: 40px;
    font-weight: 700;
    padding: 20px 0 0 0;
}

/* 返回上一頁（header 底線下方） */
.prev {
    width: 80%;
    margin: 10px auto 0;
    padding: 0 50px;
}

.prev a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #064F43;
    font-weight: 500;
    font-size: 18px;
    /* 原版字體大小 */
    text-decoration: none;
}

.prev a svg {
    padding: 0 10px 3px;
    width: 40px;
    height: 40px;
    transform: translateY(3px);
    transition: transform 0.4s;
}

.prev a:hover svg {
    transform: translate(-10px, 3px);
}

/* 類別 */
.class_name {
    text-align: center;
    font-size: 24px;
    /* 原版字體大小 */
    font-weight: 500;
    padding: 30px 0 6px;
}

.class_name br {
    display: none;
}

.p_inline {
    display: inline;
}

/* 提示文字 */
.form-notice {
    text-align: center;
    font-size: 18px;
    /* 原版字體大小對齊 .item p */
    color: #064F43;
    font-weight: 500;
    letter-spacing: 0.5px;
    padding: 0 40px 28px;
}

/* ==========================================================================
   Section Card
   ========================================================================== */

.section-card {
    margin: 0 32px 28px;
    border: 1px solid #e8e0cc;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(6, 79, 67, 0.06);
}

.section-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 22px;
    background: #f9f7f2;
    border-bottom: 1px solid #e8e0cc;
}

.section-head-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #E1F5EE;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
    color: #064F43;
}

.section-head-text h3 {
    font-size: 22px;
    /* 原版 .title h3 字體大小 */
    font-weight: 700;
    color: #064F43;
    letter-spacing: 2px;
    margin: 0;
}

.section-head-text p {
    font-size: 14px;
    color: #888;
    margin: 4px 0 0;
}

.section-body {
    padding: 24px 30px;
    background: #fff;
}

.section-divider {
    height: 1px;
    background: #eee;
    margin: 20px 0;
}

.sub-section-title {
    font-size: 14px;
    font-weight: 700;
    color: #888;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 12px;
}

/* ==========================================================================
   Field rows & items
   ========================================================================== */

.field-row {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin-bottom: 20px;
}

.field-row:last-child {
    margin-bottom: 0;
}

.field-item {
    flex: 1;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 10px auto;
}

.field-item.full {
    flex: 1 1 100%;
}

/* ── label ── */
.field-item label,
.field-item>label {
    font-size: 18px;
    /* 原版 .item label 字體大小 */
    font-weight: 400;
    line-height: 28px;
    color: #3c3c3c;
    display: flex;
    align-items: center;
    margin: 0;
}

/* ── 必填 ok icon ── */
.ok {
    position: relative;
    display: inline-flex;
    width: 20px;
    height: 20px;
    margin-right: 6px;
    flex-shrink: 0;
    transform: translateY(-5px);
}

.ok i:nth-child(1) {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
    color: #ff256e;
    font-size: 15px;
    /* 原版字體大小 */
    transition: 1s;
}

.ok i:nth-child(2) {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 9;
    transform: rotate(-180deg);
    color: #00AA00;
    font-size: 15px;
    /* 原版字體大小 */
    opacity: 0;
    visibility: hidden;
    transition: 1s;
}

/* ── input（四邊框線） ── */
.field-item input[type="text"],
.field-item input[type="email"],
.field-item input[type="number"],
.section-body input[type="text"],
.section-body input[type="email"] {
    width: 100%;
    height: 44px;
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 5px 15px;
    font-size: 18px;
    /* 原版 .item input 字體大小 */
    color: #3c3c3c;
    background: #fff;
    transition: border-color 0.25s;
    outline: none;
}

.field-item input[type="text"]:focus,
.field-item input[type="email"]:focus,
.section-body input[type="text"]:focus {
    border-color: #064F43;
    border-width: 2px;
}

.field-item input:valid:not(:placeholder-shown),
.section-body input:valid:not(:placeholder-shown) {
    border: 2px solid #00AA00;
    border-radius: 5px;
    transition: 0.7s;
}

/* ── select（四邊框線） ── */
.field-item select,
.section-body select {
    width: 100%;
    height: 44px;
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 0 12px;
    font-size: 18px;
    /* 原版字體大小 */
    color: #3c3c3c;
    background: #fff;
    outline: none;
    transition: border-color 0.25s;
    appearance: auto;
}

.field-item select:focus,
.section-body select:focus {
    border-color: #064F43;
    border-width: 2px;
}

.field-item select:valid,
.section-body select:valid {
    border: 2px solid #00AA00;
    transition: 1s;
}

/* ── 生日三欄橫排 ── */
.date-selects {
    display: flex;
    gap: 10px;
}

.date-selects select {
    flex: 1;
}

/* ==========================================================================
   取貨方式
   ========================================================================== */

#pickupMethod {
    width: 100%;
}

/* ── 貨運展開區塊 ── */
.freight-block {
    display: none;
    width: 100%;
    margin-top: 15px;
    padding: 15px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.freight-block label {
    font-size: 18px;
    /* 原版字體大小 */
    color: #3c3c3c;
    font-weight: 400;
    white-space: nowrap;
    margin-top: 5px;
}

.freight-block #commCity {
    height: 40px;
    min-width: 120px;
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 7px 10px;
    font-size: 16px;
    background: #fff;
    outline: none;
}

.freight-block #connection-address {
    flex: 1;
    min-width: 240px;
    height: 40px;
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 7px 10px;
    font-size: 16px;
    background: #fff;
    outline: none;
}

/* ==========================================================================
   是/否 — 滿版 Radio Cards
   ========================================================================== */

.yn-row {
    display: flex;
    gap: 12px;
    width: 100%;
}

.yn-card {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.yn-card:has(input:checked) {
    border: 2px solid #064F43;
    background: #f0faf6;
}

.yn-card input[type="radio"] {
    display: none;
}

.yn-card p {
    font-size: 18px;
    /* 原版字體大小 */
    font-weight: 500;
    color: #3c3c3c;
    cursor: pointer;
    margin: 0;
}

/* ==========================================================================
   媒體來源 — Chip 多選
   ========================================================================== */

.chip-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

/* inline div：flex 排列讓 checkbox 緊跟 label */
.chip-wrap .inline {
    display: inline-flex;
    align-items: center;
}

/* checkbox 隱藏，由 label 視覺呈現 */
.chip-wrap .inline input[type="checkbox"] {
    display: none;
}

.chip-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 16px;
    color: #555;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
    user-select: none;
    line-height: 28px;
    margin: 0;
}

/* checkbox 選中時，相鄰的 label 套高亮樣式 */
.chip-wrap .inline input[type="checkbox"]:checked+.chip-label {
    border-color: #064F43;
    background: #E1F5EE;
    color: #064F43;
    font-weight: 500;
}

.chip-label.chip-other {
    gap: 8px;
}

.chip-other-input {
    width: 130px !important;
    height: 28px !important;
    border: none !important;
    border-bottom: 1px solid #aaa !important;
    border-radius: 0 !important;
    padding: 2px 6px !important;
    font-size: 14px !important;
    background: transparent !important;
    outline: none;
}

/* ==========================================================================
   注意 Banner（紅色系）
   ========================================================================== */

.alert-banner {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: #FFF0F0;
    border: 1px solid #FFBDBD;
    border-radius: 6px;
    padding: 12px 16px;
    font-size: 14px;
    /* 原版 .item p 字體大小 */
    font-weight: bold;
    color: #993C1D;
    margin-bottom: 20px;
}

.alert-banner i {
    font-size: 14px;
    color: #D85A30;
    flex-shrink: 0;
}

/* ==========================================================================
   商品選購區塊
   ========================================================================== */

.products-container {
    width: 100%;
    margin-bottom: 4px;
}

.product-item-row {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    padding: 16px;
    border: 1px solid #e8e0cc;
    border-radius: 10px;
    margin-bottom: 15px;
    background: #fcfcfc;
}

.product-item-row:last-child {
    margin-bottom: 0;
}

/* FIX 3: 圖片區用 position:relative，img 絕對定位蓋住 placeholder */
.product-img-box {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

/* FIX 3: placeholder icon 正常流內顯示 */
.product-img-placeholder {
    font-size: 32px;
    color: #ccc;
}

/* FIX 3: 預覽圖絕對定位蓋住 placeholder，show() 後顯示 */
.product-preview-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none;
    /* JS .show() 會改為 block */
    background: #fff;
    border-radius: 7px;
}

/* 選單區 */
.select-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.select-wrapper label {
    font-size: 18px;
    /* 原版字體大小 */
    font-weight: bold;
    color: #3c3c3c;
    margin: 0;
    display: block;
}

/* FIX 6: 商品 select 無 required，強制保持灰色邊框，不顯示綠框 */
.product-select,
.book-select {
    width: 100%;
    height: 44px;
    border: 1px solid #ccc !important;
    border-radius: 5px;
    padding: 0 10px;
    font-size: 16px;
    background: #fff;
    color: #3c3c3c;
    outline: none;
}

.product-select:focus,
.book-select:focus {
    border-color: #064F43 !important;
    border-width: 2px !important;
}

/* 數量區 */
.qty-wrapper {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.qty-wrapper label {
    font-size: 18px;
    /* 原版字體大小 */
    font-weight: bold;
    color: #3c3c3c;
    margin: 0;
    display: block;
}

/* FIX 6: 數量 input 同樣不顯示綠框 */
.product-qty {
    width: 80px;
    height: 44px;
    border: 1px solid #ccc !important;
    border-radius: 5px;
    padding: 0 10px;
    font-size: 18px;
    text-align: center;
    background: #fff;
    outline: none;
}

.product-qty:focus {
    border-color: #064F43 !important;
    border-width: 2px !important;
}

/* ==========================================================================
   繳費方式 — Card-style Radio
   ========================================================================== */

.pay-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
}

.pay-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    /* FIX 4: icon 與文字之間有明確空隙 */
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.pay-card:has(input:checked) {
    border: 2px solid #064F43;
    background: #f0faf6;
}

.pay-card input[type="radio"] {
    display: none;
}

/* FIX 4: icon box 加 margin-right 確保與文字區隔 */
.pay-card>i {
    font-size: 20px;
    color: #888;
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    background: #f3f3f3;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 4px;
    /* FIX 4 */
    transition: background 0.2s, color 0.2s;
}

.pay-card:has(input:checked)>i {
    background: #9FE1CB;
    color: #085041;
}

.pay-title {
    font-size: 18px;
    /* 原版字體大小 */
    font-weight: 500;
    color: #3c3c3c;
}

.pay-sub {
    font-size: 14px;
    color: #888;
    margin-top: 2px;
}

/* ==========================================================================
   發票 — 三聯式展開區塊
   ========================================================================== */

.invoice-three-part-block {
    display: none;
    width: 100%;
    margin-top: 15px;
    padding: 15px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    flex-wrap: wrap;
    gap: 15px;
}

.invoice-three-part-block .field-item label {
    font-size: 18px;
}

/* ==========================================================================
   安全聲明
   ========================================================================== */

.safety-scrollbox {
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 15px;
    background: #fcfcfc;
    font-size: 16px;
    /* 原版字體稍大，確保家長好讀 */
    line-height: 1.9;
    color: #555;
    margin-bottom: 15px;
}

.safety-scrollbox ol {
    padding-left: 20px;
    margin-bottom: 0;
}

.safety-scrollbox ol li {
    margin: 10px auto;
}

.agree-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
}

.safety-checkbox {
    width: 20px !important;
    height: 20px !important;
    border-radius: 4px;
    flex-shrink: 0;
    accent-color: #064F43;
    cursor: pointer;
    vertical-align: middle;
}

.safety-label {
    font-size: 18px;
    /* 原版字體大小 */
    font-weight: bold !important;
    color: #3c3c3c;
    cursor: pointer;
    margin: 0;
    display: inline !important;
    vertical-align: middle;
}

/* ==========================================================================
   送出按鈕
   ========================================================================== */

.sent {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 50px 0;
    gap: 0;
}

#checkBtn {
    background-color: #064F43;
    color: #fff;
    width: 300px;
    margin: 0 auto 10px;
    padding: 10px 40px;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: background-color 0.5s;
    letter-spacing: 1px;
}

#checkBtn:hover {
    background-color: #048e77;
    transition: 0.5s;
}

.sent p {
    color: #F14232;
    font-weight: 500;
    font-size: 16px;
    text-align: center;
    line-height: 30px;
}

/* ==========================================================================
   Modal
   ========================================================================== */

.layout_title {
    font-size: 18px;
    text-align: center;
    letter-spacing: 2px;
    color: #9b9b9b;
    margin: 15px auto 50px;
}

.layout_title::before {
    content: "----------";
}

.layout_title::after {
    content: "----------";
}

.information {
    display: flex;
}

.information h5 {
    font-weight: 500;
    color: #252525;
    font-size: 20px;
    margin: 0 10px;
    width: 25%;
}

.information p {
    font-size: 20px;
    color: #3c3c3c;
    transform: translateY(-2px);
    width: 75%;
}

.information p.checkFinalTotalPrice {
    color: #C91010;
    font-weight: 700;
    font-size: 24px;
}

/* ==========================================================================
   RWD — Tablet（≤ 860px）
   FIX 5: 表單置中，左右有對稱空隙
   ========================================================================== */

@media (max-width: 860px) {

    .wrapper {
        width: 100%;
        overflow: hidden;
    }

    /* FIX 5: header 置中，左右對稱 */
    .header {
        width: 90%;
        padding: 10px 0;
        margin: 0 auto;
    }

    .header img {
        width: 40%;
    }

    .header h1 {
        font-size: 22px;
        line-height: 28px;
    }

    /* FIX 5: prev 置中，與 header 同寬 */
    .prev {
        width: 90%;
        margin: 8px auto 0;
        padding: 0;
    }

    .class_name {
        font-size: 20px;
    }

    .form-notice {
        font-size: 16px;
        padding: 0 30px 24px;
    }

    /* FIX 5: section-card 左右對稱小空隙 */
    .section-card {
        margin: 0 20px 20px;
    }

    .section-body {
        padding: 18px 20px;
    }

    /* 收件地址：縣市 + 地址改垂直排 */
    .freight-block {
        flex-direction: column;
        align-items: flex-start;
    }

    .freight-block #connection-address {
        min-width: 0;
        width: 100%;
    }

    .freight-block #commCity {
        width: 150px;
    }

    /* 商品列 */
    .product-item-row {
        gap: 12px;
        padding: 14px;
    }

    /* 繳費 */
    .pay-title {
        font-size: 16px;
    }
}

/* ==========================================================================
   RWD — Mobile（≤ 450px）
   FIX 5: 表單滿版，無左右空隙
   ========================================================================== */

@media (max-width: 450px) {

    /* FIX 5: header 滿版 */
    .header {
        width: 100%;
        padding: 10px 16px;
        margin: 0;
        justify-content: space-between;
    }

    .header img {
        width: 100%;
        max-width: 200px;
    }

    .header h1 {
        font-size: 20px;
        letter-spacing: 1px;
    }

    /* FIX 5: prev 滿版 */
    .prev {
        width: 100%;
        padding: 0 16px;
        margin: 8px 0 0;
    }

    .prev a {
        font-size: 16px;
    }

    .class_name {
        font-size: 20px;
    }

    .class_name br {
        display: initial;
    }

    .form-notice {
        font-size: 14px;
        padding: 0 16px 20px;
    }

    /* FIX 5: section-card 滿版，不留左右空隙 */
    .section-card {
        margin: 0 0 16px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .section-head {
        padding: 12px 16px;
    }

    .section-head-text h3 {
        font-size: 20px;
    }

    .section-head-text p {
        font-size: 12px;
        margin: 5px auto 0;
    }

    .section-body {
        padding: 16px;
    }

    /* 欄位：全部單欄 */
    .field-item {
        flex: 1 1 100%;
        min-width: 0;
    }

    .field-item label,
    .field-item>label {
        font-size: 16px;
    }

    .field-item input[type="text"],
    .field-item input[type="email"],
    .field-item input[type="number"],
    .section-body input[type="text"] {
        font-size: 16px;
        height: 42px;
    }

    .field-item select,
    .section-body select {
        font-size: 16px;
        height: 42px;
    }

    /* 生日 */
    .date-selects {
        gap: 6px;
    }

    /* yn cards */
    .yn-card label {
        font-size: 16px;
    }

    /* chips */
    .chip-label {
        font-size: 14px;
        padding: 5px 12px;
    }

    /* 商品列：垂直堆疊 */
    .alert-banner {
        font-size: 12px;
    }

    .alert-banner i {
        font-size: 12px;
    }

    .product-item-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 14px;
    }

    .product-img-box {
        width: 100%;
        height: 140px;
        border-radius: 8px;
    }

    .product-img-placeholder {
        font-size: 48px;
    }

    .select-wrapper {
        width: 100%;
    }

    .qty-wrapper {
        width: 100%;
    }

    .product-qty {
        width: 100% !important;
    }

    /* 繳費：單欄 */
    .pay-grid {
        grid-template-columns: 1fr;
    }

    .pay-title {
        font-size: 16px;
    }

    /* 發票：單欄 */
    .invoice-three-part-block .field-row .field-item {
        flex: 1 1 100%;
    }

    /* 安全聲明 */
    .safety-label {
        font-size: 16px;
    }

    .safety-scrollbox {
        font-size: 14px;
    }

    /* 送出 */
    #checkBtn {
        width: 200px;
        padding: 7px 0;
        font-size: 16px;
    }

    /* Modal */
    .layout_title {
        font-size: 16px;
    }

    .layout_title::before {
        content: "-----";
    }

    .layout_title::after {
        content: "-----";
    }

    .information {
        margin: 15px auto;
    }

    .information h5 {
        font-size: 17px;
        width: 30%;
    }

    .information p {
        font-size: 17px;
        width: 70%;
    }

    .information p.checkFinalTotalPrice {
        font-size: 20px;
    }

    .version {
        font-size: 13px;
    }
}