/* 浮動按鈕 - 置中並固定在底部 */
.floating-button {
    min-width: 270px;
    gap: 8px;
    position: fixed;
    display: flex;
    justify-content: center;
    align-items: center;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #FDE68A;
    color: #B45309;

    font-family: Inter;
    font-weight: 500;
    font-size: 14px;
    line-height: 24px;
    letter-spacing: 0%;

    border: none;
    padding: 8px 24px;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0px 12px 42px -4px #18274B1F, 0px 8px 18px -6px #18274B1F;
    z-index: 999;
    transition: all 0.3s ease;
}

.floating-button:hover {
    background-color: #FDE68A;
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0px 16px 48px -4px #18274B2F, 0px 12px 24px -6px #18274B2F;
}

/* Modal 背景 */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 16px;
    box-sizing: border-box;
}

/* Modal 內容 */
.modal {
    background-color: #FAFDFF;
    border-radius: 12px;
    max-width: 880px;
    width: 100%;
    /* max-height: 90vh; */
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    animation: modalFadeIn 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    gap: 4px;
    padding: 16px 24px 12px;
    display: flex;
    justify-content: space-between;
    align-items: start;
    flex-shrink: 0;
}

.modal-header h3 {
    margin: 0;
    font-family: Inter;
    font-weight: 600;
    font-size: 18px;
    line-height: 28px;
    letter-spacing: 0%;
    color: #1F2937;
}

.modal-header p {
    margin: 0;
    color: #4B5563;
    font-family: Inter;
    font-weight: 400;
    font-size: 14px;
    line-height: 20px;
    letter-spacing: 0%;
}

.close-modal {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0px;
    flex-shrink: 0;
}

.modal-contact {
    /* margin-top: 12px; */
    gap: 48px;
    padding: 0 20px;
    margin-bottom: 88px;
    display: flex;
    flex-direction: row;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #9CA3AF #F3F4F6;
    scrollbar-gutter: stable;
}

/* 自定義滾動條樣式 */
.modal-contact::-webkit-scrollbar {
    width: 8px;
}

.modal-contact::-webkit-scrollbar-track {
    background: #F3F4F6;
    border-radius: 4px;
}

.modal-contact::-webkit-scrollbar-thumb {
    background: #9CA3AF;
    border-radius: 4px;
    border: 1px solid #F3F4F6;
}

.modal-contact::-webkit-scrollbar-thumb:hover {
    background: #6B7280;
}

/* 桌面版：只在需要時顯示滾動條 */
.modal-contact {
    overflow-y: auto;
}

.modal-card {
    width: 400px;
    padding: 24px;
    border: 1px solid var(--border-secondary, #C1C8CD);
    border-radius: 16px;
    flex: 0 0 400px;
    background-color: #FAFDFF;
    box-sizing: border-box;
    height: auto;
    margin-bottom: 8px;
}

/* 讓右側圖片卡片與日曆卡片在桌面版擁有相同寬度與彈性 */
#floating-image-card {
    flex: 0 0 400px;
    width: 400px;
    box-sizing: border-box;
}

/* 平板版響應式設計 (768px - 1023px) */
@media (max-width: 1023px) and (min-width: 768px) {
    .floating-button {
        min-width: 250px;
        font-size: 13px;
        padding: 8px 20px;
        bottom: 16px;
    }

    .modal {
        max-width: 720px;
        margin: 0 16px;
    }

    .modal-header {
        padding: 16px 20px 12px;
    }

    .modal-header h3 {
        font-size: 17px;
        line-height: 26px;
    }

    .modal-header p {
        font-size: 13px;
        line-height: 19px;
    }

    .modal-contact {
        padding: 0 20px;
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        min-height: 0;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        scrollbar-color: #9CA3AF #F3F4F6;
        scrollbar-gutter: stable;
    }

    .modal-card {
        height: fit-content;
    }

    .pick-content {
        min-height: 280px;
    }

    .modal-footer {
        padding: 20px;
        gap: 14px;
    }



    .btn-cancel {
        padding: 10px 20px;
        font-size: 15px;
    }
}

