/**
 * WooCommerce 單級分銷系統 - 前台樣式
 *
 * @package WC_Single_Level_Affiliate
 */

/* 選項卡導航 */
.wcsla-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 25px;
    border-bottom: 2px solid #e5e5e5;
}

.wcsla-tab {
    padding: 12px 20px;
    text-decoration: none;
    color: #666;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s ease;
}

.wcsla-tab:hover {
    color: #333;
    background: #f9f9f9;
}

.wcsla-tab.active {
    color: #0073aa;
    border-bottom-color: #0073aa;
    font-weight: 600;
}

/* 分銷概覽 */
.wcsla-overview {
    max-width: 900px;
}

/* 推薦連結區塊 */
.wcsla-referral-link-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 25px;
}

.wcsla-referral-link-box h3 {
    color: #fff;
    margin: 0 0 15px 0;
    font-size: 18px;
}

.wcsla-link-wrapper {
    display: flex;
    gap: 10px;
}

.wcsla-link-wrapper input {
    flex: 1;
    padding: 12px 15px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.95);
    color: #333;
}

.wcsla-link-wrapper .button {
    padding: 12px 20px;
    background: #fff;
    color: #764ba2;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wcsla-link-wrapper .button:hover {
    background: #f0f0f0;
    transform: translateY(-1px);
}

.wcsla-link-tip {
    margin: 15px 0 0 0;
    font-size: 13px;
    opacity: 0.9;
}

/* 統計網格 */
.wcsla-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.wcsla-stat-card {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.2s ease;
}

.wcsla-stat-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.wcsla-stat-icon {
    font-size: 28px;
}

.wcsla-stat-content {
    display: flex;
    flex-direction: column;
}

.wcsla-stat-value {
    font-size: 22px;
    font-weight: 700;
    color: #333;
}

.wcsla-stat-label {
    font-size: 12px;
    color: #888;
    margin-top: 2px;
}

.wcsla-stat-card.highlight-pending {
    border-left: 4px solid #f0b849;
}

.wcsla-stat-card.highlight-approved {
    border-left: 4px solid #46b450;
}

.wcsla-stat-card.highlight-paid {
    border-left: 4px solid #0073aa;
}

/* 階梯說明 */
.wcsla-tier-info {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

.wcsla-tier-info h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    color: #333;
}

.wcsla-tier-table {
    width: 100%;
    border-collapse: collapse;
}

.wcsla-tier-table th,
.wcsla-tier-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e5e5e5;
}

.wcsla-tier-table th {
    background: #f0f0f0;
    font-weight: 600;
    font-size: 13px;
    color: #555;
}

.wcsla-tier-table tr:last-child td {
    border-bottom: none;
}

.wcsla-tier-table tr.current-tier {
    background: #e8f5e9;
}

.wcsla-tier-table tr.current-tier td {
    font-weight: 600;
}

.current-badge {
    display: inline-block;
    background: #46b450;
    color: #fff;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
}

/* 表格通用樣式 */
.wcsla-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    margin-top: 15px;
}

.wcsla-table th,
.wcsla-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e5e5e5;
}

.wcsla-table th {
    background: #f9f9f9;
    font-weight: 600;
    font-size: 13px;
    color: #555;
}

.wcsla-table tr:hover {
    background: #fafafa;
}

.wcsla-table tr:last-child td {
    border-bottom: none;
}

/* 狀態標籤 */
.wcsla-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 500;
}

.wcsla-status.status-pending {
    background: #fff3cd;
    color: #856404;
}

.wcsla-status.status-approved {
    background: #d4edda;
    color: #155724;
}

.wcsla-status.status-paid {
    background: #cce5ff;
    color: #004085;
}

.wcsla-status.status-cancelled {
    background: #f8d7da;
    color: #721c24;
}

.wcsla-status.status-withdrawn {
    background: #e2e3e5;
    color: #383d41;
}

/* 徽章 */
.wcsla-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
}

.wcsla-badge.success {
    background: #d4edda;
    color: #155724;
}

.wcsla-badge.muted {
    background: #e9ecef;
    color: #6c757d;
}

/* 無資料提示 */
.wcsla-no-data {
    text-align: center;
    padding: 40px 20px;
    color: #888;
    background: #f9f9f9;
    border-radius: 8px;
}

/* 篩選選項卡 */
.wcsla-filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.wcsla-filter-tabs a {
    padding: 8px 16px;
    border: 1px solid #e5e5e5;
    border-radius: 20px;
    text-decoration: none;
    color: #666;
    font-size: 13px;
    transition: all 0.2s ease;
}

