/* --- Profile Page 專屬樣式 --- */

/* 主要內容區域 (.profile-main) 樣式 */
.profile-main { 
    flex: 1; 
    display: flex; 
    justify-content: center; 
    min-height: calc(100vh - 100px); 
    padding: 30px 40px;
}

.header-title {
    flex-grow: 1; 
    color: #ffffff; 
    font-size: 2rem; 
    font-weight: 700; 
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 網格容器 (.profile-container) 佈局 */
.profile-container {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    grid-template-rows: 1fr 1fr;
    
    gap: 35px;
    width: 100%;
    max-width: 1200px; 
    min-height: 700px;
    
    margin-top: 50px; 
    margin-bottom: 50px;
}

/* 左側資訊卡片 (.profile-info-card) 跨欄設定 */
.profile-info-card {
    grid-row: 1 / span 2; 
}

/* 登出按鈕容器 (.card-footer-action) 樣式 */
.card-footer-action {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid #E0E0E0;
    margin-left: -50px;
    margin-right: -50px;
    padding-left: 50px;
    padding-right: 50px;
    padding-bottom: 0;
}

/* 登出按鈕 (.btn-logout) 樣式 */
.btn-logout {
    width: 100%;
    padding: 12px;
    background-color: #f34e42;
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 700;
    transition: background-color 0.2s;
    margin-top: 10px;
}

.btn-logout:hover {
    background-color: #d32f2f;
}

/* 通用卡片 (.profile-card) 樣式 */
.profile-card {
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    padding: 50px; 
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}


/* --- 左側：個人資訊 --- */

/* 頭像區域 (.avatar-area) 樣式 (尺寸調整) */
.avatar-area {
    position: relative;
    width: 130px; 
    height: 130px; 
    margin: 0 auto 30px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #EFEFEF;
    flex-shrink: 0;
}

/* 頭像圖片 (.avatar-img) 樣式 (尺寸調整) */
.avatar-img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
}

/* 編輯按鈕 (.edit-btn) 樣式 */
.edit-btn {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translate(-50%, 50%); 
    background-color: #D3D3D3; 
    color: #333;
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* 使用者名稱 (.user-name) 樣式 */
.user-name {
    font-size: 1.8rem;
    font-weight: 800;
    color: #333;
    text-align: center;
    margin-bottom: 5px;
    flex-shrink: 0;
}

/* 使用者 Email (.user-email) 樣式 */
.user-email {
    font-size: 1rem;
    color: #777;
    text-align: center;
    margin-bottom: 40px;
    flex-shrink: 0;
}

/* 職稱/權限資訊區塊 (.info-group-box) 樣式 */
.info-group-box {
    background-color: #ffffff;
    border-radius: 12px; 
    padding: 20px 30px; 
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    margin-top: 40px;
}

/* 單行資訊組 (.info-group) 樣式 */
.info-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 0; 
    border-bottom: 1px solid #E0E0E0; 
}

/* 移除最後一行的底部邊線 */
.info-group-box .info-group:last-child {
    border-bottom: none; 
}

/* 資訊標籤 (.info-label) 樣式 */
.info-label {
    font-size: 1.1rem;
    font-weight: 700;
    color: rgba(7, 35, 125, 1);
}

/* 資訊值 (.info-value) 樣式 */
.info-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: #555;
}

/* 可編輯資訊值 (.info-value.info-editable) 樣式 */
.info-value.info-editable {
    display: flex;
    align-items: center;
    gap: 8px;
    
    font-weight: 600; 
    color: #555;
    font-size: 1.1rem;
}

/* 編輯圖示 (.info-edit-icon) 樣式 */
.info-edit-icon {
    width: 18px;
    height: 18px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

/* 編輯圖示 Hover 效果 */
.info-edit-icon:hover {
    opacity: 1;
}

/* 確保可編輯文字不被擠壓 */
.info-value.info-editable span {
    flex-shrink: 0; 
}


/* --- 右側：設定區塊 --- */

/* 卡片標題 (.card-title) 樣式 */
.card-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: rgba(7, 35, 125, 1);
    margin-bottom: 30px;
}

