/* 登入頁面專用樣式 - 固定版型與 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;
    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;
    height: 100%; /* 填滿高度 */
    overflow-y: auto; /* 關鍵：如果內容超出，只在右側內部滾動 */
    
    /* 讓捲軸漂亮一點 */
    scrollbar-width: thin;
    scrollbar-color: #dee2e6 transparent;
}

/* Webkit 瀏覽器的捲軸樣式 */
.form-side::-webkit-scrollbar {
    width: 6px;
}
.form-side::-webkit-scrollbar-track {
    background: transparent;
}
.form-side::-webkit-scrollbar-thumb {
    background-color: #dee2e6;
    border-radius: 20px;
}

/* 表單區頭部與底部固定，中間內容彈性伸縮 */
.form-header {
    margin-bottom: 30px;
    flex-shrink: 0;
}

/* Tab 導航樣式優化 */
.nav-pills-custom {
    border-bottom: 2px solid #f1f3f5;
    margin-bottom: 0;
    padding-bottom: 0;
}

.nav-pills-custom .nav-link {
    color: #adb5bd;
    background: transparent;
    border-radius: 0;
    padding: 12px 20px;
    font-weight: 600;
    position: relative;
    transition: all 0.3s;
}

.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;
    justify-content: center; /* 讓短內容（如 LINE 登入）垂直置中 */
    min-height: 0; /* Flexbox 滾動修復 */
}

.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-y: visible; /* 取消內部捲軸 */
    }

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

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