* {
    box-sizing: border-box;
}
body {
    font-family: 'Noto Serif TC', serif;
    margin: 0;
    /* 藍藍*/
    background: linear-gradient(145deg, #0d47a1 0%, #4fc3f7 80%);
    min-height: 100vh;
    line-height: 1.6;
}


.container {
    background: linear-gradient(145deg, #ffffff, #f0f0f0);
    border: 1px solid #e0e0e0;
    padding: 2em;
    width: auto;
    max-width: none;
    margin: 2em 3em;
    position: relative;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3), inset 0 4px 8px rgba(255, 255, 255, 0.6);
    border-radius: 16px;
}

.header {
    background: #1565c0;
    color: white;
    padding: 30px;
    text-align: center;
    margin: -40px -40px 30px -40px;
}

    .header h2 {
        margin: 0;
        font-size: 28px;
        font-weight: 700;
        color: #ffffff;
        letter-spacing: 1px;
        font-family: 'Noto Serif TC', serif;
    }

.content {
    padding: 0;
    background: transparent;
}

/* 標籤選擇區域 */
.tabs {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
}

.tab-label {
    font-weight: 600;
    color: #1565c0;
    white-space: nowrap;
    min-width: 140px;
    font-size: 16px;
    font-family: 'Noto Serif TC', serif;
}

.tab-dropdown {
    flex: 1;
    position: relative;
}

    .tab-dropdown select {
        width: 100%;
        height: 48px;
        padding: 0 40px 0 15px;
        border: 1px solid #ced4da;
        font-size: 16px;
        background: #ffffff;
        transition: border-color 0.3s ease;
        color: #495057;
        font-weight: 400;
        appearance: none;
        -webkit-appearance: none;
        -moz-appearance: none;
        cursor: pointer;
        font-family: 'Noto Serif TC', serif;
    }

        .tab-dropdown select:focus {
            outline: none;
            border-color: #1565c0;
            box-shadow: 0 0 0 2px rgba(21, 101, 192, 0.2);
        }

    .tab-dropdown::after {
        content: '';
        position: absolute;
        top: 50%;
        right: 15px;
        transform: translateY(-50%);
        width: 0;
        height: 0;
        border-left: 6px solid transparent;
        border-right: 6px solid transparent;
        border-top: 8px solid #495057;
        pointer-events: none;
        transition: border-top-color 0.3s ease;
    }

.form-header-info {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 20px 0; /* Adjusted padding */
}

.required-notice {
    color: red;
    font-size: 16px;
    font-family: 'Noto Serif TC', serif;
    font-weight:bold;
}

.ai-valuation-link {
    color: blue;
    text-decoration: none;
    font-size: 18px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'Noto Serif TC', serif;
}

    .ai-valuation-link img {
        height: 1em;
    }

.tab-dropdown:hover::after {
    border-top-color: #1565c0;
}

.tab-dropdown:focus-within::after {
    border-top-color: #1565c0;
}

.form-group {
    position: relative;
}

    .form-group select {
        width: 100%; /* Use full width */
        padding-right: 40px !important;
        appearance: none;
        -webkit-appearance: none;
        -moz-appearance: none;
        background: #e3f2fd;
        cursor: pointer;
        font-family: 'Noto Serif TC', serif;
        height: 48px;
        padding: 0 15px;
        border: 1px solid #ced4da;
        font-size: 16px;
        transition: border-color 0.3s ease, box-shadow 0.3s ease;
        color: #495057;
        /* REMOVED margin-left */
    }

    .form-group:has(select)::after {
        content: '';
        position: absolute;
        top: 70%;
        right: 15px;
        transform: translateY(-50%);
        width: 0;
        height: 0;
        border-left: 6px solid transparent;
        border-right: 6px solid transparent;
        border-top: 8px solid #495057;
        pointer-events: none;
        transition: border-top-color 0.3s ease;
    }

    .form-group.has-select {
        position: relative;
    }

        .form-group.has-select::after {
            content: '';
            position: absolute;
            top: 70%;
            right: 15px;
            transform: translateY(-50%);
            width: 0;
            height: 0;
            border-left: 6px solid transparent;
            border-right: 6px solid transparent;
            border-top: 8px solid #495057;
            pointer-events: none;
            transition: border-top-color 0.3s ease;
        }

        .form-group:has(select):hover::after,
        .form-group.has-select:hover::after {
            border-top-color: #1565c0;
        }

        .form-group:has(select:focus)::after,
        .form-group.has-select:focus-within::after {
            border-top-color: #1565c0;
        }

.form-container {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-bottom: 2px;
}

.form-group {
    width: 100%;
}

    .form-group.full-width {
        width: 100%;
    }

    .form-group label {
        display: block;
        margin-bottom: 4px;
        font-weight: 700;
        color: #1565c0;
        font-size: 16px;
        text-align: left;
        width: 100%;
        font-family: 'Noto Serif TC', serif;
        /* REMOVED margin-left */
    }

.required {
    color: #dc3545;
    font-weight: bold;
}

.form-group input[type="text"],
.form-group input[type="email"] {
    height: 48px;
    padding: 10px 15px;
    border: 1px solid #ced4da;
    font-size: 16px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background: #e3f2fd;
    color: #495057;
    width: 100%; /* Use full width */
    font-family: 'Noto Serif TC', serif;
    /* REMOVED margin-left */
}

    .form-group input[type="text"]:focus,
    .form-group input[type="email"]:focus,
    .form-group select:focus,
    .form-group textarea:focus {
        outline: none;
        border-color: #1565c0;
        box-shadow: 0 0 0 2px rgba(21, 101, 192, 0.2);
        background: #ffffff;
    }

.form-group textarea {
    width: 100%; /* Use full width */
    min-height: 96px;
    padding: 12px 15px;
    border: 1px solid #ced4da;
    font-size: 16px;
    font-family: 'Noto Serif TC', serif;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background: #e3f2fd;
    color: #495057;
    line-height: 1.5;
    resize: vertical;
    /* REMOVED margin-left */
}

.radio-group {
    padding: 0;
    gap: 30px;
    display: flex;
    flex-direction: row;
    align-items: center;
    height: 48px;
    /* REMOVED margin-left */
}

    .radio-group label {
        display: flex;
        align-items: center;
        gap: 8px;
        cursor: pointer;
        font-size: 16px;
        margin-bottom: 0;
        color: #1565c0;
        font-weight: 700;
        line-height: 1;
        padding: 0;
        font-family: 'Noto Serif TC', serif;
    }

    .radio-group input[type="radio"] {
        width: 18px;
        height: 18px;
        accent-color: #1565c0;
    }

    .radio-group label:hover {
        color: #1565c0;
    }

    .radio-group input[type="radio"]:checked + span {
        color: #1565c0;
        font-weight: 700;
    }

.form-group input.success,
.form-group select.success,
.form-group textarea.success {
    border-color: #28a745;
}

.form-group input.error,
.form-group select.error,
.form-group textarea.error {
    border-color: #dc3545;
}

.checkbox-section {
    margin-bottom: 20px;
    padding: 10px;
    border: 1px solid #dee2e6;
    background: linear-gradient(145deg, #ffffff, #f0f0f0);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), inset 0 1px 3px rgba(255, 255, 255, 0.6);
    border-radius: 6px;
    /* REMOVED margin-left */
}

    .checkbox-section.no-indent {
        margin-left: 0;
    }

        .checkbox-section.no-indent legend {
            margin-left: 0;
        }

        .checkbox-section.no-indent .checkbox-grid {
            margin-left: 0;
        }

        .checkbox-section.no-indent .text-danger.field-validation-error {
            margin-left: 0;
        }

    .checkbox-section.success-border {
        border-color: #28a745;
    }

    .checkbox-section.error-border {
        border-color: #dc3545;
    }

    .checkbox-section > label {
        display: block;
        margin-bottom: 15px;
        font-weight: 700;
        color: #1565c0;
        font-size: 20px;
        font-family: 'Noto Serif TC', serif;
    }

.checkbox-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

legend {
    font-family: 'Noto Serif TC', serif;
    font-weight: 700;
    font-size: 16px;
    color: #1565c0;
    margin-bottom: 10px;
    /* REMOVED margin-left */
}

h5 {
    text-align: center;
    color: #1565c0;
    margin-bottom: 30px;
    max-width: 100%;
    font-size: 26px;
    font-weight: 800;
    font-family: 'Noto Serif TC', serif;
    border-bottom: 2px solid #1565c0; /* 簡單藍色底線 */
    padding-bottom: 8px; /* 底線與文字間距 */
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.15); /* 微妙文字陰影 */
    transition: all 0.3s ease; /* 懸停動畫 */
}

    h5:hover {
        color: #0d47a1; /* 懸停時顏色加深 */
        border-bottom-color: #0d47a1;
        transform: translateY(-2px); /* 輕微上移 */
    }

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

    .checkbox-item label {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 12px 16px;
        border: 1px solid #ced4da;
        cursor: pointer;
        transition: all 0.3s ease;
        font-size: 16px;
        margin-bottom: 0;
        background: #e3f2fd;
        color: #1565c0;
        font-weight: 700;
        font-family: 'Noto Serif TC', serif;
    }

        .checkbox-item label:hover {
            border-color: #1565c0;
            background: #d1e9ff;
        }

    .checkbox-item input[type="radio"],
    .checkbox-item input[type="checkbox"] {
        width: 16px;
        height: 16px;
        margin: 0;
        accent-color: #1565c0;
    }

        .checkbox-item input[type="radio"]:checked + span,
        .checkbox-item input[type="checkbox"]:checked + span {
            color: #1565c0;
            font-weight: 700;
        }

.contact-info {
    text-align: center;
    margin: 25px 0;
    padding: 15px;
    background: #e3f2fd;
    color: #1565c0;
    font-size: 16px;
    border: 1px solid #bbdefb;
    font-weight: 500;
    font-family: 'Noto Serif TC', serif;
}

.service-links {
    margin: 20px 0;
    text-align: center;
}

    .service-links a {
        display: inline-block;
        margin: 5px 10px;
        padding: 12px 20px;
        color: #1565c0;
        text-decoration: none;
        border: 1px solid #1565c0;
        transition: all 0.3s ease;
        font-size: 14px;
        font-weight: 500;
        background: #ffffff;
        font-family: 'Noto Serif TC', serif;
    }

        .service-links a:hover {
            background: #1565c0;
            color: white;
        }

.submit-button-container {
    text-align: center;
    margin-top: 30px;
}

.submit-button {
    background: linear-gradient(145deg, #1976d2, #0d47a1);
    color: white;
    border: 1px solid #1565c0;
    padding: 15px 40px;
    font-size: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 200px;
    font-family: 'Noto Serif TC', serif;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2), inset 0 1px 2px rgba(255, 255, 255, 0.5);
    border-radius: 6px;
}

    .submit-button:hover {
        background: linear-gradient(145deg, #1e88e5, #1565c0);
        border-color: #0d47a1;
        box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
    }

    .submit-button:active {
        background: #0a3d91;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }

.bg-light {
    background-color: #1e8fff;
}

/* 驗證碼區塊 */
.form-group.captcha-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    /* REMOVED margin-left */
}

    .form-group.captcha-group label {
        width: 100%;
        /* REMOVED margin-left */
    }

.Captcha {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 0;
    margin: 0;
    order: 1;
}

.BDC_CaptchaImage {
    /* REMOVED margin-left !important; */
    margin-right: 10px;
    vertical-align: middle;
    order: 1;
}

.BDC_ReloadIcon {
    margin-left: 0;
    margin-right: 10px;
    vertical-align: middle;
    order: 2;
}

#user_code.captcha-input {
    width: 100%; /* Use full width */
    height: 48px;
    padding: 10px 15px;
    border: 1px solid #ced4da;
    font-size: 16px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background: #e3f2fd;
    color: #495057;
    font-family: 'Noto Serif TC', serif;
    order: 3;
    flex-basis: 100%; /* Force to new line */
    margin-top: 10px; /* Add space above */
    /* REMOVED margin-left */
}

    #user_code.captcha-input:focus {
        outline: none;
        border-color: #1565c0;
        box-shadow: 0 0 0 2px rgba(21, 101, 192, 0.2);
        background: #ffffff;
    }

