/* static/css/accounts/accounts.css (v2.2 - 佈局微調版) */

/* ============================================= */
/* ====      通用基底與字體設定     ==== */
/* ============================================= */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;500;700&display=swap');

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    font-family: 'Noto Sans TC', sans-serif;
    color: #333;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
}

h2, h3 {
    color: #1d3557;
}

a {
    color: #457b9d;
    text-decoration: none;
    transition: color 0.2s ease;
    font-weight: 500;
}

a:hover {
    color: #1d3557;
    text-decoration: underline;
}

/* ============================================= */
/* ====      登入/註冊/忘記密碼 卡片樣式     ==== */
/* ============================================= */
.auth-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 30px 40px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 450px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.auth-logo {
    max-width: 80px;
    margin-bottom: 0px;
}

.auth-card h3 {
    margin-bottom: 25px;
    font-size: 24px;
    font-weight: 700;
}

.auth-form {
    display: flex;
    flex-direction: column;
}

.auth-form .form-group {
    /* 【核心修改】縮小垂直間距 */
    margin-bottom: 15px;
    position: relative;
    text-align: left;
}

/* 【核心新增】為 Email 輸入框和按鈕的 wrapper 設計 Flex 佈局 */
.input-with-button {
    display: flex;
    align-items: center;
}

.auth-form label {
    margin-bottom: 8px;
    font-size: 14px;
    color: #555;
    font-weight: 500;
    display: block;
}

.auth-form input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

/* 【核心修改】現在 target input inside the new wrapper */
.input-with-button input {
    flex-grow: 1;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
}


.auth-form input:focus {
    border-color: #457b9d;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(69, 123, 157, 0.25);
}

.send-code-btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
    border: 1px solid #6c757d;
    background-color: #6c757d;
    color: white;
    font-size: 14px;
    font-weight: 500;
    padding: 12px 15px;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
    height: 44.5px;
}

.send-code-btn:hover {
    background-color: #5a6268;
}

.auth-form input[type="password"],
.auth-form input[name="password2"] {
    padding-right: 45px;
}

.password-toggle-icon {
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(calc(-50% + 12px));
    cursor: pointer;
    color: #6c757d;
    font-size: 20px;
}

.auth-btn {
    background: linear-gradient(90deg, #1d3557 0%, #457b9d 100%);
    color: white;
    padding: 14px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    /* 【核心修改】移除 margin-top，因為現在由 .extra-links 控制間距 */
    /* margin-top: 10px; */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.auth-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.error-note, .info-note {
    font-size: 13px;
    padding: 12px 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    text-align: left;
    width: 100%;
    box-sizing: border-box;
}

.error-note {
    color: #721c24;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
}

.info-note {
    color: #004085;
    background-color: #cce5ff;
    border: 1px solid #b8daff;
}

.extra-links {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    /* 【核心修改】調整為按鈕下方的間距 */
    margin-top: 15px;
    margin-bottom: 15px;
}

.switch-auth {
    margin-top: 25px;
    font-size: 14px;
    color: #6c757d;
}

.back-to-home {
    display: block;
    margin-top: 25px;
    font-weight: 500;
}

/* ============================================= */
/* ====      會員資訊 (Profile) 頁面     ==== */
/* ============================================= */

.page-container {
    width: 100%;
    max-width: 960px;
    margin: 40px auto;
    padding: 30px 40px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.page-container h2 {
    font-size: 28px;
    margin-bottom: 30px;
    position: relative;
    display: inline-block;
    padding-bottom: 10px;
}

/* 為標題加上底線綴飾 */
.page-container h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 3px;
    background-color: #457b9d;
    border-radius: 2px;
}

.profile-info-card {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin: 30px 0;
    text-align: left;
    background-color: #f8f9fa;
    overflow: hidden; /* 確保圓角效果 */
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 25px;
    border-bottom: 1px solid #e9ecef;
    transition: background-color 0.2s ease;
}

.info-item:hover {
    background-color: #ffffff;
}

.info-item:last-child {
    border-bottom: none;
}

.info-label {
    font-weight: 500;
    color: #495057;
    font-size: 16px;
}

.info-value {
    color: #212529;
    font-size: 16px;
}

/* 付費會員標籤樣式 */
.membership-paid {
    font-weight: bold;
    color: #fca311; /* 橘色，突顯付費會員 */
    background-color: #fff8e1;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 14px;
    border: 1px solid #ffecc1;
}

/* 一般會員標籤樣式 */
.membership-general {
    color: #6c757d;
}

/* 動作按鈕的容器 */
.profile-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
}

.action-link {
    display: inline-block;
    padding: 12px 25px;
    border-radius: 8px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #333;
    font-weight: 500;
    transition: all 0.2s ease;
}

.action-link:hover {
    background-color: #e9ecef;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

/* 主按鈕樣式 */
.action-link.primary {
    background-color: #457b9d;
    border-color: #457b9d;
    color: #ffffff;
}

.action-link.primary:hover {
    background-color: #1d3557;
    border-color: #1d3557;
}

/* ======================================================= */
/* ====      會員資訊頁面 - 已購買模組列表 (新增)     ==== */
/* ======================================================= */

#purchased-modules-list {
    list-style: none;
    padding: 0;
    margin: 0;
    width: 60%; /* 讓列表佔據更多空間以容納日期 */
    text-align: right;
}

.purchased-module-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0; /* 增加列表項的垂直間距 */
}

.purchased-module-item:not(:last-child) {
    border-bottom: 1px dashed #e0e0e0; /* 用虛線分隔項目 */
}

.module-name {
    font-weight: 500;
}

.module-dates {
    font-size: 14px;
    color: #6c757d;
    background-color: #f0f0f0;
    padding: 3px 8px;
    border-radius: 12px;
    font-family: 'Courier New', Courier, monospace; /* 使用等寬字體讓日期對齊 */
}

.messages-container {
    width: 100%;
    margin-bottom: 20px;
}

.message {
    padding: 15px;
    border-radius: 6px;
    border: 1px solid transparent;
    font-weight: 500;
}

/* 錯誤訊息 (error tag) */
.message.error {
    background-color: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

/* 成功訊息 (success tag) */
.message.success {
    background-color: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}