/* --- 1. 基礎與背景設定 --- */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

/* 確保圖片設定能夠完整覆蓋整個畫面 */
html {
    height: 100%;
}

body {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    /* 💡 設定思源黑體為優先字體 */
    font-family: 'Noto Sans TC', sans-serif; 
    
    /* 讓字體渲染更清晰的小技巧 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    margin: 0;
    padding: 0;
}

/* 背景容器與影片 */
.bg-container { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100vw; 
    height: 100vh; 
    z-index: -2; 
    overflow: hidden; 
    background: #000; 
}

.bg-media { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
    filter: grayscale(100%) blur(5px); 
    opacity: 0.5; 
}

.bg-overlay { 
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(0,0,0,0.2); 
}

/* 2. 底層圖片：當影片載入中或失效時顯示 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url(https://sunwood.myhobbies.tw/images/sunwood-bg-2.jpg);
    background-position: center center;
    background-repeat: no-repeat;
    background-size: cover;
    filter: grayscale(100%) blur(5px); /* 同步黑白與模糊 */
    z-index: -2; /* 放在最底層 */
}

/* 3. 影片層：疊在圖片之上 */
.bg-video {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* 關鍵：影片填滿且不變形 */
    filter: grayscale(0%) blur(0px) brightness(1); /* 同步黑白與模糊 */
    z-index: -1; /* 夾在圖片與內容之間 */
}

/* --- 2. 翻牌核心佈局 --- */
.main-flip-wrapper { 
    width: 100%; 
    min-height: 100vh; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    padding: 20px; 
    box-sizing: border-box; 
    perspective: 1500px; 
}

.flip-card-container { 
    width: 100%; 
    max-width: 500px; 
    height: 650px; 
    transform-style: preserve-3d; 
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1); 
}

.flip-card-container.is-flipped { 
    transform: rotateY(180deg); 
}

.card-inner { 
    position: relative; 
    width: 100%; 
    height: 100%; 
    transform-style: preserve-3d; 
}

.step-card { 
    position: absolute; 
    width: 100%; 
    height: 100%; 
    backface-visibility: hidden; 
    background: #fff; 
    border-radius: 20px; 
    box-shadow: 0 20px 40px rgba(0,0,0,0.3); 
    overflow: hidden;
    background: rgba(255, 255, 255, 0.6); /* 半透明白 */
    backdrop-filter: blur(10px);          /* 背景模糊特效 */
    -webkit-backdrop-filter: blur(10px);
}

.card-back { 
    transform: rotateY(180deg); 
}

.card-scroll-area {
    padding: 30px;
    overflow-y: auto;
    box-sizing: border-box;
    text-align: center;
    position: relative; /* 建立定位基準，這不會影響原本的排版佈局 */
    height: 100%;       /* 確保父層有高度，子層才能參考高度來垂直置中 */
}
.login-stage-content {
    width: 440px;
    /* 定位核心代碼 */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    
    /* 確保寬度不超過螢幕（RWD 建議） */
    max-width: 90%; 
}

/* --- 3. 表格樣式 --- */
.product-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    border: none;
    text-align: left;
}

.product-table th, .product-table td {
    border: none;
    padding:10px 0px;
}

.product-table tr {
    border-bottom: 1px dashed;
}

.product-table tr:last-child {
    border-bottom: none;
}

.product-table th {
    font-size: 18px;
    color: #000000;
    padding-bottom: 10px;
    font-weight: 300;
}

.product-table td {
    padding: 15px 0;
    font-size: 18px;
    font-weight: 300 !important;
}

.flavor-text {
    font-size: 15px;
    color: #000000;
    font-weight: 100;
}

.th-right, .product-table-input, .product-table-price, .product-table-spec { 
    text-align: right; 
}

select.quantity-input {
    font-size: 17px;
    border: 0px;
    background: #ffffff00;
}

/* --- 4. 表單、按鈕與資訊區 --- */
.card-logo {
    width: 110px;
    margin-bottom: 0px;
}
.stage-title { 
    margin-bottom: 10px; 
    color: #333; 
    border-bottom: 1px solid #000; 
    padding-bottom: 10px; 
    font-weight: 400;
    margin-top: 5px;
}

.btn-line-login {
    background: #00B900;
    color: #fff;
    border: none;
    padding: 15px;
    width: 50%;
    min-width: 250px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
}

