/* 1. CONTAINER CHÍNH */
.mlm-tree-container {
    display: flex;
    justify-content: center;
    padding: 50px 20px;
    overflow-x: auto;
    background: #fff;
}

/* 2. CẤU TRÚC NHÁNH (NODE) */
.mlm-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding: 0 15px;
}

/* 3. KHUNG CHỨA AVATAR (QUAN TRỌNG ĐỂ ÉP TRÒN) */
.mlm-user-card {
    margin-bottom: 40px;
    text-align: center;
    position: relative;
    z-index: 5;
}

.mlm-avatar-frame {
    width: 80px !important;
    height: 80px !important;
    border-radius: 50% !important;
    overflow: hidden !important; /* Cắt góc vuông của ảnh */
    margin: 0 auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #f1f1f1 !important;
    box-sizing: border-box !important;
    transition: transform 0.3s ease;
}

/* ẢNH BÊN TRONG KHUNG */
img#mlm-avatar-node.mlm-avatar {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    object-fit: cover !important;
    border-radius: 50% !important;
    display: block !important;
    border: none !important; /* Xóa border mặc định của theme */
    padding: 0 !important;
}

/* 4. ĐỊNH NGHĨA BORDER THEO CẤP BẬC */
/* Border Hồng cho Admin (Gốc) */
.mlm-tree-container > .mlm-node > .mlm-user-card .mlm-avatar-frame {
    border: 4px solid #db2777 !important;
    box-shadow: 0 0 10px rgba(219, 39, 119, 0.2);
}

/* Border Xám cho Cấp dưới (F1, F2...) */
.mlm-children .mlm-avatar-frame {
    border: 3px solid #64748b !important;
}

/* 5. TÊN USER */
.mlm-name {
    font-size: 14px;
    font-weight: 600;
    margin-top: 10px;
    color: #334155;
    white-space: nowrap;
}

/* 6. HỆ THỐNG ĐƯỜNG KẺ (LINE CONNECTIONS) */
.mlm-children {
    display: flex;
    justify-content: center;
    position: relative;
    padding-top: 40px; /* Tăng khoảng cách để thấy rõ đường kẻ */
}

/* Đường dọc nối từ trên xuống */
.mlm-children::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    border-left: 2px solid #3b82f6;
    height: 40px;
}

/* Đường kẻ ngang và dọc nhỏ cho mỗi node */
.mlm-node::before, .mlm-node::after {
    content: "";
    position: absolute;
    top: 0;
    right: 50%;
    border-top: 2px solid #3b82f6;
    width: 50%;
    height: 20px;
}

.mlm-node::after {
    left: 50%;
    border-left: 2px solid #3b82f6;
}

/* Xử lý node đầu, cuối và duy nhất */
.mlm-node:only-child::before, .mlm-node:only-child::after { display: none; }
.mlm-node:first-child::before { border: 0 none; }
.mlm-node:last-child::after { border-left: 0 none; }
.mlm-node:first-child::after { border-radius: 8px 0 0 0; }
.mlm-node:last-child::before { border-right: 2px solid #3b82f6; border-radius: 0 8px 0 0; }

/* 7. HIỆU ỨNG HOVER */
.mlm-avatar-frame:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.4) !important;
}

/* CONTAINER TỔNG */
.mlm-account-container {
    max-width: 1230px;
    margin: 0 auto;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #fff;
}

/* --- HEADER --- */
.mlm-profile-header {
    position: relative;
    background: #fff;
    margin-bottom: 0;
}

.mlm-cover-photo {
    width: 100%;
    height: 250px;
    background-size: cover;
    background-position: center;
    position: relative;
    background-color: #f0f2f5;
}

/* Nút máy ảnh: Ưu tiên Z-index cao nhất để không bị chặn click */
.mlm-change-cover-icon {
    position: absolute;
    right: 20px;
    bottom: 20px;
    background: rgba(0, 0, 0, 0.4);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    color: #fff !important;
    cursor: pointer;
    transition: 0.3s;
    z-index: 99; 
}
.mlm-change-cover-icon:hover { background: rgba(0, 0, 0, 0.7); }

