/* 登入頁面專用樣式 - 固定版型與 RWD 優化版 */

:root {
    --login-bg: #f0f2f5;
    --card-radius: 24px;
    --card-height: 720px; /* 設定卡片固定高度 */
    --brand-width: 45%;   /* 左側寬度佔比 */
}

body {
    background-color: var(--login-bg);
    /* 防止手機版背景滑動 */
    overflow-x: hidden;
}

/* 外層容器：確保垂直置中 */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* 核心卡片：最小高度固定，允許向下擴展以容納較高內容 */
.auth-card {
    background: white;
    border-radius: var(--card-radius);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 1200px;
    min-height: var(--card-height);
    display: flex;
    overflow: hidden; /* 確保圓角不被內容切掉 */
    position: relative;
}

/* --- 左側：品牌形象區 --- */
.brand-side {
    width: var(--brand-width);
    background: linear-gradient(135deg, var(--primary-color, #2b385a) 0%, #1a233a 100%);
    color: white;
    padding: 60px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    flex-shrink: 0; /* 防止被壓縮 */
}

.brand-bg-pattern {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: radial-gradient(rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 24px 24px;
    z-index: 1;
}

.brand-content {
    position: relative;
    z-index: 2;
}

/* --- 右側：表單操作區 --- */
.form-side {
    flex: 1;
    padding: 50px 60px;
    display: flex;
    flex-direction: column;
}

/* 表單區頭部固定 */
.form-header {
    margin-bottom: 30px;
    flex-shrink: 0;
}

/* Tab 導航固定（隨 form-header，不捲動） */
.nav-pills-custom {
    border-bottom: 2px solid #f1f3f5;
    margin-bottom: 0;
    padding-bottom: 0;
    flex-wrap: nowrap;
    flex-shrink: 0;
}

.nav-pills-custom .nav-link {
    color: #adb5bd;
    background: transparent;
    border-radius: 0;
    padding: 12px 8px;
    font-weight: 600;
    position: relative;
    transition: all 0.3s;
    flex: 1;             /* 三個 tab 等寬平分 */
    text-align: center;
    white-space: nowrap; /* 單一 tab 內文字不換行 */
}

.nav-pills-custom .nav-link.active {
    color: var(--primary-color, #2b385a);
    background: transparent;
}

.nav-pills-custom .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary-color, #2b385a);
}

/* Tab 內容區域：自動撐高，不再限高捲動 */
.tab-content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* flex auto margin：短內容（LINE 登入）自動垂直置中；長內容自然向下展開 */
.tab-content-wrapper > .tab-content {
    margin-top: auto;
    margin-bottom: auto;
}

.tab-pane {
    width: 100%;
}

/* 表單類型的 tab-pane 需要上邊距，避免太靠近分頁 */
.tab-pane form {
    padding-top: 30px;
}

/* 電腦版：註冊表單需要更多上邊距 */
@media (min-width: 992px) {
    #pills-register form {
        padding-top: 40px;
    }
}

.form-footer {
    margin-top: 50px;
    flex-shrink: 0;
    text-align: center;
}

/* 電腦版：增加更多間距 */
@media (min-width: 992px) {
    .form-footer {
        margin-top: 60px;
    }
}

/* LINE 按鈕樣式 */
.btn-line-block {
    background: #06C755;
    color: white;
    width: 100%;
    padding: 16px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: transform 0.2s, box-shadow 0.2s;
    border: none;
    box-shadow: 0 4px 15px rgba(6, 199, 85, 0.3);
}

.btn-line-block:hover {
    background: #05b54c;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(6, 199, 85, 0.4);
    color: white;
}

/* 輸入框優化 */
.form-floating > .form-control {
    border-radius: 12px;
    border: 1px solid #e9ecef;
    background-color: #f8f9fa;
}
.form-floating > .form-control:focus {
    background-color: white;
    border-color: var(--primary-color, #2b385a);
    box-shadow: 0 0 0 4px rgba(43, 56, 90, 0.1);
}

/* --- RWD 響應式斷點設定 --- */

/* 平板直立 (Portrait) 與 手機 */
@media (max-width: 991px) {
    .login-wrapper {
        align-items: flex-start; /* 手機版不需要垂直置中，靠上比較好操作 */
        padding: 20px 15px;
    }

    .auth-card {
        flex-direction: column;
        height: auto; /* 手機版取消固定高度，改為自適應 */
        min-height: auto;
        max-width: 500px; /* 限制手機版卡片最大寬度 */
    }

    .brand-side {
        width: 100%;
        padding: 40px 30px;
        min-height: 200px;
    }

    .form-side {
        padding: 40px 30px;
        height: auto;
        overflow: visible; /* 手機版整頁捲動，不需要內部捲軸 */
    }

    .tab-content-wrapper {
        display: block; /* 手機版不強制垂直置中，依序排列 */
        overflow-y: visible;
        margin-bottom: 20px;
    }
}

/* 極小螢幕手機修正 */
@media (max-width: 480px) {
    .brand-side {
        display: none; /* 小手機隱藏左側品牌區，節省空間 */
    }
    .form-side {
        padding: 30px 20px;
    }
}

/* OTP 輸入框：字距寬、置中、粗體 */
.otp-input {
    letter-spacing: 0.35em;
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
}

/* 多步驟切換淡入動畫 */
#reg-step-otp,
#reg-step-password,
#fa-step-otp,
#fa-step-result {
    animation: stepFadeIn 0.25s ease;
}

@keyframes stepFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* 身份欄位即時查重回饋 */
.reg-identity-feedback {
    margin-top: 2px;
    margin-bottom: 6px;
}
.reg-identity-feedback--error { color: #dc3545; }
.reg-identity-feedback--ok    { color: #198754; }

/* 密碼強度指示器 */
.pw-strength {
    margin-top: 6px;
    margin-bottom: 10px;
    padding: 0 2px;
    position: relative; /* 確保在 form-floating 的 z 層之上 */
    z-index: 2;
}
.pw-bars {
    display: flex;
    gap: 4px;
    margin-bottom: 4px;
}
.pw-bar {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: #e0e0e0;
    transition: background 0.25s ease;
}
.pw-bar.s1 { background: #ef4444; }
.pw-bar.s2 { background: #f97316; }
.pw-bar.s3 { background: #84cc16; }
.pw-bar.s4 { background: #22c55e; }
.pw-label  { font-size: 0.75rem; }
.pw-label.s1 { color: #ef4444; }
.pw-label.s2 { color: #f97316; }
.pw-label.s3 { color: #84cc16; }
.pw-label.s4 { color: #22c55e; }