.wcsla-filter-tabs a:hover {
    background: #f5f5f5;
}

.wcsla-filter-tabs a.active {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

/* 分頁 */
.wcsla-pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e5e5e5;
}

.wcsla-page-link {
    display: inline-block;
    padding: 8px 14px;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    text-decoration: none;
    color: #666;
    transition: all 0.2s ease;
}

.wcsla-page-link:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.wcsla-page-link.current {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

/* 響應式設計 */
@media screen and (max-width: 768px) {
    .wcsla-tabs {
        flex-direction: column;
        border-bottom: none;
    }
    
    .wcsla-tab {
        border-bottom: 1px solid #e5e5e5;
        margin-bottom: 0;
    }
    
    .wcsla-tab.active {
        background: #f5f5f5;
        border-bottom-color: #e5e5e5;
    }
    
    .wcsla-link-wrapper {
        flex-direction: column;
    }
    
    .wcsla-stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .wcsla-stat-card {
        padding: 15px;
    }
    
    .wcsla-stat-icon {
        font-size: 24px;
    }
    
    .wcsla-stat-value {
        font-size: 18px;
    }
    
    .wcsla-table {
        display: block;
        overflow-x: auto;
    }
    
    .wcsla-filter-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 10px;
    }
    
    .wcsla-filter-tabs a {
        white-space: nowrap;
    }
}

@media screen and (max-width: 480px) {
    .wcsla-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .wcsla-referral-link-box {
        padding: 20px 15px;
    }
    
    .wcsla-tier-info {
        padding: 15px;
    }
}

/* 動畫效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wcsla-overview,
.wcsla-referrals,
.wcsla-commissions {
    animation: fadeIn 0.3s ease;
}

/* 複製成功提示 */
.wcsla-copy-success {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 15px 30px;
    border-radius: 8px;
    z-index: 9999;
    animation: fadeInOut 2s ease;
}