.mlm-profile-info-bar {
    display: flex;
    align-items: center;
    padding: 0 40px;
    margin-top: -80px;
    position: relative;
    z-index: 10;
    gap: 25px;
}

.mlm-avatar-wrapper {
    position: relative;
    flex-shrink: 0;
}

.mlm-main-avatar {
    width: 160px;
    height: 160px;
    border: 3px solid #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    object-fit: cover;
    background: #fff;
    border-radius: 8px; 
}

.mlm-avatar-edit-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: #f0f2f5;
    color: #1c1e21;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 1px solid #ddd;
    z-index: 11;
}

.mlm-user-text-details {
    margin-top: 90px;
}

.mlm-user-name {
    font-size: 28px;
    font-weight: 800;
    margin: 0;
    color: #050505;
}

.mlm-user-rank {
    font-size: 15px;
    color: #65676b;
    margin-top: 4px;
}

.mlm-user-status-line {
    width: 40px;
    height: 4px;
    background: #2563eb;
    margin-top: 10px;
    border-radius: 2px;
}

/* --- MENU TABS --- */
.mlm-tabs-nav {
    display: flex;
    background: #fff;
    padding: 0 40px;
    gap: 45px; /* Giảm gap một chút để đủ chỗ cho menu mới */
    border-bottom: 1px solid #e2e8f0;
    margin-top: 10px;
    overflow-x: auto; /* Cho phép vuốt ngang trên mobile */
    white-space: nowrap; /* Giữ menu trên một dòng */
}

.mlm-tabs-nav a {
    padding: 18px 0;
    text-decoration: none;
    color: #65676b;
    font-size: 15px;
    font-weight: 600;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    flex-shrink: 0; /* Không cho phép các mục menu bị co lại quá nhỏ */
}

.mlm-tabs-nav a.active {
    color: #2563eb;
    border-bottom: 3px solid #2563eb;
}
/* Hạ thấp tiêu đề trong nội dung Tab */
.mlm-tab-content h2.tab-title {
    margin-top: 30px !important; /* Tăng thông số này để tiêu đề hạ xuống thấp hơn */
    margin-bottom: 20px;         /* Khoảng cách từ tiêu đề xuống nội dung bên dưới */
    font-weight: 700;
    color: #333;
}

/* HIỆU ỨNG TẢI */
#mlm-main-content-area[style*="opacity: 0.5"] {
    cursor: wait;
}

/* --- VÙNG NỘI DUNG --- */
.mlm-tab-content {
    padding: 30px 40px;
    min-height: 400px;
}

/* --- CÁC BOX THỐNG KÊ --- */
.mlm-wallet-grid { 
    display: flex; 
    gap: 20px; 
    margin-bottom: 30px; 
}