/* 手機版響應式設計 (最大 767px) */
@media (max-width: 767px) {

    .floating-button {
        min-width: 220px;
        font-size: 12px;
        padding: 6px 16px;
        bottom: 20px;
        gap: 6px;
    }

    .floating-button svg {
        width: 14px;
        height: 14px;
    }

    .modal-overlay {
        padding: 40px 12px;
        padding-top: 60px;
        padding-bottom: 60px;
        align-items: flex-start;
        overflow: hidden;
    }

    .modal {
        max-width: 100%;
        width: 100%;
        border-radius: 8px;
        display: flex;
        flex-direction: column;
    }

    .modal-header {
        padding: 12px 16px 8px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        position: relative;
    }

    .modal-header h3 {
        font-size: 16px;
        line-height: 24px;
        padding-right: 30px;
    }

    .modal-header p {
        font-size: 12px;
        line-height: 18px;
    }

    .close-modal {
        position: absolute;
        top: 12px;
        right: 16px;
    }

    .modal-contact {
        flex-direction: column;
        gap: 16px;
        padding: 0 16px;
        margin-top: 8px;
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        min-height: 0;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        scrollbar-color: #9CA3AF #F3F4F6;
        scrollbar-gutter: stable;
    }

    /* 行動版：卡片全寬顯示，避免固定 400px 造成溢出 */
    .modal-card,
    #floating-image-card {
        flex: 1 1 auto;
        width: 100%;
    }

    /* 讓第一欄內的子元素提升為同層，便於使用 order 重排 */
    .modal-contact>div:first-child {
        display: contents;
    }

    /* 手機版：圖片資訊卡片顯示在送出按鈕上方 */
    #floating-submit-button {
        order: 100;
    }

    #floating-image-card {
        width: 100%;
        order: 90;
        margin-bottom: 8px;
    }

    .modal-footer {
        display: block !important;
        gap: 12px;
        align-items: stretch;
        border-radius: 0 0 8px 8px;
        border-top: 1px solid #E5E7EB;
        box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
    }

    .floating-response-message {
        margin-bottom: 12px;
    }

    .alert {
        order: 1;
        margin-bottom: 8px;
    }

    /* 手機版滾動條樣式 */
    .modal-contact::-webkit-scrollbar {
        width: 12px;
    }

    .modal-contact::-webkit-scrollbar-track {
        background: #F3F4F6;
        border-radius: 6px;
    }

    .modal-contact::-webkit-scrollbar-thumb {
        background: #9CA3AF;
        border-radius: 6px;
        border: 2px solid #F3F4F6;
    }

    .modal-contact::-webkit-scrollbar-thumb:hover {
        background: #6B7280;
    }
}

/* 超小螢幕優化 (最大 480px) */
@media (max-width: 480px) {
    .info-card {
        margin: 24px !important;
    }

    .floating-button {
        min-width: 200px;
        font-size: 11px;
        padding: 6px 12px;
    }

    .modal-overlay {
        padding: 50px 8px;
        padding-top: 70px;
        padding-bottom: 70px;
        overflow: hidden;
    }

    .modal {
        border-radius: 6px;
        display: flex;
        flex-direction: column;
    }

    .modal-header {
        padding: 10px 12px 6px;
    }

    .modal-header h3 {
        font-size: 15px;
        line-height: 22px;
    }

    .modal-header p {
        font-size: 11px;
        line-height: 16px;
    }

    .close-modal {
        top: 10px;
        right: 12px;
    }

    .modal-contact {
        padding: 0 12px;
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        min-height: 0;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        scrollbar-color: #9CA3AF #F3F4F6;
        scrollbar-gutter: stable;
    }

    .pick-content {
        min-height: 200px;
    }

    .alert {
        order: 1;
        margin-bottom: 6px;
        font-size: 12px;
        padding: 6px 10px;
    }

    /* 超小螢幕滾動條樣式 */
    .modal-contact::-webkit-scrollbar {
        width: 10px;
    }

    .modal-contact::-webkit-scrollbar-track {
        background: #F3F4F6;
        border-radius: 5px;
    }

    .modal-contact::-webkit-scrollbar-thumb {
        background: #9CA3AF;
        border-radius: 5px;
        border: 1px solid #F3F4F6;
    }

    .modal-contact::-webkit-scrollbar-thumb:hover {
        background: #6B7280;
    }
}

/* 複選框樣式 */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.checkbox-option {
    display: flex;
    align-items: center;
    padding: 12px 20px 12px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background-color: #FAFDFF;
    cursor: pointer;
    font-family: sans-serif;
    font-size: 14px;
    transition: 0.2s;
    flex: 1 1 auto;
    min-width: fit-content;
}

/* .checkbox-option input[type="checkbox"] {
    margin-right: 8px;
} */

.checkbox-option:hover {
    background-color: #f9fafb;
    border-color: #9ca3af;
}

/* 自定義複選框樣式 */
input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    min-width: 16px;
    height: 16px;
    border: 1px solid #ccc;
    border-radius: 4px;
    outline: none;
    cursor: pointer;
    position: relative;
}

input[type="checkbox"]:checked {
    background-color: #1F2937;
    border-color: #1F2937;
}

input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='%23fff' d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
}

.pick-content {
    min-height: 314px;
    border: 1px solid var(--border-secondary, #C1C8CD);
    border-radius: 8px;
}

.mt-6px {
    margin-top: 6px !important;
}

/* 手機版複選框尺寸調整 */
@media (max-width: 767px) {
    input[type="checkbox"] {
        min-width: 14px;
        height: 14px;
    }

    input[type="checkbox"]:checked::after {
        width: 10px;
        height: 10px;
    }
}

/* 表單樣式 */
#floating-modal .form-group {
    width: 100%;
    margin-bottom: 16px;
}

.form-group label {
    font-family: Inter;
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    text-align: left;
    text-underline-position: from-font;
    text-decoration-skip-ink: none;
    color: #001621;
}