.text-danger.field-validation-valid {
    display: none;
}

.text-danger.field-validation-error {
    display: block;
    font-size: 14px;
    font-family: 'Noto Serif TC', serif;
    margin-bottom: 8px;
    /* REMOVED margin-left */
}

.notes-list li {
    color: #333333;
    font-family: 'Noto Serif TC', serif;
}

/* 特殊處理：確保表單元素在 iOS Safari 上正確顯示 */
@supports (-webkit-touch-callout: none) {
    .form-group select {
        background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3E%3Cpath fill='%23495057' d='M2 0L0 2h4zm0 5L0 3h4z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 12px center;
        background-size: 12px;
        padding-right: 35px;
    }
}

/* 響應式設計 */
@media (max-width: 846px) and (min-width: 768px) {
    .container {
        width: calc(100% - 38px - 20px); /* 比 .navbar 左右各留 10px */
        max-width: none;
        margin: 20px auto;
        padding: 8px 16px;
    }
}

@media (max-width: 768px) {
    h5 {
        font-size: 22px;
        border-bottom-width: 1.5px;
        padding-bottom: 6px;
    }

    .container {
        width: 90%;
        max-width: none;
        margin: 20px auto;
        padding: 1em; /* Adjusted padding for smaller screens */
        box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), inset 0 1px 3px rgba(255, 255, 255, 0.6);
    }

    .header {
        margin: -20px -20px 20px -20px;
        padding: 20px;
    }

    .content {
        padding: 0;
    }

    .tabs {
        gap: 15px;
        text-align: center;
        padding: 15px;
    }

    .tab-label {
        min-width: auto;
    }

    .form-header-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        padding: 15px 0; /* Adjusted padding */
    }

    .form-group label {
        font-size: 16px;
        font-weight: 700;
    }

    .form-group input[type="text"],
    .form-group input[type="email"],
    .form-group select {
        font-size: 16px;
    }

    .form-group.captcha-group {
        flex-direction: column;
        align-items: flex-start;
    }

    .Captcha {
        flex-direction: row;
        width: 100%;
        order: 1;
    }

    .BDC_CaptchaImage {
        order: 1;
    }

    .BDC_ReloadIcon {
        margin-left: 0;
        order: 2;
    }

    .radio-group {
        gap: 20px;
    }

        .radio-group label {
            font-size: 16px;
            font-weight: 700;
        }

    .checkbox-item label {
        font-size: 16px;
        padding: 10px 12px;
        font-weight: 700;
    }

    .submit-button {
        width: 100%;
        max-width: 300px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    h5 {
        font-size: 20px;
        border-bottom-width: 1px;
        padding-bottom: 5px;
    }
    .header h2 {
        font-size: 20px;
        letter-spacing: 1px;
    }

    .checkbox-grid {
        flex-direction: column;
    }

    .checkbox-item {
        width: 100%;
    }

    .service-links a {
        display: block;
        margin: 10px 0;
        width: 100%;
    }

    .radio-group {
        gap: 15px;
    }

    .Captcha {
        flex-direction: column;
        align-items: flex-start;
        order: 1;
    }

    .BDC_CaptchaImage {
        margin-bottom: 10px;
        order: 1;
    }

    .BDC_ReloadIcon {
        margin-left: 0;
        margin-bottom: 10px;
        order: 2;
    }

    #user_code.captcha-input {
        width: 100%;
        margin-bottom: 10px;
        order: 3;
        flex-basis: 100%;
        margin-top: 10px;
    }
}

/* 可訪問性增強 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}