.mlm-card { 
    flex: 1; 
    padding: 25px; 
    border-radius: 12px; 
    text-align: center; 
    color: #fff !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.card-withdraw { background-color: #f1f5f9 !important; color: #334155 !important; }
.card-balance  { background-color: #2563eb !important; }
.card-sales    { background-color: #059669 !important; }
/* TABLE MODERN STYLE */
.mlm-table-responsive {
    overflow-x: auto;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #eef0f2;
}

.mlm-table-modern {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.mlm-table-modern th {
    background-color: #f8fafc;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    padding: 15px;
    text-align: left;
    border-bottom: 2px solid #edf2f7;
}

.mlm-table-modern td {
    padding: 15px;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    font-size: 14px;
}

.mlm-amount {
    font-weight: 700;
    color: #2563eb;
}

/* BADGE STATUS */
.mlm-badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
}

.stt-pending { background: #fef3c7; color: #92400e; }    /* Vàng nhạt */
.stt-completed { background: #dcfce7; color: #166534; }  /* Xanh lá nhạt */
.stt-cancelled { background: #fee2e2; color: #991b1b; }  /* Đỏ nhạt */
.stt-default { background: #f1f5f9; color: #475569; }
.mlm-section-header {
    border-left: 4px solid #d63384;
    padding-left: 15px;
    font-weight: 700;
    font-size: 18px;
    margin: 30px 0 20px 0;
    color: #333;
}

.mlm-ref-card {
    display: flex;
    background: #fff;
    border: 1px solid #eee;
    padding: 25px;
    border-radius: 8px;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.mlm-ref-info p { margin-bottom: 10px; font-size: 15px; }
.mlm-btn-copy {
    background: #5c67f2;
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}

.mlm-ref-qr { text-align: center; border-left: 1px solid #eee; padding-left: 40px; }
.mlm-ref-qr img { width: 120px; margin-bottom: 10px; display: block; }
.mlm-btn-download {
    font-size: 12px;
    color: #777;
    text-decoration: none;
    border: 1px solid #ddd;
    padding: 4px 12px;
    border-radius: 4px;
}

/* PRODUCT TABLE */
.mlm-product-filter { display: flex; gap: 15px; margin-bottom: 20px; }
.mlm-product-filter select, .mlm-product-filter input {
    padding: 8px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
}
.mlm-product-filter input { flex-grow: 1; }

.mlm-prod-cell { display: flex; align-items: center; gap: 15px; }
.mlm-prod-cell img { border-radius: 4px; border: 1px solid #eee; }

.mlm-reward-text { color: #d63384; font-weight: 600; }

.mlm-btn-copy-small {
    background: #3498db;
    color: #fff;
    border: none;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
}

.mlm-btn-loadmore {
    display: block;
    width: 100%;
    padding: 12px;
    background: #f8f9fa;
    border: 1px solid #eee;
    margin-top: 20px;
    cursor: pointer;
    color: #666;
}
/* Container chính */
.mlm-profile-container {
    max-width: 700px;
    margin: 0 auto;
    font-family: Arial, sans-serif;
}



.mlm-card-header-line {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 5px;
    background: #7a4a2a; /* Màu nâu đỏ phía trên card */
}

/* Input Fields */
.mlm-input-group input, 
.mlm-bank-section textarea {
    width: 100%;
    padding: 12px 15px;
    margin-bottom: 20px;
    border: 1px solid #dfe3e8;
    background-color: #f1f3f5;
    color: #495057;
    border-radius: 4px;
}

.readonly-field {
    background-color: #f1f3f5 !important;
    color: #999 !important;
}

/* Ngân hàng Section */
.mlm-bank-section label {
    display: block;
    font-weight: bold;
    color: #666;
    font-size: 13px;
    margin-bottom: 8px;
}

.mlm-bank-section .sub-label {
    font-size: 11px;
    color: #999;
    margin-top: -15px;
    margin-bottom: 20px;
}

/* Avatar Section */
.mlm-avatar-upload-section {
    text-align: center;
    margin: 20px 0;
}

.avatar-title {
    display: block;
    font-size: 11px;
    color: #999;
    margin-bottom: 10px;
}

.avatar-preview-wrapper img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid #fff;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.btn-upload-outline {
    background: transparent;
    border: 2px solid #5cb85c;
    color: #5cb85c;
    padding: 5px 25px;
    border-radius: 20px;
    margin-top: 10px;
}

/* Nút bấm chính (Vàng Gradient) */
.btn-submit-gold {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(to right, #a16a2d, #e3a64b);
    color: #fff;
    font-weight: bold;
    font-size: 18px;
    cursor: pointer;
}

/* Phần Thay đổi mật khẩu */
.mlm-password-section {
    margin-top: 50px;
}

.section-title {
    font-size: 24px;
    margin-bottom: 30px;
    color: #333;
}

.pw-row {
    display: flex;
    align-items: flex-start;
    margin-bottom: 25px;
}

.pw-row label {
    width: 200px;
    font-size: 14px;
    color: #333;
    padding-top: 10px;
    text-align: right;
    margin-right: 20px;
}

.pw-input-wrapper {
    flex: 1;
}

.pw-input-wrapper input {
    width: 100%;
    padding: 10px;
    border: 1px solid #dfe3e8;
    border-radius: 4px;
}

.input-hint {
    display: block;
    font-size: 12px;
    color: #aaa;
    margin-top: 5px;
}

.pw-action {
    text-align: right;
}

.btn-gray-outline {
    background: #f8f9fa;
    border: 1px solid #dfe3e8;
    color: #666;
    padding: 8px 20px;
    border-radius: 4px;
    font-size: 13px;
}
/* Ép độ ưu tiên cao nhất cho các thành phần MLM */
#mlm-plugin-wrapper .mlm-product-filter {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

#mlm-plugin-wrapper #mlm-search-prod, 
#mlm-plugin-wrapper #mlm-cat-filter {
    background-color: #f1f3f5 !important;
    border: 1px solid #dfe3e8 !important;
    height: 45px !important;
    padding: 0 15px !important;
    border-radius: 5px !important;
    color: #333 !important;
}

#mlm-plugin-wrapper #mlm-search-prod {
    flex-grow: 1;
}

/* Hiệu ứng làm mờ khi đang tìm kiếm */
#mlm-product-results {
    transition: opacity 0.2s ease;
}

.mlm-register-container {
    display: flex;
    justify-content: center;
    padding: 50px 20px;
    background: #f0f2f5;
    min-height: 100vh;
    max-width: 100%; /* Độ rộng form */
    margin: 20px auto;
}
/* Card Hồ sơ */

.mlm-card-form {

    border: 1px solid #eee;
    position: relative;
    background: #fff;
    width: 100%;
    max-width: 600px;
    padding: 30px;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.05);
}
.mlm-card-form2 {
    border: 1px solid #eee;
    position: relative;
    background: #fff;
    width: 100%;
    max-width: 550px;
    padding: 30px;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.05);
    max-height:350px;
}


.form-header {
    text-align: center;
    margin-bottom: 30px;
}

.form-header h2 {
    font-size: 26px;
    color: #1a202c;
    font-weight: 800;
    margin-bottom: 8px;
}

.form-header p {
    color: #718096;
    font-size: 15px;
}

.referrer-info {
    background: #f0f7ff;
    color: #0061f2;
    padding: 12px;
    border-radius: 12px;
    font-size: 14px;
    text-align: center;
    margin-bottom: 25px;
    border: 1px solid #e0eefe;
}

.input-box {
    margin-bottom: 20px;
}

.input-box label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #4a5568;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-box label i {
    margin-right: 6px;
    color: #0061f2;
}

.field-container { 
    position: relative; 
    /* Bỏ display: flex nếu có để tránh xung đột với absolute */
    display: block; 
    width: 100%;
}
.input-box input {
    width: 100%;
    padding: 14px 45px 14px 18px;
    border: 2px solid #edf2f7;
    border-radius: 14px;
    font-size: 15px;
    transition: 0.3s;
    background: #f8fafc;
}

.input-box input:focus {
    border-color: #0061f2;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(0, 97, 242, 0.1);
    outline: none;
}

/* Icon con mắt */
.toggle-password { 
    position: absolute; 
    right: 15px; 
    top: 38%;
    transform: translateY(-50%);
    color: #a0aec0; 
    cursor: pointer; 
    transition: 0.3s; 
    padding: 0; /* Bỏ padding để không làm tăng kích thước ảo */
    z-index: 10;
    font-size: 18px; /* Tăng nhẹ kích thước để dễ bấm */
    line-height: 1; /* Cực kỳ quan trọng để không bị lệch tâm */
    height: auto;
    display: flex;
    align-items: center;
}

.toggle-password:hover { 
    color: #0061f2; 
}

/* Đảm bảo input có đủ khoảng trống bên phải để không đè chữ lên icon */
.input-box input { 
    width: 100%; 
    padding: 14px 45px 14px 18px !important; /* 45px bên phải để tránh con mắt */
    /* ... các thuộc tính khác giữ nguyên ... */
}

.form-row-flex {
    display: flex;
    gap: 15px;
}

.flex-1 {
    flex: 1;
}

.mlm-btn-gradient {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #0061f2 0%, #6900f2 100%);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.3s;
    margin-top: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.mlm-btn-gradient:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 97, 242, 0.4);
}

.form-footer {
    text-align: center;
    margin-top: 25px;
    color: #718096;
    font-size: 15px;
}

.form-footer a {
    color: #0061f2;
    font-weight: 700;
    text-decoration: none;
}

@media (max-width: 500px) {
    .form-row-flex {
        flex-direction: column;
        gap: 0;
    }
}