/* 首頁訂閱視窗獨立命名，避免受既有登入視窗與 Bootstrap modal 樣式互相影響。 */
/* 站內搜尋確認視窗（#siteSearchModal）共用以下樣式，修改訂閱視窗樣式時搜尋視窗會一併改變。 */
/* 附件下載找不到檔案提示（#fileNotFoundModal，由 showMsgModal 動態產生）比照站內搜尋視窗外觀。 */
.sent-email-modal .modal-dialog, #siteSearchModal .modal-dialog, #fileNotFoundModal .modal-dialog {
    width: min(500px, calc(100vw - 2rem));
    max-width: 500px;
    margin: 1.75rem auto;
}

.sent-email-modal .modal-content, #siteSearchModal .modal-content, #fileNotFoundModal .modal-content {
    overflow: hidden;
    border: 3px solid #13d6d0;
    border-radius: 24px;
    background: #fffde5;
    box-shadow: 0 18px 48px rgb(0 0 0 / 28%);
}

.sent-email-modal .modal-header, #siteSearchModal .modal-header, #fileNotFoundModal .modal-header {
    display: flex;
    flex-direction: row;
    flex-shrink: 0;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 58px;
    padding: .85rem 1.35rem;
    border: 0;
    background: #2b7ca4;
}

.sent-email-modal .modal-title, #siteSearchModal .modal-title, #fileNotFoundModal .modal-title {
    flex: 1 1 auto;
    margin: 0;
    color: #fff;
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    word-break: normal;
}

.sent-email-modal .btn-close, #siteSearchModal .btn-close, #fileNotFoundModal .btn-close {
    flex: 0 0 auto;
    width: 1.8rem;
    height: 1.8rem;
    margin: 0;
    padding: 0;
    filter: invert(1) grayscale(1) brightness(3);
    opacity: .9;
}

.sent-email-modal .modal-body, #siteSearchModal .modal-body, #fileNotFoundModal .modal-body {
    padding: 1.1rem 1.05rem 1.25rem;
    border: 0 !important;
    border-radius: 0 !important;
    background: #fffde5;
    box-shadow: none;
}

/* showMsgModal 的內容區帶有 inline 白底黑字，需 !important 才蓋得過 */
#fileNotFoundModal .modal-body {
    background: #fffde5 !important;
    color: #111 !important;
}

.sent-email-field {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    align-items: center;
    gap: .45rem;
    margin: 0 0 .9rem;
    padding: 0;
    border: 0;
}

.sent-email-label,
.sent-email-field > label {
    float: none;
    width: auto;
    margin: 0;
    color: #111;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
}

.sent-email-options {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.55rem;
}

.sent-email-option {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    margin: 0;
    color: #111;
    font-size: 1rem;
    line-height: 1.4;
}

.sent-email-option input {
    width: 1.15rem;
    height: 1.15rem;
    margin: 0;
    accent-color: #2b7ca4;
}

.sent-email-field input[type="email"],
.sent-email-captcha input,
.sent-email-field select {
    width: 100%;
    min-height: 39px;
    padding: .45rem .75rem;
    border: 1px solid #ced4da;
    border-radius: 10px;
    background: #fff;
    color: #111;
    font-size: .95rem;
}

.sent-email-announcement-fields {
    margin: -.15rem 0 .9rem;
}

.sent-email-announcement-title {
    margin: 0 0 .65rem;
    color: #111;
    font-size: 1rem;
    font-weight: 600;
}

.sent-email-announcement-fields .sent-email-field {
    margin-bottom: .45rem;
}

/* 主辦機關、公共建設類別：標題在上，每列為「第一層＋第二層＋新增/移除按鈕」。 */
.sent-email-announcement-fields .sent-email-condition {
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    margin-bottom: .9rem;
}

.sent-email-condition-rows {
    display: grid;
    gap: .55rem;
}

.sent-email-condition-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 56px;
    gap: .55rem;
    align-items: center;
}

.sent-email-condition-row select:disabled {
    background: #f1f3f5;
    cursor: not-allowed;
}

.sent-email-condition-button {
    min-height: 39px;
    border: 1px solid #2b7ca4;
    border-radius: 10px;
    background: #fff;
    color: #2b7ca4;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}

.sent-email-condition-button:hover:not(:disabled),
.sent-email-condition-button:focus-visible {
    background: #2b7ca4;
    color: #fff;
}

.sent-email-condition-button:disabled {
    border-color: #ced4da;
    color: #adb5bd;
    cursor: not-allowed;
}

/* 已選條件標籤：按「+」後產生在下拉下方，按 ✕ 移除 */
.sent-email-condition-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}

.sent-email-condition-chips:empty {
    display: none;
}

.sent-email-condition-chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    max-width: 100%;
    padding: .25rem .45rem .25rem .75rem;
    border: 1px solid #2b7ca4;
    border-radius: 999px;
    background: #eef6fa;
    color: #1f5f7f;
    font-size: .95rem;
    line-height: 1.4;
    word-break: break-all;
}

.sent-email-condition-chip-remove {
    flex-shrink: 0;
    padding: 0 .2rem;
    border: 0;
    background: transparent;
    color: #1f5f7f;
    font-size: .9rem;
    line-height: 1;
    cursor: pointer;
}

.sent-email-condition-chip-remove:hover,
.sent-email-condition-chip-remove:focus-visible {
    color: #c0392b;
}

.sent-email-captcha {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 100px 28px;
    gap: .45rem;
    align-items: center;
}

.sent-email-captcha .captcha-img {
    width: 100px;
    height: 39px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    object-fit: contain;
}

.sent-email-captcha .btn-audio {
    width: 28px;
    padding: .2rem;
    border: 0;
    background: transparent;
    color: #111;
    font-size: 1.25rem;
}

