/* 全局樣式 */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px 0;
}

.container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    padding: 30px;
    margin-top: 20px;
    margin-bottom: 20px;
    max-width: 1300px;
    width: 100%;
}

/* 標題樣式 */
h1 {
    color: #2c3e50;
    font-weight: 700;
    text-align: center;
    margin-bottom: 10px;
    font-size: 2.5rem;
}

.lead {
    color: #7f8c8d;
    text-align: center;
    font-size: 1.2rem;
    margin-bottom: 30px;
}

/* 表單樣式 */
form {
    max-width: 800px;
    margin: 0 auto;
}

/* Fieldset 樣式 */
fieldset {
    border: 2px solid #e8f4fd;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 25px;
    background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

fieldset:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

legend {
    color: #3498db;
    font-weight: 600;
    font-size: 1.3rem;
    padding: 0 15px;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border-radius: 25px;
    padding: 8px 20px;
    margin-bottom: 20px;
    display: inline-block;
}

/* Fieldset 5 特定的 legend 樣式 */
fieldset:nth-of-type(5) legend {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

/* 表單組樣式 */
.form-group {
    margin-bottom: 20px;
}

/* 標籤樣式 */
label {
    color: #2c3e50;
    font-weight: 600;
    margin-bottom: 8px;
    display: block;
    font-size: 1.15rem;
}

/* 輸入框樣式 */
.form-control {
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    padding: 12px 15px;
    font-size: 1.25rem;
    transition: all 0.3s ease;
    background: #ffffff;
    width: 100%;
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
    transform: translateY(-1px);
}

select.form-control {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    font-size: 1rem !important;
    line-height: 1.5 !important;
    padding: 8px 40px 8px 12px !important;
    color: #2c3e50 !important;
    background: #fff !important;
    border-radius: 8px !important;
    border: 2px solid #e1e8ed !important;
    appearance: auto !important;
    -webkit-appearance: auto !important;
    -moz-appearance: auto !important;
    overflow: visible !important;
    white-space: normal !important;
    text-overflow: unset !important;
}

/* 修復 select 下拉選項的顯示 */
select.form-control option {
    padding: 8px 12px;
    background: #ffffff;
    color: #2c3e50;
    font-size: 1rem;
    border: none;
}

select.form-control option:hover {
    background: #e3f2fd;
}

select.form-control option:checked {
    background: #3498db;
    color: white;
}

/* 確保 select 在聚焦時正常顯示 */
select.form-control:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
    outline: none;
    background: #ffffff;
}

/* 單選按鈕樣式 */
.radio-group {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.radio-group .form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    cursor: pointer;
}

.radio-group .form-check:hover {
    background: #e3f2fd;
    border-color: #3498db;
}

.radio-group .form-check-input:checked + .form-check-label {
    color: #3498db;
    font-weight: 600;
}

/* 提交按鈕樣式 */
.btn-primary {
    background: linear-gradient(135deg, #3498db, #2980b9);
    border: none;
    border-radius: 25px;
    padding: 15px 40px;
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.3);
    display: block;
    margin: 30px auto;
    min-width: 200px;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2980b9, #1f5f8b);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

/* 響應式設計 */
@media (max-width: 768px) {
    .container {
        padding: 20px;
        margin: 10px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    fieldset {
        padding: 20px;
    }
    
    .radio-group {
        flex-direction: column;
        gap: 10px;
    }
    
    .btn-primary {
        width: 100%;
        margin: 20px auto;
    }
    
    /* 在移動端確保 select 正常顯示 */
    select.form-control {
        font-size: 16px; /* 防止 iOS 縮放 */
        padding: 12px 15px;
    }
}

/* 特殊效果 */
.form-control:invalid {
    border-color: #e74c3c;
}

.form-control:valid {
    border-color: #27ae60;
}

/* 載入動畫 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

fieldset {
    animation: fadeInUp 0.6s ease-out;
}

/* 自定義滾動條 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #3498db;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #2980b9;
}

/* 表單輸入框、下拉選單文字變大 */
.form-control {
    font-size: 1.25rem; /* 或 20px，依需求調整 */
}

/* 標籤文字變大 */
label, .form-check-label {
    font-size: 1.15rem;
}

/* fieldset 標題文字變大 */
legend {
    font-size: 1.3rem;
} 

/* 美化表格樣式 */
.form-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 20px;
    background: #fff;
    font-size: 1.05rem;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.08);
    border-radius: 10px;
    overflow: hidden;
}

.form-table th, .form-table td {
padding: 14px 18px;
text-align: left;
}

.form-table th {
background: linear-gradient(90deg, #3498db 0%, #6dd5fa 100%);
color: #fff;
font-weight: 700;
font-size: 1.15rem;
border-bottom: 2px solid #eaf6fb;
}

.form-table tr:not(:last-child) td {
border-bottom: 1px solid #eaf6fb;
}

.form-table tr:nth-child(even) td {
background: #f8fbfd;
}

.form-table td:last-child {
text-align: right;
font-weight: 600;
color: #2980b9;
}

@media (max-width: 600px) {
.form-table th, .form-table td {
    padding: 8px 6px;
    font-size: 0.98rem;
}
}

#selected-items div {
    background-color: white;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 12px 15px;
    margin-bottom: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
}

#selected-items div:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

#selected-items div span:first-child {
    font-weight: 500;
    color: #495057;
}

#selected-items div span:last-child {
    font-weight: 600;
    color: #28a745;
}

/* 分組標題樣式 */
#selected-items div[style*="background-color: #e3f2fd"] {
    background-color: #e3f2fd !important;
    border: 1px solid #bbdefb;
    color: #1976d2;
    font-weight: bold;
    margin: 15px 0 8px 0;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9em;
    display: block;
    text-align: center;
}

#selected-items div[style*="background-color: #fff3cd"] {
    background-color: #fff3cd !important;
    border: 1px solid #ffeaa7;
    color: #856404;
    font-weight: bold;
    margin: 15px 0 8px 0;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9em;
    display: block;
    text-align: center;
}

/* 子項目樣式 */
#selected-items div[style*="margin-left: 15px"] {
    margin-left: 15px !important;
    margin-bottom: 5px;
    padding: 8px 10px;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    font-size: 0.9em;
}

/* 小計詳情樣式 */
#selected-items div[style*="background-color: #f8f9fa"][style*="border-radius: 6px"] {
    background-color: #f8f9fa !important;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 10px;
    margin-top: 15px;
    font-size: 0.9em;
}

#selected-items div[style*="background-color: #f8f9fa"][style*="border-radius: 6px"] div {
    display: flex;
    justify-content: space-between;
    margin-bottom: 3px;
    padding: 2px 0;
    border: none;
    background: none;
    box-shadow: none;
    margin-left: 0;
}

#selected-items div[style*="background-color: #f8f9fa"][style*="border-radius: 6px"] div:last-child {
    border-top: 1px solid #dee2e6;
    padding-top: 5px;
    margin-top: 5px;
    font-weight: bold;
}

/* 空購物車狀態樣式 */
#selected-items .empty-cart-message {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 30px 20px;
    background-color: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    margin: 10px 0;
}

#selected-items .empty-cart-message::before {
    content: "🛒";
    display: block;
    font-size: 2em;
    margin-bottom: 10px;
}

/* 購物車總覽始終顯示的樣式 */
#cart-summary {
    transition: all 0.3s ease;
}

#cart-summary:empty {
    min-height: 100px;
}