/* 安全性/開發者資訊區塊 (.setting-group-box) 樣式 */
.setting-group-box {
    background-color: #ffffff;
    border-radius: 12px; 
    padding: 20px 30px; 
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-around; 
}

/* 單行設定 (.setting-row) 樣式 (設置定位參考點) */
.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0; 
    border-bottom: 1px solid #E0E0E0;
    position: relative; 
}

/* 移除設定區塊中最後一行的底部邊線 */
.setting-group-box .setting-row:last-child {
    border-bottom: none;
}

/* 鎖定狀態下，讓整個 row 顯示標準游標 */
.setting-row:has(.toggle-switch.is-locked) {
    cursor: default;
}

/* 設定標籤 (.setting-label) 樣式 */
.setting-label {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

/* 設定值 (.setting-value) 樣式 */
.setting-value {
    display: flex;
    align-items: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: #555;
    background-color: transparent;
    padding: 0; 
    border-radius: 0;
}

/* 密碼顯示文字不被擠壓 */
.password-display span {
    flex-shrink: 0;
}

/* 1. 讓 API Token 行轉為垂直堆疊 */
.setting-row.api-row {
    flex-direction: column;
    align-items: flex-start; /* 讓所有內容靠左對齊 */
}

/* 2. 讓 API Token 的值在標籤下方且佔滿寬度 */
.setting-row.api-row .api-token-display {
    width: 100%;
    margin-top: 10px; /* 給標籤和 Token 之間一點間隔 */
}

/* 3. Token 內容的換行和寬度控制 */
.api-token-display span {
    /* **【關鍵】** 讓無空格的長字串在容器邊界處換行 */
    word-break: break-all;
    overflow-wrap: break-word;
    flex-grow: 1;
    flex-shrink: 1; 
    max-width: 100%; /* 確保其最大寬度不會超出父容器 */
}

/* 4. 確保複製圖標仍在正確位置 */
.api-token-display .copy-icon {
    flex-shrink: 0; 
    margin-top: 2px;
}

/* 密碼編輯和 Token 複製圖示樣式 */
.password-display .edit-icon,
.api-token-display .copy-icon {
    width: 20px;
    height: 20px;
    margin-left: 10px;
    cursor: pointer;
    opacity: 0.8;
}

/* --- Toggle Switch (多因素認證) 樣式 --- */

/* Toggle Switch 容器 (.toggle-switch) 樣式 */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
    flex-shrink: 0; 
}

/* 隱藏原生 input */
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* 滑塊背景 (.slider) 樣式 */
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

/* 滑塊圓點 (:before) 樣式 */
.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

/* 開啟狀態的滑塊背景色 */
input:checked + .slider {
    background-color: rgba(7, 35, 125, 1); 
}

/* 開啟狀態的滑塊圓點位置 */
input:checked + .slider:before {
    transform: translateX(26px);
}

/* 鎖定狀態下，滑塊容器的樣式調整 */
.toggle-switch.is-locked {
    opacity: 0.8;
}

/* 鎖定狀態下，滑塊軌道的顏色 */
.toggle-switch.is-locked .slider {
    background-color: #A5D6A7; 
    cursor: default;
}

/* --- MFA 懸浮提示框樣式 --- */

/* 提示框本身 (初始隱藏) */
.mfa-tooltip {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%) translateX(-65px);
    
    background-color: #333;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 400;
    white-space: nowrap; 
    
    opacity: 0;
    visibility: hidden;
    transition: opacity 0s;
    z-index: 10;
    pointer-events: none;
}

/* 鎖定狀態下，滑鼠懸停時顯示提示框 */
.setting-row:has(.toggle-switch.is-locked):hover .mfa-tooltip {
    opacity: 1;
    visibility: visible;
}