﻿/* 響應式網頁設計 - 額外樣式 */

/* 防止橫向滾動 */
html, body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
}

/* 確保所有容器不超出螢幕寬度 */
* {
    box-sizing: border-box;
}

.container {
    padding-left: 15px;
    padding-right: 15px;
    margin-left: auto;
    margin-right: auto;
}

.row {
    margin-left: -15px;
    margin-right: -15px;
}

/* 確保所有圖片都是響應式的 */
img {
    max-width: 100%;
    height: auto;
}

/* 輸入框響應式調整 */
.input-group {
    display: flex;
    flex-wrap: wrap;
}

.input-group-addon.inputbtn {
    min-width: 140px;
    white-space: normal;
    word-wrap: break-word;
}

/* 導航選單響應式 */
.header-wrapper .list-inline {
    margin: 10px 0;
}

.header-wrapper .list-inline > li {
    padding: 5px;
}

/* 驗證碼區塊放大到2倍 - 適用於所有螢幕尺寸 */
#imgValidateCode {
    height: 60px !important;
    width: auto !important;
}

/* 更換驗證碼文字放大到2倍 */
#labCode {
    font-size: 22px !important;
    margin-top: 4px !important;
}

/* 驗證碼連結按鈕容器調整 */
#btnChangeCode {
    display: inline-block !important;
    vertical-align: middle !important;
}