.sent-email-hint {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(0, 0, 0, .45);
}

.sent-email-hint[hidden] {
    display: none;
}

/* 提示窗樣式與站內訊息視窗（#subscriptionResultModal）一致。 */
.sent-email-hint-box {
    width: min(100%, 400px);
    overflow: hidden;
    border: 3px solid #13d6d0;
    border-radius: 24px;
    background: #fffde5;
    box-shadow: 0 18px 48px rgb(0 0 0 / 28%);
}

.sent-email-hint-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 58px;
    padding: .85rem 1.35rem;
    background: #2b7ca4;
}

.sent-email-hint-title {
    margin: 0;
    color: #fff;
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.2;
}

.sent-email-hint-header .btn-close {
    width: 1.8rem;
    height: 1.8rem;
    margin: 0;
    padding: 0;
    filter: invert(1) grayscale(1) brightness(3);
    opacity: .9;
}

.sent-email-hint-text {
    margin: 0;
    padding: 1.6rem 1.35rem .75rem;
    color: #111;
    font-size: 1.15rem;
    text-align: center;
    white-space: pre-line;
    word-break: break-word;
}

.sent-email-hint-footer {
    display: flex;
    justify-content: center;
    padding: .5rem 1rem 1.5rem;
}

.sent-email-hint-confirm {
    min-width: 92px;
    padding: .5rem 1rem;
    border: 2px solid #28586d;
    border-radius: 999px;
    background: #28586d;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
}

.sent-email-actions {
    display: flex;
    justify-content: center;
    gap: .65rem;
    margin-top: 1.25rem;
}

.sent-email-actions button {
    min-width: 92px;
    padding: .5rem 1rem;
    border-radius: 999px;
    font-size: 1.1rem;
    font-weight: 700;
}

.sent-email-submit {
    border: 2px solid #28586d;
    background: #28586d;
    color: #fff;
}

.sent-email-cancel {
    border: 2px solid #28586d;
    background: transparent;
    color: #111;
}

@media (max-width: 767.98px) {
    .sent-email-modal .modal-header, #siteSearchModal .modal-header, #fileNotFoundModal .modal-header {
        min-height: 54px;
        padding: .75rem 1rem;
    }

    .sent-email-modal .modal-title, #siteSearchModal .modal-title, #fileNotFoundModal .modal-title {
        font-size: 1.15rem;
    }

    .sent-email-modal .modal-body, #siteSearchModal .modal-body, #fileNotFoundModal .modal-body {
        padding: 1rem;
    }

    .sent-email-field {
        grid-template-columns: 1fr;
        gap: .55rem;
    }

    .sent-email-options {
        gap: .8rem;
    }

    .sent-email-condition-row {
        grid-template-columns: minmax(0, 1fr) 56px;
    }

    .sent-email-condition-row select:first-child {
        grid-column: 1 / -1;
    }

    .sent-email-captcha {
        grid-template-columns: minmax(0, 1fr) 28px;
    }

    .sent-email-captcha .captcha-img {
        grid-column: 1 / -1;
        width: 100px;
    }

    .sent-email-actions button {
        min-width: 0;
        padding-right: 1.2rem;
        padding-left: 1.2rem;
    }
}

/* 訂閱確認／取消連結處理完成後的結果彈窗，外觀比照促參資訊訂閱視窗：
   藍色標題列（標題靠左一行、關閉鈕靠右）、米黃色內容區與青綠色邊框。
   彈窗由 showMsgModal 動態產生，沒有 sent-email-modal 樣式類別，改用固定 ID 對應（#subscriptionResultModal、案件查詢提示用的 #caseAlertModal）；
   inline style 與全站 modal 樣式較強，所以部分屬性需要 !important。 */
#caseAlertModal .modal-dialog, #subscriptionResultModal .modal-dialog {
    width: min(500px, calc(100vw - 2rem));
    max-width: 500px;
    margin: 1.75rem auto;
}

#caseAlertModal .modal-content, #subscriptionResultModal .modal-content {
    overflow: hidden;
    border: 3px solid #13d6d0;
    border-radius: 24px;
    background: #fffde5;
    box-shadow: 0 18px 48px rgb(0 0 0 / 28%);
}

#caseAlertModal .modal-header, #subscriptionResultModal .modal-header {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100% !important;
    min-height: 58px;
    padding: .85rem 1.35rem;
    border: 0;
    background: #2b7ca4;
}

#caseAlertModal .modal-title, #subscriptionResultModal .modal-title {
    flex: 1 1 auto;
    width: auto !important;
    margin: 0;
    color: #fff !important;
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: left;
    white-space: nowrap;
}

#caseAlertModal .btn-close, #subscriptionResultModal .btn-close {
    flex: 0 0 auto;
    width: 1.8rem;
    height: 1.8rem;
    margin: 0;
    padding: 0;
    filter: invert(1) grayscale(1) brightness(3);
    opacity: .9;
}

#caseAlertModal .modal-body, #subscriptionResultModal .modal-body {
    padding: 1.6rem 1.35rem .75rem;
    border: 0 !important;
    border-radius: 0 !important;
    background: #fffde5 !important;
    color: #111 !important;
    font-size: 1.15rem;
    text-align: center;
}

#caseAlertModal .modal-footer, #subscriptionResultModal .modal-footer, #siteSearchModal .modal-footer, #fileNotFoundModal .modal-footer {
    justify-content: center;
    padding: .5rem 1rem 1.5rem;
    border-top: 0 !important;
    background: #fffde5;
}

#caseAlertModal .modal-footer .btn, #subscriptionResultModal .modal-footer .btn {
    min-width: 92px;
    padding: .5rem 1rem;
    border: 2px solid #28586d;
    border-radius: 999px;
    background: #28586d;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
}
