﻿/* ===================================
   case.aspx 專用樣式
   Bootstrap 5 + 無障礙 AA 等級
   =================================== */

/* === 跨瀏覽器標準化 === */
* {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

/* Firefox 字體渲染優化 */
body {
    -moz-osx-font-smoothing: grayscale;
    -webkit-font-smoothing: antialiased;
    font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* Firefox Android 字體大小修正 */
@-moz-document url-prefix() {
    body {
        -moz-text-size-adjust: 100%;
    }
}

/* WebKit (Chrome/Safari) 字體大小修正 */
body {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* Firefox flexbox bug 修正 */
.card {
    min-height: 0;
    min-width: 0;
}

/* === 案件資訊卡片 === */
.case-info-card {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 8px;
}

.case-info-card .card-body {
    padding: 1.5rem;
}

/* === 案件詳情表格 === */
.case-detail-table {
    margin-bottom: 0;
    border: 1px solid #dee2e6;
}

.case-detail-table tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.02);
}

.case-label-cell {
    background-color: #ECD9FF;
    color: #333;
    font-weight: 600;
    text-align: right;
    vertical-align: top;
    width: 150px;
    padding: 12px;
    border-right: 2px solid #dee2e6;
}

.case-content-cell {
    background-color: #F0F0F0;
    padding: 12px;
    text-align: left;
}

/* === 註冊按鈕樣式 === */
.btn-register {
    min-height: 100px;
    padding: 1.5rem;
    border-radius: 8px;
    border: 2px solid #dcdcdc;
    text-decoration: none;
    font-size: 1.0625rem; /* 固定 17px */
    line-height: 1.4;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.btn-register span {
    display: block;
    font-size: 1.0625rem; /* 固定 17px */
    line-height: 1.4;
}

/* 一般民眾按鈕 */
.btn-public {
    background: linear-gradient(180deg, #96fae1 0%, #67c3f5 100%);
    color: #333;
    box-shadow: inset 0 1px 0 0 #ffffff;
}

.btn-public:hover,
.btn-public:focus {
    background: linear-gradient(180deg, #67c3f5 0%, #96fae1 100%);
    color: #000;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(103, 195, 245, 0.4);
}

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

/* 旅行社業者按鈕 */
.btn-agency {
    background: linear-gradient(180deg, #effa52 0%, #ff9421 100%);
    color: #333;
    box-shadow: inset 0 1px 0 0 #ffffff;
}

.btn-agency:hover,
.btn-agency:focus {
    background: linear-gradient(180deg, #ff9421 0%, #effa52 100%);
    color: #000;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 148, 33, 0.4);
}

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

/* === 登入/註冊區域間距控制 === */
.login-register-container {
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* 欄位基本樣式 */
.login-register-column {
    width: 100%;
    /* Firefox flexbox 修正 */
    min-width: 0;
    min-height: 0;
}

/* 確保桌面版兩個區塊左右並排 */
@media (min-width: 992px) {
    .login-register-container {
        display: -webkit-box;
        display: -moz-box;
        display: -ms-flexbox;
        display: flex;
        -webkit-box-orient: horizontal;
        -webkit-box-direction: normal;
        -ms-flex-direction: row;
        flex-direction: row;
        flex-wrap: nowrap;
        -webkit-box-pack: justify;
        -ms-flex-pack: justify;
        justify-content: space-between;
        -webkit-box-align: stretch;
        -ms-flex-align: stretch;
        align-items: stretch;
    }
    
    .login-register-column {
        -webkit-box-flex: 0;
        -ms-flex: 0 0 calc(50% - 0.5rem);
        flex: 0 0 calc(50% - 0.5rem);
        width: calc(50% - 0.5rem);
        max-width: calc(50% - 0.5rem);
    }
    
    /* 當 registerColumn 有 display:none 時，loginColumn 置中且加寬 */
    .login-register-column[style*="display: none"] ~ .login-register-column,
    .login-register-column[style*="display:none"] ~ .login-register-column {
        margin-left: auto;
        margin-right: auto;
        max-width: 700px;
        width: 700px;
        -webkit-box-flex: 0;
        -ms-flex: 0 0 700px;
        flex: 0 0 700px;
    }
    
    /* 備用方案：使用 class 控制（最可靠） */
    .login-register-container.only-login {
        -webkit-box-pack: center;
        -ms-flex-pack: center;
        justify-content: center;
    }
    
    .login-register-container.only-login .login-register-column {
        margin-left: auto;
        margin-right: auto;
        max-width: 700px !important;
        width: 700px !important;
        -webkit-box-flex: 0 !important;
        -ms-flex: 0 0 700px !important;
        flex: 0 0 700px !important;
    }
    
    .login-register-container.only-login #registerColumn {
        display: none !important;
    }
}

/* 平板和手機版維持堆疊 */
@media (max-width: 991.98px) {
    .login-register-container {
        display: block;
    }
    
    .login-register-column {
        width: 100%;
        margin-bottom: 1rem;
    }
    
    .login-register-column:last-child {
        margin-bottom: 0;
    }
}

/* === 登入表單樣式 === */
.login-form .form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
    font-size: 0.9375rem; /* 固定 15px，Firefox 和 Chrome 一致 */
    line-height: 1.5;
}

.login-form .form-control {
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    font-size: 0.9375rem; /* 固定 15px */
    line-height: 1.5;
    height: auto; /* Firefox 修正 */
    min-height: 38px; /* 確保一致的高度 */
}

.login-form .form-control:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.login-form .form-text {
    font-size: 0.875rem; /* 固定 14px */
    color: #6c757d;
    margin-top: 0.25rem;
    line-height: 1.4;
    display: block;
}

/* === 圖形驗證碼 === */
.captcha-container {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.captcha-image {
    border: 1px solid #ced4da;
    border-radius: 4px;
    max-width: 150px;
    height: auto;
}

/* === 卡片標題 === */
.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 2px solid rgba(0, 0, 0, 0.125);
}

.card-header h3 {
    margin: 0;
    font-size: 1.0625rem; /* 固定 17px */
    font-weight: 600;
    line-height: 1.4;
}

/* === Modal 彈出視窗 === */
/* 不要設定 display:none，讓 ModalPopupExtender 控制顯示 */

.modal-content-custom {
    width: 90%;
    max-width: 800px;
    min-height: 150px;
    border: 2px solid #222222;
    background-color: #E7D4EC;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    margin: 0 auto;
    padding: 0;
}

.modal-message-container {
    min-height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.modal-message,
.modal-error {
    font-size: 1.0625rem; /* 固定 17px */
    font-weight: 500;
    line-height: 1.6;
    color: #333;
    margin: 0.5rem 0;
}

.modal-error {
    font-weight: 600;
    color: #dc3545 !important;
}

.modal-background {
    background-color: rgba(128, 128, 128, 0.8) !important;
}

.btn-modal-ok {
    min-width: 100px;
    padding: 0.5rem 1.5rem;
    background-color: #CC99FF;
    border: 2px solid #666666;
    color: #333;
    font-weight: 600;
    font-size: 0.9375rem; /* 固定 15px */
    line-height: 1.5;
}

.btn-modal-ok:hover,
.btn-modal-ok:focus {
    background-color: #b885e6;
    border-color: #555555;
    color: #000;
}

/* === Loading 遮罩 === */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.loading-content {
    background-color: #fff;
    padding: 2rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    min-width: 200px;
}

.loading-content h2 {
    color: #333;
    margin-bottom: 1rem;
}

.loading-gif {
    max-width: 64px;
    height: auto;
}

/* === 流程圖 === */
.flowchart-image {
    max-width: 100%;
    height: auto;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* === 警告訊息 === */
.alert-danger {
    border-radius: 4px;
    padding: 1rem;
}

/* === 響應式設計 === */

/* 平板 (≤ 991px) */
@media (max-width: 991.98px) {
    .case-label-cell {
        width: 130px;
        font-size: 0.9375rem;
    }
    
    .btn-register {
        min-height: 90px;
        font-size: 1rem;
        padding: 1.25rem;
    }
    
    .card-body {
        padding: 1.25rem;
    }
}

/* 手機 (≤ 767px) */
@media (max-width: 767.98px) {
    
    /* 統一手機版字體大小 - Firefox 優化 */
    body {
        font-size: 14px; /* 從 15px 改回 14px，避免 Firefox 放大 */
    }
    
    .form-label {
        font-size: 0.875rem; /* 14px */
        line-height: 1.5;
    }
    
    .form-control {
        font-size: 1rem; /* 16px，輸入框保持較大，避免縮放 */
        min-height: 44px; /* Firefox 修正 */
    }
    
    .btn {
        font-size: 0.875rem; /* 14px */
        line-height: 1.5;
    }
    
    .form-text {
        font-size: 0.8125rem; /* 13px */
        line-height: 1.4;
    }
    
    .card-header h3 {
        font-size: 0.9375rem; /* 15px */
        line-height: 1.4;
    }
}
    
    /* 案件詳情表格改為堆疊 */
    .case-detail-table,
    .case-detail-table tbody,
    .case-detail-table tr,
    .case-detail-table th,
    .case-detail-table td {
        display: block;
        width: 100%;
    }
    
    .case-label-cell {
        text-align: left;
        border-right: none;
        border-bottom: 1px solid #dee2e6;
        padding: 0.75rem;
        font-size: 1rem; /* 16px */
    }
    
    .case-content-cell {
        padding: 0.75rem;
        border-bottom: 2px solid #dee2e6;
        font-size: 1rem; /* 16px */
    }
    
    /* 註冊按鈕調整 */
    .btn-register {
        min-height: 80px;
        font-size: 0.9375rem; /* 15px，從 16px 縮小 */
        padding: 1rem;
        line-height: 1.4;
    }
    
    .btn-register span {
        font-size: 0.9375rem; /* 15px */
        line-height: 1.4;
    }
    
    .registration-box {
        margin-bottom: 1rem;
    }
    
    /* 案件資訊表格 */
    .case-label-cell,
    .case-content-cell {
        font-size: 0.875rem; /* 14px */
        padding: 0.5rem;
        line-height: 1.5;
    }
    
    /* 圖形驗證碼調整 */
    .captcha-container {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .captcha-image {
        max-width: 100%;
    }
    
    /* Modal 調整 */
    .modal-content-custom {
        max-width: 95%;
        margin: 0 auto;
    }
    
    .modal-message,
    .modal-error {
        font-size: 0.9375rem; /* 15px */
        line-height: 1.5;
    }
    
    /* 卡片調整 */
    .card-body {
        padding: 1rem;
    }
}

/* 小型手機 (≤ 575px) */
@media (max-width: 575.98px) {
    
    body {
        font-size: 13px; /* 從 14px 改為 13px，小螢幕更緊湊 */
    }
    
    .btn-register {
        min-height: 70px;
        font-size: 0.875rem; /* 14px */
        padding: 0.875rem;
        line-height: 1.4;
    }
    
    .btn-register span {
        font-size: 0.875rem; /* 14px */
        line-height: 1.4;
    }
    
    .case-label-cell,
    .case-content-cell {
        padding: 0.5rem;
        font-size: 0.8125rem; /* 13px */
        line-height: 1.5;
    }
    
    .form-label {
        font-size: 0.8125rem; /* 13px */
        line-height: 1.5;
    }
    
    .form-control {
        font-size: 1rem; /* 16px，輸入框保持大 */
        min-height: 44px;
    }
    
    .form-text {
        font-size: 0.75rem; /* 12px */
        line-height: 1.4;
    }
    
    .btn {
        font-size: 0.8125rem; /* 13px */
        line-height: 1.5;
    }
    
    .loading-content {
        padding: 1.5rem;
        min-width: 150px;
    }
    
    .loading-content h2 {
        font-size: 1rem; /* 16px */
    }
    
    .modal-message,
    .modal-error {
        font-size: 0.875rem; /* 14px */
        line-height: 1.5;
    }
    
    .card-header h3 {
        font-size: 0.875rem; /* 14px */
        line-height: 1.4;
    }
}

/* === 列印樣式 === */
@media print {
    .btn,
    .card-header,
    .registration-box,
    #Panel1,
    #Panel2,
    .loading-overlay,
    .modal-background,
    .flowchart-image {
        display: none !important;
    }
    
    .case-info-card {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .case-detail-table {
        border: 1px solid #000;
    }
    
    .case-label-cell {
        background-color: #f0f0f0 !important;
        print-color-adjust: exact;
    }
}

/* === 高對比模式 === */
@media (prefers-contrast: high) {
    .btn-register {
        border-width: 3px;
    }
    
    .case-label-cell {
        border-width: 2px;
    }
    
    .form-control {
        border-width: 2px;
    }
}

/* === 減少動畫 === */
@media (prefers-reduced-motion: reduce) {
    .btn-register,
    .btn {
        transition: none;
    }
    
    .btn-register:hover,
    .btn-public:hover,
    .btn-agency:hover {
        transform: none;
    }
    
    .spinner-border {
        animation: none;
        border: 3px solid currentColor;
        border-right-color: transparent;
    }
}

/* === 焦點指示器增強 === */
.btn-register:focus-visible,
.form-control:focus-visible,
button:focus-visible,
a:focus-visible {
    outline: 3px solid #ffbf47;
    outline-offset: 2px;
}

/* === 確保足夠的觸控目標大小 === */
.btn,
.btn-register,
input[type="button"],
input[type="submit"],
button,
a.btn {
    min-height: 44px;
    min-width: 44px;
    font-size: 0.9375rem; /* 固定 15px */
    line-height: 1.5;
}

/* === 改善色彩對比 === */
.text-danger {
    color: #c00 !important; /* 確保對比度至少 4.5:1 */
}

.bg-info {
    background-color: #0c5da5 !important; /* 深色版本以提高對比度 */
}

/* === 狀態訊息 === */
.form-text {
    display: block;
    margin-top: 0.25rem;
}

.form-text strong {
    font-weight: 700;
}

/* === 卡片等高 === */
.h-100 {
    height: 100%;
}

@media (min-width: 992px) {
    .row.g-4 > [class*='col-'] {
        display: flex;
    }
    
    .row.g-4 > [class*='col-'] > .card {
        flex: 1;
    }
}

/* === 改善可讀性 === */
.card-body {
    line-height: 1.6;
}

label,
.form-label {
    line-height: 1.5;
}

/* === Bootstrap Icons 支援(如需要) === */
.bi {
    display: inline-block;
    width: 1em;
    height: 1em;
    vertical-align: -0.125em;
}