/* 手機裝置優化 (小於 768px) */
@media (max-width: 767px) {
    /* 確保容器不超出螢幕 */
    body {
        overflow-x: hidden !important;
    }

    .wrapper {
        overflow-x: hidden;
        width: 100%;
    }

    .container {
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 10px;
        padding-right: 10px;
    }

    .row {
        margin-left: -10px;
        margin-right: -10px;
    }

    [class*="col-"] {
        padding-left: 10px;
        padding-right: 10px;
    }

    /* 減少手機版紅色導航區域高度到一半 */
    .header-wrapper {
        padding: 4px 0;
    }

    .header-wrapper .container {
        padding-top: 2px;
        padding-bottom: 2px;
    }

    .header-wrapper .row {
        margin-top: 0;
        margin-bottom: 0;
    }

    /* Banner 圖片優化 - 確保文字清晰可讀 */
    .banner-wrapper {
        height: auto !important;
        min-height: 120px;
        padding: 10px 0;
    }

    .bannerlogo {
        padding: 10px 5px !important;
    }

    .bannerlogo img {
        width: auto !important;
        max-width: none !important;
        height: 100px !important;
        max-height: none !important;
        display: block;
        margin: 0 auto;
    }

    /* 導航選單 - 放大文字和圖示到 150%，但大幅減少高度 */
    .header-wrapper .list-inline {
        text-align: center;
        padding: 3px 0;
        margin: 4px 0;
        white-space: nowrap;
    }

    .header-wrapper .list-inline > li {
        display: inline-block;
        padding: 5px 3px;
        font-size: 22px;
        min-height: 44px;
        line-height: 22px;
    }

    .header-wrapper .list-inline > li a {
        font-size: 22px;
        padding: 5px 3px;
        display: inline-block;
        min-width: 44px;
        min-height: 44px;
        line-height: 22px;
    }

    /* 放大首頁圖示到 150% */
    .header-wrapper .list-inline > li a .glyphicon {
        font-size: 30px;
    }

    .header-wrapper .pull-right {
        float: none !important;
    }

    .header-wrapper .main-content {
        padding: 0;
    }

    /* 輸入框標籤調整 */
    .input-group {
        width: 100%;
    }

    .input-group-addon.inputbtn {
        width: 100%;
        text-align: left;
        border-radius: 4px 4px 0 0;
        min-width: auto;
    }

    .input-group .form-control {
        border-radius: 0 0 4px 4px;
        width: 100%;
    }

    /* 按鈕完整寬度 */
    .agreebtn {
        width: 100%;
        margin-bottom: 10px;
    }

    /* 內容標題調整 - 重要！防止超出邊界 */
    h3 {
        font-size: 18px;
        margin-left: 0 !important;
        margin-right: 0 !important;
        text-align: center;
    }

    .content-title {
        font-size: 16px;
        padding: 8px;
        word-wrap: break-word;
        margin-left: 0 !important;
        margin-right: 0 !important;
        max-width: 100%;
    }

    .title {
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        text-align: center;
    }

    /* Sidebar 置中 */
    .sidebar {
        text-align: center;
        margin-bottom: 20px;
        display: block;
        width: 100%;
    }

    .sidebar .title {
        text-align: center;
        display: block;
        margin-left: auto;
        margin-right: auto;
    }

    .sidebar .title img {
        display: block;
        margin-left: auto;
        margin-right: auto;
    }

    /* 步驟圖區塊 - 保留背景圓圖，精確對齊文字 */
    .sidebar .steps {
        display: block !important;
        text-align: center !important;
        width: 100% !important;
        overflow: visible !important;
    }

    .sidebar .steps ul {
        display: inline-block !important;
        margin-left: auto !important;
        margin-right: auto !important;
        text-align: center !important;
        width: 117px !important;
        max-width: 117px !important;
        height: 460px !important;
        min-height: 460px !important;
        padding: 0 !important;
        background-image: url(../image/ul-list.png) !important;
        background-size: 117px 460px !important;
        background-repeat: no-repeat !important;
        background-position: center center !important;
        position: relative !important;
        list-style: none !important;
    }

    .sidebar .steps ul li {
        line-height: 92px !important;
        font-size: 13px !important;
        height: 92px !important;
        margin: 0 !important;
        padding: 0 !important;
        display: block !important;
        text-align: center !important;
        position: relative !important;
    }

    /* 第1個圓（藍色）- 文字偏下，往上移 */
    .sidebar .steps ul li:nth-child(1) {
        top: 10px !important;
    }

    /* 第2個圓（綠色）- 文字偏下，稍微往上移 */
    .sidebar .steps ul li:nth-child(2) {
        top: 5px !important;
    }

    /* 第3個圓（淺綠）- 已經正確，不調整 */
    .sidebar .steps ul li:nth-child(3) {
        top: 0px !important;
    }

    /* 第4個圓（橙色）- 文字偏上，往下移 */
    .sidebar .steps ul li:nth-child(4) {
        top: -5px !important;
    }

    /* 第5個圓（紅色）- 文字偏上，往下移 */
    .sidebar .steps ul li:nth-child(5) {
        top: -10px !important;
    }

    .sidebar .steps ul li.active {
        color: #FFF !important;
        font-weight: bold !important;
    }

    /* 驗證碼區塊調整 */
    .input-group .form-control[placeholder="Recaptcha"] {
        width: 100% !important;
    }

    /* 驗證碼區塊放大一倍 */
    .input-group-addon.inputbtn + .form-control[placeholder="Recaptcha"] {
        font-size: 32px !important;
        height: 60px !important;
    }

    /* 驗證碼圖片放大一倍 */
    #imgValidateCode {
        height: 60px !important;
        width: auto !important;
    }

    /* 更換驗證碼文字放大一倍 */
    #labCode {
        font-size: 22px !important;
        margin-top: 4px !important;
    }

    /* 驗證碼連結按鈕容器調整 */
    #btnChangeCode {
        display: inline-block !important;
        vertical-align: middle !important;
    }

    /* 內容區域調整 - 減少上方空白 */
    .main-content, .main-content180, .main-content240 {
        padding-left: 0;
        padding-right: 0;
        padding-top: 20px !important;
    }

    .content {
        padding: 0;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .content-body {
        word-wrap: break-word;
        overflow-wrap: break-word;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}

/* 小型平板 (768px - 991px) */
@media (min-width: 768px) and (max-width: 991px) {
    .header-wrapper .list-inline > li {
        font-size: 14px;
        padding: 5px 8px;
    }

    .header-wrapper .list-inline > li a {
        font-size: 14px;
    }

    .input-group-addon.inputbtn {
        min-width: 150px;
    }

    h3 {
        font-size: 20px;
    }

    .content-title {
        margin-left: 0;
    }
}

/* 大型桌面 (1200px 以上) */
@media (min-width: 1200px) {
    .container {
        max-width: 1170px !important;
    }
}

/* 修正 Bootstrap input-group 在不同尺寸的顯示 */
@media (max-width: 767px) {
    .input-group-addon + .form-control {
        margin-top: -1px;
    }
}

/* 確保按鈕在手機上易於點擊 */
@media (max-width: 767px) {
    .btn {
        padding: 12px 20px;
        font-size: 16px;
    }

    .btn-lg {
        padding: 14px 24px;
        font-size: 18px;
    }
}

/* 極小螢幕調整 (小於 360px) - 進一步優化導航選單 */
@media (max-width: 359px) {
    .header-wrapper .list-inline > li {
        padding: 4px 2px;
        font-size: 20px;
    }

    .header-wrapper .list-inline > li a {
        font-size: 20px;
        padding: 4px 2px;
    }
    
    .header-wrapper .list-inline > li a .glyphicon {
        font-size: 27px;
    }
    
    /* 極小螢幕時稍微縮小 banner 圖片，但仍保持文字清晰 */
    .bannerlogo img {
        height: 90px !important;
    }
}

/* 改善表單可讀性 */
.content-body {
    margin-bottom: 15px;
}

.content-body p {
    margin-bottom: 10px;
}

/* 錯誤訊息響應式 */
label[id*="MSG"] {
    display: block;
    margin-top: 5px;
    margin-bottom: 10px;
    font-size: 14px;
}

@media (max-width: 767px) {
    label[id*="MSG"] {
        font-size: 13px;
    }
}