.iti--allow-dropdown,
#floating-modal input[type="text"],
#floating-modal input[type="email"],
select,
#floating-modal input[type="date"] {
    margin-top: 4px;
    height: 40px;
    width: 100%;
    padding: 8px 12px;
    color: #001621;
    border: 1px solid var(--border-secondary, #C1C8CD);
    border-radius: 6px;
    font-size: 16px;
    line-height: 24px;
    box-sizing: border-box;
    background: transparent;
}

/* Placeholder styles for inputs */
#floating-modal input[type="text"]::placeholder,
#floating-modal input[type="email"]::placeholder,
#floating-modal input[type="date"]::placeholder {
    font-family: Inter;
    font-size: 16px;
    font-weight: 400;
    line-height: 24px;
    text-align: left;
    text-underline-position: from-font;
    text-decoration-skip-ink: none;
    color: #6B7280;
}

/* Styles for inputs and select on focus */
#floating-modal input[type="text"]:focus,
#floating-modal input[type="email"]:focus,
select:focus,
#floating-modal input[type="date"]:focus {
    outline: none;
    border-color: var(--border-secondary, #C1C8CD);
}

.phone-group {
    gap: 16px;
    width: 100%;
    display: flex;
}

.form-text {
    display: block;
    margin-top: 4px;
    font-family: Inter;
    font-size: 12px;
    font-weight: 400;
    line-height: 16px;
    color: #6B7280;
}

.contact h2 {
    display: inline-block;
    width: 100%;
    font-family: Inter;
    font-weight: 300;
    font-size: 48px;
    line-height: 64px;
    letter-spacing: -1.2%;
    text-align: center;
    color: #1F2937;
}

.contact {
    width: 100%;
}

.contact-card {
    margin-bottom: 104px;
    border-radius: 8px;
    background: #FAFDFF;
    box-shadow: 0px 1px 2px 0px #0000000D;
    border: 1px solid var(--border-secondary, #C1C8CD);
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 20px;
    flex-shrink: 0;
    gap: 16px;
    background-color: #FAFDFF;
    border-radius: 0 0 12px 12px;
    position: sticky;
    bottom: 0;
    z-index: 10;
}

.btn-send {
    padding: 10px 32px;
    font-family: Inter;
    font-weight: 500;
    font-size: 14px;
    line-height: 24px;
    letter-spacing: 0%;
    background: #1F2937;
    color: #F9FAFB;
    width: 100%;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.btn-cancel {
    font-family: Inter;
    font-weight: 500;
    font-size: 14px;
    line-height: 24px;
    letter-spacing: 0%;
    color: #1F2937;
    background: #FAFDFF;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid var(--border-secondary, #C1C8CD);
}

.btn-send:hover {
    background: #374151;
}

.btn-send:disabled {
    background: #9CA3AF;
    cursor: not-allowed;
}

.btn-cancel:hover {
    background: #F3F4F6;
    border-color: #9CA3AF;
}

/* 響應消息樣式 */
.alert {
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    line-height: 20px;
    display: none;
}

.alert:not(:empty) {
    display: block;
}

.alert-success {
    background-color: #D1FAE5;
    color: #065F46;
    border: 1px solid #A7F3D0;
}

.alert-error {
    background-color: #FEE2E2;
    color: #991B1B;
    border: 1px solid #FECACA;
}

/* 通用隱藏類，供 JS 切換卡片使用 */
.hidden {
    display: none !important
}

/* 手機版表單樣式調整 */
@media (max-width: 767px) {
    #floating-modal .form-group {
        margin-bottom: 12px;
    }

    .form-group label {
        font-size: 13px;
        line-height: 18px;
    }

    .iti--allow-dropdown,
    #floating-modal input[type="text"],
    #floating-modal input[type="email"],
    select,
    #floating-modal input[type="date"] {
        height: 36px;
        padding: 6px 10px;
        font-size: 14px;
        line-height: 20px;
    }

    #floating-modal input[type="text"]::placeholder,
    #floating-modal input[type="email"]::placeholder,
    #floating-modal input[type="date"]::placeholder {
        font-size: 14px;
        line-height: 20px;
    }

    .phone-group {
        gap: 12px;
    }

    .form-text {
        font-size: 11px;
        line-height: 15px;
    }
}

@media (max-width: 480px) {
    #floating-modal .form-group {
        margin-bottom: 10px;
    }

    .form-group label {
        font-size: 12px;
        line-height: 16px;
    }

    .iti--allow-dropdown,
    #floating-modal input[type="text"],
    #floating-modal input[type="email"],
    select,
    #floating-modal input[type="date"] {
        height: 34px;
        padding: 5px 8px;
        font-size: 13px;
        line-height: 18px;
    }

    #floating-modal input[type="text"]::placeholder,
    #floating-modal input[type="email"]::placeholder,
    #floating-modal input[type="date"]::placeholder {
        font-size: 13px;
        line-height: 18px;
    }

    .form-text {
        font-size: 10px;
        line-height: 14px;
    }
}
