/* =========================================================================
   3. 會員下拉選單 (MEMBER DROPDOWN CARD)
   ========================================================================= */
.user-wrapper, .cart-wrapper {
    position: relative;
    display: inline-block;
}

.dropdown-card {
    position: absolute;
    top: 115%;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(234, 234, 234, 0.9);
    border-radius: 18px;
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.12);
    z-index: 1000;
    display: none;
    flex-direction: column;
    padding: 12px 14px;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    box-sizing: border-box;
}

.dropdown-card.active {
    display: flex;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.user-dropdown { 
    width: 320px; 
}

/* 未登入狀態 */
.user-unlogged-box { text-align: center; padding: 10px 0; }
.user-unlogged-title { font-size: 15px; font-weight: 700; color: #1d1d1f; margin-bottom: 4px; }
.user-unlogged-desc { font-size: 13px; color: #86868b; margin-bottom: 18px; }

.btn-user-login {
    display: block; width: 100%; padding: 10px; background-color: #0071e3; color: #ffffff;
    border-radius: 10px; text-align: center; text-decoration: none; font-size: 14px; font-weight: 500;
    margin-bottom: 8px; transition: background-color 0.2s;
}
.btn-user-login:hover { background-color: #005bb5; }

.btn-user-register {
    display: block; width: 100%; padding: 10px; background-color: #f5f5f7; color: #1d1d1f;
    border: 1px solid #d2d2d7; border-radius: 10px; text-align: center; text-decoration: none;
    font-size: 14px; font-weight: 500; transition: background-color 0.2s;
}
.btn-user-register:hover { background-color: #e5e5ea; }


/* 第三方快速登入（Google / LINE / X） */
.header-external-auth-stack { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.header-external-auth-form { margin: 0; }
.header-external-provider-btn {
    width: 100%; min-height: 40px; padding: 8px 12px; border-radius: 10px;
    font-size: 13px; font-weight: 650; cursor: pointer; display: flex;
    align-items: center; justify-content: center; gap: 9px;
    transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease, border-color .18s ease;
}
.header-external-provider-btn:hover { transform: translateY(-1px); }
.header-external-provider-btn.provider-line { background: #06c755; color: #fff; border: 1px solid #06c755; }
.header-external-provider-btn.provider-line:hover { background: #05b94f; border-color: #05b94f; }
.header-external-provider-btn.provider-x { background: #000; color: #fff; border: 1px solid #000; }
.header-external-provider-btn.provider-x:hover { background: #1d1d1f; border-color: #1d1d1f; }
.header-external-provider-btn.provider-google { background: #fff; color: #3c4043; border: 1px solid #dadce0; }
.header-external-provider-btn.provider-google:hover { background: #f8f9fa; border-color: #c7cacf; }
.header-external-provider-icon {
    width: 19px; height: 19px; display: inline-flex; align-items: center;
    justify-content: center; flex: 0 0 19px; font-weight: 800; line-height: 1;
}
.header-external-provider-icon.icon-line { font-size: 19px; color: #fff; background: transparent; border-radius: 0; padding: 0; }
.header-external-provider-icon.icon-x { font-family: Arial, sans-serif; font-size: 19px; font-weight: 800; color: #fff; }
.header-external-provider-icon.icon-google { font-family: Arial, sans-serif; font-size: 18px; color: #3c4043; }
.header-external-provider-icon .google-g-mark {
    font-weight: 800;
    background: conic-gradient(from -45deg,#4285f4 0 25%,#34a853 0 40%,#fbbc05 0 65%,#ea4335 0 82%,#4285f4 0);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.header-external-divider { display: flex; align-items: center; gap: 10px; margin: 9px 0 10px; color: #86868b; font-size: 11px; }
.header-external-divider::before, .header-external-divider::after { content: ""; flex: 1; height: 1px; background: #e5e5ea; }

/* 1. 已登入 Header */
.user-profile-header {
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    gap: 8px;
    padding-bottom: 10px; 
    border-bottom: 1px solid #f5f5f7;
}

/* 左側：大頭貼欄位 */
.user-avatar-col { 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center;
    width: 68px;
    flex-shrink: 0; 
    text-align: center;
}

.user-avatar-box {
    width: 44px; 
    height: 44px; 
    border-radius: 50%; 
    background-color: #0071e3;
    color: #ffffff; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-size: 18px;
    overflow: hidden;
    margin: 0 auto;
}

.user-avatar-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.upgrade-threshold-text { 
    font-size: 9px; 
    color: #0071e3; 
    font-weight: 700;
    margin-top: 4px; 
    white-space: nowrap; 
    text-align: center;
    width: 100%;
}

/* 中間：暱稱與等級 */
.user-info-middle { 
    display: flex; 
    flex-direction: column; 
    gap: 4px; 
    min-width: 0; 
    flex: 1; 
}

/* 修正：允許暱稱列水平並排顯示等級圖示，避免被裁切 */
.user-nickname-text { 
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px; 
    font-weight: 700; 
    color: #1d1d1f; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    white-space: nowrap; 
}

/* 等級標籤 */
.user-level-tag {
    display: inline-flex; 
    align-items: center; 
    gap: 4px; 
    font-size: 11px; 
    font-weight: 700;
    color: #d97706; 
    background-color: #fef3c7; 
    padding: 3px 8px; 
    border-radius: 6px; 
    white-space: nowrap;
    width: fit-content;
    max-width: 100%;
}

/* 修正：同時涵蓋 .user-level-icon 與 .level-custom-icon (支援 <img> 與 <i>) */
img.user-level-icon,
img.level-custom-icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
    vertical-align: middle;
    flex-shrink: 0;
    display: inline-block;
}

i.user-level-icon,
i.level-custom-icon {
    font-size: 13px;
    line-height: 1;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.user-perks-box {
    background-color: #f8fafc; 
    border: 1px solid #e2e8f0; 
    border-radius: 8px; 
    padding: 4px 6px; 
    text-align: right; 
    flex-shrink: 0; 
    max-width: 105px;
}
.user-perks-title { font-size: 9px; color: #64748b; font-weight: 600; display: block; }
.user-perks-desc { font-size: 10px; font-weight: 700; color: #0071e3; line-height: 1.2; text-decoration: none; display: block; }


/* 2. 資產與任務齊頭對齊 */
.user-stats-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 0;
    border-bottom: 1px solid #f5f5f7;
}

.user-stat-row {
    display: flex;
    align-items: center;
    font-size: 12px;
}

.stat-label {
    width: 44px; 
    flex-shrink: 0;
    color: #6e6e73;
    font-weight: 600;
    text-align: left;
}

.stat-tags-group {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
}

.stat-badge {
    color: #1d1d1f;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}


/* 3. 訂單狀態區塊 */
.user-order-status-box { 
    padding: 10px 0; 
    border-bottom: 1px solid #f5f5f7; 
}

.order-status-header { 
    font-size: 13px; 
    font-weight: 700; 
    color: #1d1d1f; 
    margin-bottom: 8px; 
}

.order-status-grid { 
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    gap: 6px; 
}

.order-status-item { 
    font-size: 12px; 
    color: #333336; 
    text-decoration: none; 
    padding: 6px 4px; 
    border-radius: 8px; 
    background-color: #f5f5f7;
    transition: all 0.2s ease;
    flex: 1;
    text-align: center;
    white-space: nowrap;
}

.order-status-item:hover { 
    background-color: #eef4fc; 
    color: #0071e3; 
}


/* 4. 底部三個按鈕風格統一 (會員中心主頁、商品追蹤清單、登出帳號) */
.user-actions-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
    width: 100%;
}

/* 基礎通用按鈕 (全水平居中對齊) */
.user-btn-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 9px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    box-sizing: border-box;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.user-btn-action i {
    font-size: 14px;
    transition: color 0.2s ease;
}

/* 藍色品牌按鈕 (會員中心主頁、商品追蹤清單) */
.user-btn-action.btn-blue-primary {
    background-color: #f4f8ff;
    border: 1px solid #0071e3;
    color: #0071e3;
}

.user-btn-action.btn-blue-primary:hover {
    background-color: #0071e3;
    border-color: #0071e3;
    color: #ffffff;
}

/* 登出帳號按鈕專屬風格 */
.user-btn-action.btn-logout-danger {
    background-color: #fff5f5;
    border: 1px solid #fecaca;
    color: #dc2626;
}

.user-btn-action.btn-logout-danger:hover {
    background-color: #dc2626;
    border-color: #dc2626;
    color: #ffffff;
}