@keyframes fadeInOut {
    0% { opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { opacity: 0; }
}

/* WooCommerce 覆寫 */
.woocommerce-account .wcsla-table {
    border: 1px solid #e5e5e5;
    border-radius: 4px;
}

.woocommerce-account .woocommerce-message {
    margin-bottom: 20px;
}

/* ========================================
   提現中心樣式
   ======================================== */

/* 提現概覽 */
.wcsla-withdrawal-overview {
    max-width: 900px;
}

.wcsla-withdrawal-notice {
    background: #e7f3ff;
    border: 1px solid #b8daff;
    border-left: 4px solid #0073aa;
    padding: 15px 20px;
    margin-bottom: 25px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.wcsla-withdrawal-notice .dashicons {
    color: #0073aa;
}

.wcsla-min-amount-notice {
    background: #f8f9fa;
    padding: 12px 20px;
    border-radius: 4px;
    margin: 20px 0;
    color: #666;
    font-size: 14px;
}

.wcsla-quick-apply {
    margin-top: 25px;
    text-align: center;
}

.wcsla-quick-apply .wcsla-apply-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    padding: 15px 40px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.wcsla-quick-apply .wcsla-apply-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.wcsla-pending-notice {
    background: #fff3cd;
    border: 1px solid #ffc107;
    padding: 15px 20px;
    border-radius: 4px;
    margin-top: 20px;
    color: #856404;
    display: flex;
    align-items: center;
    gap: 10px;
}

.wcsla-pending-notice .dashicons {
    color: #856404;
}

/* 提現申請表單 */
.wcsla-withdrawal-apply {
    max-width: 600px;
}

.wcsla-withdrawal-apply h3 {
    margin: 0 0 20px 0;
    font-size: 20px;
    color: #333;
}

.wcsla-available-amount {
    background: #d4edda;
    padding: 15px 20px;
    border-radius: 4px;
    margin-bottom: 25px;
    font-size: 16px;
    color: #155724;
}

.wcsla-withdrawal-form .form-row {
    margin-bottom: 20px;
}

.wcsla-withdrawal-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.wcsla-withdrawal-form label .required {
    color: #dc3545;
}

.wcsla-withdrawal-form input[type="text"],
.wcsla-withdrawal-form input[type="number"],
.wcsla-withdrawal-form input[type="email"],
.wcsla-withdrawal-form select,
.wcsla-withdrawal-form textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.wcsla-withdrawal-form input:focus,
.wcsla-withdrawal-form select:focus,
.wcsla-withdrawal-form textarea:focus {
    border-color: #0073aa;
    outline: none;
}

.wcsla-withdrawal-form small {
    display: block;
    margin-top: 5px;
    color: #888;
    font-size: 12px;
}

.wcsla-method-fields {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.wcsla-method-fields .form-row:last-child {
    margin-bottom: 0;
}

.wcsla-submit-btn {
    background: #0073aa;
    color: #fff;
    border: none;
    padding: 14px 30px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wcsla-submit-btn:hover {
    background: #005a87;
}

/* 提現紀錄 */
.wcsla-withdrawal-history h3 {
    margin: 0 0 20px 0;
    font-size: 20px;
    color: #333;
}

/* 拒絕狀態 */
.wcsla-status.status-rejected {
    background: #f8d7da;
    color: #721c24;
}

/* 已申請提現狀態 */
.wcsla-status.status-withdrawn {
    background: #d1ecf1;
    color: #0c5460;
}

/* 提現中心頁面 */
.wcsla-withdrawal {
    animation: fadeIn 0.3s ease;
}

.wcsla-withdrawal h3 {
    margin: 0 0 20px 0;
    font-size: 20px;
    color: #333;
}

.wcsla-withdrawal h4 {
    margin: 30px 0 20px 0;
    font-size: 18px;
    color: #333;
    padding-bottom: 10px;
    border-bottom: 2px solid #e5e5e5;
}

/* 提現統計卡片 */
.wcsla-withdrawal-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.wcsla-withdrawal-stats .wcsla-stat-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.2s ease;
}

.wcsla-withdrawal-stats .wcsla-stat-card:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transform: translateY(-3px);
}

.wcsla-withdrawal-stats .wcsla-stat-icon {
    font-size: 32px;
}

.wcsla-withdrawal-stats .wcsla-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: #333;
}

.wcsla-withdrawal-stats .wcsla-stat-label {
    font-size: 12px;
    color: #666;
}

/* 提現說明 */
.wcsla-withdrawal-notice {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
}

.wcsla-withdrawal-notice p {
    margin: 0 0 10px 0;
}

.wcsla-withdrawal-notice p:last-child {
    margin-bottom: 0;
}

.wcsla-notice-info {
    background: #e7f3ff;
    border-left: 4px solid #0073aa;
    padding: 12px 15px;
    border-radius: 0 4px 4px 0;
    color: #004085;
    font-size: 14px;
}

/* 申請中提示 */
.wcsla-withdrawal-pending-notice {
    background: #fff3cd;
    border: 1px solid #ffeeba;
    border-left: 4px solid #ffc107;
    padding: 15px 20px;
    border-radius: 0 8px 8px 0;
    color: #856404;
    margin-bottom: 25px;
}

/* 餘額不足提示 */
.wcsla-withdrawal-insufficient {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    color: #666;
    margin-bottom: 25px;
}

/* 提現表單外框 */
.wcsla-withdrawal-form-wrap {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 30px;
}

.wcsla-withdrawal-form-wrap h4 {
    margin-top: 0;
}

/* 提現表單 */
.wcsla-withdrawal-form .form-row {
    margin-bottom: 20px;
}

.wcsla-withdrawal-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.wcsla-withdrawal-form label .required {
    color: #dc3545;
}

.wcsla-withdrawal-form input[type="text"],
.wcsla-withdrawal-form input[type="number"],
.wcsla-withdrawal-form input[type="email"],
.wcsla-withdrawal-form select,
.wcsla-withdrawal-form textarea {
    width: 100%;
    max-width: 400px;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.wcsla-withdrawal-form input:focus,
.wcsla-withdrawal-form select:focus,
.wcsla-withdrawal-form textarea:focus {
    border-color: #0073aa;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.wcsla-withdrawal-form .button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    padding: 14px 30px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wcsla-withdrawal-form .button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* 銀行/PayPal欄位區塊 */
#bank-fields,
#paypal-fields {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
}

/* 提現記錄 */
.wcsla-withdrawal-history {
    margin-top: 30px;
}

.wcsla-withdrawal-history h4 {
    margin-top: 0;
}

/* 響應式 */
@media screen and (max-width: 768px) {
    .wcsla-withdrawal-stats {
        grid-template-columns: 1fr;
    }
    
    .wcsla-withdrawal-form input[type="text"],
    .wcsla-withdrawal-form input[type="number"],
    .wcsla-withdrawal-form input[type="email"],
    .wcsla-withdrawal-form select,
    .wcsla-withdrawal-form textarea {
        max-width: 100%;
    }
}


