/* ============================================
   許願樹系統 - 會員中心樣式表
   ============================================ */

/* 主容器 */
.wishing-tree-dashboard {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 頁首區塊 */
.dashboard-header {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.dashboard-header h2 {
    margin: 0 0 15px 0;
    color: #333;
}

.member-info {
    display: flex;
    gap: 20px;
}

.member-info p {
    margin: 0;
    padding: 10px 15px;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* ============================================
   統一區塊樣式：淺灰色底、綠色標題
   ============================================ */

.dashboard-section {
    background: #f8f9fa;
    padding: 25px;
    margin-bottom: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.dashboard-section h3 {
    margin: 0 0 20px 0;
    padding-bottom: 12px;
    border-bottom: 3px solid #28a745;
    color: #28a745;
    font-size: 20px;
    font-weight: 600;
}

/* 統計區塊 */
.dashboard-stats {
    background: #f8f9fa;
}

.dashboard-stats h3 {
    color: #28a745;
    border-bottom-color: #28a745;
}

/* 許願點紀錄區塊 */
.dashboard-points-history {
    background: #f8f9fa;
}

.dashboard-points-history h3 {
    color: #28a745;
    border-bottom-color: #28a745;
}

.points-history-table-wrapper {
    margin-bottom: 15px;
}

.points-history-footer {
    text-align: center;
    margin-top: 15px;
}

/* 我的帳號資訊區塊 */
.dashboard-account-info {
    background: #f8f9fa;
}

.dashboard-account-info h3 {
    color: #28a745;
    border-bottom-color: #28a745;
}

.account-info-content {
    padding: 10px 0;
}

.account-username {
    margin: 0;
    padding: 12px;
    background: #fff;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.account-username #wishing-tree-username {
    font-weight: 600;
    color: #333;
}

.button-small {
    padding: 6px 12px;
    font-size: 12px;
}

.copy-tip {
    display: none;
    color: #28a745;
    font-size: 12px;
    margin-left: 8px;
}

.copy-tip.show {
    display: inline;
}

/* 許願點轉帳區塊 */
.dashboard-transfer {
    background: #f8f9fa;
}

.dashboard-transfer h3 {
    color: #28a745;
    border-bottom-color: #28a745;
}

.transfer-form-wrapper {
    margin-bottom: 20px;
}

.transfer-info {
    margin-top: 20px;
    padding: 15px;
    background: #fff;
    border-radius: 6px;
    border-left: 4px solid #28a745;
}

.transfer-info p {
    margin: 8px 0;
    color: #666;
    font-size: 14px;
    line-height: 1.6;
}

.transfer-disabled {
    color: #666;
    font-style: italic;
    padding: 15px;
    background: #fff;
    border-radius: 6px;
}

/* 轉帳確認對話框 */
.transfer-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
}

.transfer-modal.show {
    display: flex;
}

.transfer-modal-content {
    background-color: #fff;
    margin: 10% auto;
    padding: 0;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.transfer-modal-header {
    padding: 20px;
    background: #28a745;
    color: #fff;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.transfer-modal-header h3 {
    margin: 0;
    color: #fff;
    border: none;
    padding: 0;
}

.transfer-modal-close {
    color: #fff;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.transfer-modal-close:hover {
    opacity: 0.8;
}

.transfer-modal-body {
    padding: 20px;
}

.transfer-details {
    margin-bottom: 20px;
}

.transfer-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #e0e0e0;
}

.transfer-row:last-child {
    border-bottom: none;
}

.transfer-row.transfer-total {
    margin-top: 10px;
    padding-top: 15px;
    border-top: 2px solid #28a745;
    font-weight: bold;
    font-size: 18px;
}

.transfer-label {
    color: #666;
}

.transfer-value {
    color: #333;
    font-weight: 600;
}

.transfer-modal-footer {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 0 0 8px 8px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* 推薦樹和安置樹區塊 */
.dashboard-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.dashboard-content .dashboard-section {
    margin-bottom: 0;
}

.dashboard-content .dashboard-section h3 {
    color: #28a745;
    border-bottom-color: #28a745;
}

/* 摸彩券區塊 */
.dashboard-lottery-tickets {
    background: #f8f9fa;
}

.dashboard-lottery-tickets h3 {
    color: #28a745;
    border-bottom-color: #28a745;
}

/* 樹狀結構樣式 */
.referral-tree,
.placement-tree {
    margin: 0;
    padding: 0;
}

.tree-level-0 {
    margin: 0;
    padding: 0;
    list-style: none;
}

.tree-level-0 > li {
    margin: 10px 0;
}

.tree-level-1,
.tree-level-2 {
    margin: 5px 0 5px 30px;
    padding: 0;
    list-style: none;
    border-left: 2px solid #e0e0e0;
}

.tree-node {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #fff;
    border-radius: 4px;
    margin: 5px 0;
}

.user-name {
    font-weight: 500;
    color: #333;
}

.user-level {
    font-size: 0.9em;
    padding: 2px 8px;
    background: #e9ecef;
    border-radius: 12px;
    color: #666;
}

/* 統計表格樣式 */
.wishing-tree-stats-table {
    border-collapse: collapse;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.wishing-tree-stats-table th,
.wishing-tree-stats-table td {
    padding: 12px 8px;
    border: 1px solid #e0e0e0;
    text-align: center;
}

.wishing-tree-stats-table th {
    background-color: #fff;
    font-weight: bold;
    color: #333;
}

.wishing-tree-stats-table tr:nth-child(even) {
    background-color: #fff;
}

.wishing-tree-stats-table tr:hover {
    background-color: #f0f0f0;
}

.wishing-tree-stats-table td:nth-child(3) {
    background-color: #e8f5e8;
    font-weight: bold;
    color: #2d5a2d;
}

.wish-point-balance-row {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
}

.wish-point-balance {
    margin: 0;
    border-radius: 30px;
    padding: 10px 40px;
    background: #fff;
    border: 2px solid #28a745;
}

.button-add-points {
    margin: 0;
    border-radius: 30px;
    padding: 10px 40px;
    font-size: 24px;
    color: var(--ast-global-color-3);
    line-height: var(--ast-body-line-height, 1.65);
}

/* 推薦連結相關樣式 */
.referral-link {
    margin-top: 15px;
}

.referral-link label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.referral-link-input {
    width: 100%;
    max-width: 480px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.button-referral {
    margin-left: 8px;
}

#copy-referral-tip {
    margin-left: 8px;
}

/* QR Code 相關樣式 */
#qr-code-container {
    animation: fadeIn 0.3s ease-in-out;
    margin-top: 15px;
    text-align: center;
}

.qr-code-container-hidden {
    display: none;
}

.qr-code-wrapper {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: inline-block;
    border: 1px solid #e0e0e0;
    transition: all 0.3s ease;
}

.qr-code-wrapper:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.qr-code-description {
    margin-top: 10px;
    font-size: 14px;
    color: #666;
}

#qr-code canvas {
    border-radius: 4px;
}

#qr-code img {
    border-radius: 4px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 會員登入區域樣式 */
.wishing-tree-login-section {
    max-width: 500px;
    margin: 0 auto;
    padding: 30px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.wishing-tree-login-section h3 {
    margin-bottom: 20px;
    color: #333;
    text-align: center;
    font-size: 24px;
}

.wishing-tree-register-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 6px;
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

.wishing-tree-register-section h3 {
    margin-bottom: 10px;
    color: #495057;
    font-size: 18px;
}

.wishing-tree-register-section p {
    color: #6c757d;
    margin-bottom: 15px;
}

.wishing-tree-register-section .button {
    background: #007cba;
    color: #fff;
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    text-decoration: none;
    display: inline-block;
    font-weight: 500;
    transition: background-color 0.3s ease;
    margin-top: 10px;
}

.wishing-tree-register-section .button:hover {
    background: #005a87;
    color: #fff;
    text-decoration: none;
}

/* WooCommerce 登入表單樣式調整 */
.wishing-tree-login-section .woocommerce-form-login {
    margin-bottom: 0;
}

.wishing-tree-login-section .woocommerce-form-login__submit {
    width: 100%;
    margin-top: 15px;
}

.wishing-tree-login-section .woocommerce-form-login__rememberme {
    margin-top: 10px;
}

/* ============================================
   響應式設計
   ============================================ */

@media (max-width: 768px) {
    .dashboard-content {
        grid-template-columns: 1fr;
    }

    .member-info {
        flex-direction: column;
        gap: 10px;
    }

    .wishing-tree-stats-table {
        font-size: 14px;
    }

    .wishing-tree-stats-table th,
    .wishing-tree-stats-table td {
        padding: 8px 4px;
    }

    .wish-point-balance-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .wish-point-balance-row .button {
        width: 100%;
    }

    #copy-referral-link,
    #show-qr-code {
        width: 100%;
        margin: 10px 0;
    }

    #qr-code-container > div {
        padding: 15px;
    }

    #qr-code canvas,
    #qr-code img {
        max-width: 150px !important;
        height: auto !important;
    }
}

@media (max-width: 600px) {
    .wish-point-balance {
        width: 100%;
        text-align: center;
    }

    .wishing-tree-stats-table {
        font-size: 12px;
    }

    .wishing-tree-stats-table th,
    .wishing-tree-stats-table td {
        padding: 6px 2px;
    }
}

@media (max-width: 460px) {
    .wish-point-balance {
        width: 100%;
        text-align: center;
    }
}