.btn-checkout-next{ 
    background: #1a1a1a; 
    color: #fff; 
    border: none; 
    padding: 15px; 
    width: 100%; 
    border-radius: 10px; 
    cursor: pointer; 
    font-size: 16px; 
    margin-top: 10px; 
}
 .btn-submit-order { 
    flex:1;
    background: #826656; 
    color: #fff; border: none; 
    padding: 15px; 
    width: 100%; 
    border-radius: 10px; 
    cursor: pointer; 
    font-size: 16px; 
    margin: 10px; 
}
.btn-submit-order-remit { 
    flex:1;
    background: #516664; 
    color: #fff; 
    border: none; 
    padding: 15px; 
    width: 100%; 
    border-radius: 10px; 
    cursor: pointer; 
    font-size: 16px; 
    margin: 10px;
}

.pay-button {
    display: flex;
}
.btn-checkout-next:disabled { opacity: 0.3; cursor: not-allowed; }

.btn-back-to-cart { 
    background: none; border: 1px solid #ddd; width: 100%; padding: 10px; 
    margin-top: 10px; border-radius: 10px; cursor: pointer; color: #888; 
}

.cart-summary-box {
    padding: 20px 0px;
    border-top: 1px solid;
    margin-top: 20px;
}

.s-line { 
    display: flex; 
    justify-content: space-between; 
    font-size: 14px; 
    margin-bottom: 5px; 
}
.total { font-size: 18px; margin-top: 10px; color: #000; }

.form-group { margin-bottom: 8px; text-align: left; }
.form-group label {
    display: block;
    font-size: 16px;
    font-weight: 100;
    margin-bottom: 5px;
}

.form-group input {
    width: 100%;
    padding: 9px;
    border: 1px solid #eee;
    border-radius: 8px;
    box-sizing: border-box;
    background: #fafafa;
    font-size: 17px;
}


select#invoiceType{
    width: 100%;
    padding: 12px;
    border: 1px solid #eee;
    border-radius: 8px;
    box-sizing: border-box;
    background: #fafafa;
    font-size: 17px;
}

.form-group-zip-address {
    display: flex;
}

.form-group-zip {
    width: 25%;
    margin-right:10px ;

}
.form-group-address {
    width: 75%;

}

.logout-link { color: #ff4757; font-size: 12px; text-decoration: none; margin-left: 10px; }

/* --- 5. 裝飾性裝飾效果 (Slogan & Logo) --- */
.slogan {
  position: fixed;
  font-size: 400px;
  font-family: fantasy;
  right: 0;
  top: -100px;
  z-index: -1;
}

.slogan-2 {
  position: fixed;
  font-size: 200px;
  font-family: fantasy;
  right: 10px;
  top: 330px;
  z-index: -1;
  line-height: 150px;
  text-align: right;
}

.logo {
  position: fixed;
  font-size: 400px;
  font-family: fantasy;
  right: 0;
  top: -100px;
  z-index: -1;
}

/* --- 6. 📱 響應式樣式 (RWD) --- */
@media (max-width: 576px) {
    .main-flip-wrapper {
        /* 💡 關鍵 1：保持 100vh 確保容器撐滿全螢幕高度，Flex 才能執行垂直置中 */
        min-height: 100vh; 
        
        /* 💡 關鍵 2：使用彈性佈局並置中 */
        display: flex;
        align-items: center;    /* 垂直置中 */
        justify-content: center; /* 水平置中 */
        
        padding: 20px 30px; /* 縮小邊距給卡片更多空間 */
    }
    .slogan,.slogan-2,.logo{
        display: none;
    }

    .flip-card-container {
        /* 💡 關鍵 3：手機版高度建議改為 auto 或較大比例，避免內容溢出 */
        height: 85vh; 
        max-width: 100%;
        margin: 0 auto; /* 強制水平置中 */
        height: 650px;
    }

.card-logo {
    width: 100px;
    margin-bottom: 20px;
}
    .card-scroll-area {
        padding: 20px 15px; 
    }

    /* 手機版表格文字微調，防止擠壓 */
    .product-table th {
        font-size: 15px;
    }
    
    .product-table td {
        padding: 12px 0;
        font-size: 15px;
    }

    .flavor-text {
        font-size: 13px; 
    }
    
    .stage-title {
        font-size: 1.2rem;
        margin-bottom: 15px;
    }

    /* 調整表單輸入字體大小 */
    .form-group label {
        font-size: 14px;
    }
    
    .form-group input {
        padding: 10px;
        font-size: 15px;
    }
}

/* 針對較短螢幕的手機最佳化 (如手機橫拿) */
@media (max-height: 600px) {
    .flip-card-container {
        height: 95vh;
    }
    .card-logo {
        width: 60px;
        margin-bottom: 10px;
    }
}