/* 
 * User Account Styles 
 */

.account-sidebar {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
}

.account-sidebar .nav-link {
    color: var(--bs-dark);
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 5px;
    transition: all 0.3s;
}

.account-sidebar .nav-link:hover,
.account-sidebar .nav-link.active {
    background-color: var(--bs-primary);
    color: white;
}

.account-sidebar .nav-link i {
    width: 20px;
    text-align: center;
    margin-right: 10px;
}

.account-content {
    background-color: white;
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.account-header {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.account-title {
    margin-bottom: 0;
    font-weight: 600;
}

/* Profile */
.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 20px;
    border: 3px solid #eee;
}

.avatar-upload {
    position: relative;
    width: 120px;
    margin: 0 auto 20px;
}

.avatar-upload .avatar-edit {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 34px;
    height: 34px;
    background-color: var(--bs-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1;
}

.avatar-upload input {
    display: none;
}

/* Orders */
.order-item {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.order-header {
    display: flex;
    justify-content: space-between;
    padding-bottom: 10px;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.order-number {
    font-weight: 600;
}

.order-status {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-pending {
    background-color: #ffeeba;
    color: #856404;
}

.status-processing {
    background-color: #b8daff;
    color: #004085;
}

.status-shipped {
    background-color: #c3e6cb;
    color: #155724;
}

.status-delivered {
    background-color: #d4edda;
    color: #155724;
}

.status-cancelled {
    background-color: #f5c6cb;
    color: #721c24;
}

.order-product {
    display: flex;
    margin-bottom: 10px;
}

.order-product-image {
    width: 60px;
    height: 60px;
    object-fit: contain;
    margin-right: 15px;
    background-color: white;
    padding: 5px;
    border: 1px solid #eee;
    border-radius: 5px;
}

.order-product-name {
    font-weight: 500;
}

.order-product-price {
    font-weight: 500;
    color: var(--bs-primary);
}

.order-total {
    display: flex;
    justify-content: space-between;
    padding-top: 10px;
    margin-top: 10px;
    border-top: 1px solid #eee;
}

.order-total-label {
    font-weight: 600;
}

.order-total-value {
    font-weight: 600;
    color: var(--bs-primary);
}

/* Order Details */
.order-detail-header {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.order-detail-info {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
}

.order-detail-info div {
    margin-bottom: 15px;
}

.order-detail-label {
    font-weight: 500;
    color: #666;
    display: block;
    margin-bottom: 5px;
}

.order-detail-value {
    font-weight: 600;
}

.order-detail-products {
    margin-top: 30px;
}

.order-detail-product {
    display: flex;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
}

.order-detail-product:last-child {
    border-bottom: none;
}

.order-detail-product-image {
    width: 80px;
    height: 80px;
    object-fit: contain;
    background-color: white;
    padding: 5px;
    border: 1px solid #eee;
    border-radius: 5px;
    margin-right: 15px;
}

.order-detail-product-name {
    font-weight: 500;
}

.order-detail-product-price {
    color: var(--bs-primary);
    font-weight: 500;
}

.order-detail-product-quantity {
    color: #666;
}

.order-detail-summary {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-top: 30px;
}

.order-detail-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.order-detail-summary-row:last-child {
    border-bottom: none;
    font-weight: 700;
    font-size: 1.1rem;
}

.order-detail-actions {
    margin-top: 30px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Address Book */
.address-card {
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    position: relative;
}

.address-card.default {
    border-color: var(--bs-primary);
}

.address-card.default::after {
    content: 'Mặc định';
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: var(--bs-primary);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
}

.address-name {
    font-weight: 600;
    margin-bottom: 10px;
}

.address-details {
    margin-bottom: 15px;
    line-height: 1.6;
}

.address-actions {
    display: flex;
    gap: 10px;
}

/* Wishlist */
.wishlist-item {
    display: flex;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
}

.wishlist-item:last-child {
    border-bottom: none;
}

.wishlist-item-image {
    width: 80px;
    height: 80px;
    object-fit: contain;
    background-color: white;
    padding: 5px;
    border: 1px solid #eee;
    border-radius: 5px;
    margin-right: 15px;
}

.wishlist-item-name {
    font-weight: 500;
}

.wishlist-item-price {
    color: var(--bs-primary);
    font-weight: 500;
    margin-top: 5px;
}

.wishlist-item-actions {
    margin-top: 10px;
}

/* Responsive Styles */
@media (max-width: 991px) {
    .account-sidebar {
        margin-bottom: 30px;
    }
}

@media (max-width: 767px) {
    /* Mobile navigation tabs - Clean & modern design */
    .account-mobile-tabs {
        display: flex;
        gap: 6px;
        overflow-x: auto;
        background: #ffffff;
        padding: 8px;
        border-radius: 20px;
        box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
        position: sticky;
        top: 60px;
        z-index: 20;
        margin: 0 -10px 20px -10px;
        scrollbar-width: none;
        -ms-overflow-style: none;
        border: 1px solid rgba(0, 0, 0, 0.05);
    }
    
    .account-mobile-tabs::-webkit-scrollbar {
        display: none;
    }
    
    .account-mobile-tabs .tab-btn {
        flex: 1;
        background: transparent;
        border: none;
        padding: 12px 10px;
        font-size: 12px;
        font-weight: 500;
        border-radius: 14px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        min-width: 70px;
        color: #6b7280;
        transition: all 0.25s ease;
        position: relative;
    }
    
    .account-mobile-tabs .tab-btn i { 
        font-size: 20px; 
        margin-bottom: 2px;
        transition: all 0.25s ease;
    }
    
    .account-mobile-tabs .tab-btn:hover {
        background: #f3f4f6;
        color: #374151;
    }
    
    .account-mobile-tabs .tab-btn.active {
        background: #3b82f6;
        color: #ffffff;
        box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
        transform: translateY(-1px);
    }
    
    .account-mobile-tabs .tab-btn.active i {
        color: #ffffff;
    }
    
    .account-mobile-tabs .tab-btn.text-danger.active { 
        background: #ef4444;
        box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
        color: #ffffff;
    }
    
    .account-mobile-tabs .tab-btn.text-danger.active i {
        color: #ffffff;
    }

    /* Container adjustments for mobile */
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .account-content {
        padding: 20px;
        border-radius: 20px;
        margin-top: 10px;
        background: #ffffff;
        box-shadow: 0 4px 25px rgba(0, 0, 0, 0.08);
        border: 1px solid rgba(0, 0, 0, 0.05);
    }

    /* Cards mobile optimization */
    .card {
        border-radius: 16px;
        border: 1px solid rgba(0, 0, 0, 0.06);
        box-shadow: 0 2px 15px rgba(0, 0, 0, 0.06);
        margin-bottom: 16px;
        overflow: hidden;
        background: #ffffff;
    }
    
    .card-body {
        padding: 20px;
    }

    /* Orders mobile styling */
    .order-item {
        background: #ffffff;
        border: 1px solid rgba(0, 0, 0, 0.06);
        border-radius: 16px;
        padding: 20px;
        margin-bottom: 16px;
        box-shadow: 0 2px 15px rgba(0, 0, 0, 0.06);
        transition: all 0.2s ease;
    }
    
    .order-item:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
        border-color: rgba(59, 130, 246, 0.2);
    }
    
    .order-header {
        flex-direction: column;
        gap: 12px;
    }
    
    .order-status {
        margin-top: 0;
        align-self: flex-start;
        padding: 6px 14px;
        border-radius: 20px;
        font-size: 11px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    /* Address cards mobile */
    .address-card {
        border-radius: 16px;
        border: 1px solid rgba(0, 0, 0, 0.06);
        background: #ffffff;
        padding: 20px;
        margin-bottom: 16px;
        box-shadow: 0 2px 15px rgba(0, 0, 0, 0.06);
        transition: all 0.2s ease;
    }
    
    .address-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
        border-color: rgba(59, 130, 246, 0.2);
    }

    /* Form elements mobile */
    .form-control, .form-select {
        border-radius: 12px;
        border: 1.5px solid #e5e7eb;
        padding: 14px 16px;
        font-size: 16px;
        transition: all 0.2s ease;
        background: #ffffff;
    }
    
    .form-control:focus, .form-select:focus {
        border-color: #3b82f6;
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
        outline: none;
    }
    
    .form-label {
        font-weight: 600;
        color: #374151;
        margin-bottom: 8px;
        font-size: 14px;
    }

    /* Buttons mobile */
    .btn {
        border-radius: 12px;
        padding: 12px 20px;
        font-weight: 600;
        font-size: 14px;
        transition: all 0.2s ease;
        border: none;
    }
    
    .btn-primary {
        background: #3b82f6;
        color: #ffffff;
        box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
    }
    
    .btn-primary:hover {
        background: #2563eb;
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
    }
    
    .btn-outline-primary {
        border: 1.5px solid #3b82f6;
        color: #3b82f6;
        background: transparent;
    }
    
    .btn-outline-primary:hover {
        background: #3b82f6;
        border-color: #3b82f6;
        color: #ffffff;
        transform: translateY(-1px);
        box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
    }
    
    .btn-outline-success {
        border: 1.5px solid #10b981;
        color: #10b981;
        background: transparent;
    }
    
    .btn-outline-success:hover {
        background: #10b981;
        border-color: #10b981;
        color: #ffffff;
    }
    
    .btn-outline-danger {
        border: 1.5px solid #ef4444;
        color: #ef4444;
        background: transparent;
    }
    
    .btn-outline-danger:hover {
        background: #ef4444;
        border-color: #ef4444;
        color: #ffffff;
    }

    /* Typography mobile */
    .account-title {
        font-size: 24px;
        font-weight: 700;
        color: #111827;
        margin-bottom: 8px;
    }
    
    h6 {
        font-size: 16px;
        font-weight: 600;
        color: #374151;
    }

    /* Empty states mobile */
    .text-center.py-5 {
        padding: 40px 20px !important;
        background: #ffffff;
        border-radius: 16px;
        border: 2px dashed #e5e7eb;
    }
    
    .text-center.py-5 i {
        opacity: 0.6;
        margin-bottom: 16px;
        color: #9ca3af;
    }

    /* Order detail info mobile */
    .order-detail-info {
        flex-direction: column;
        gap: 16px;
    }
    
    .order-detail-product {
        padding: 16px 0;
        border-bottom: 1px solid #f3f4f6;
    }
    
    .order-detail-product-image {
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    }

    /* Badge improvements */
    .badge {
        border-radius: 20px;
        padding: 6px 12px;
        font-size: 11px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    .bg-primary { background: #3b82f6 !important; }
    .bg-success { background: #10b981 !important; }
    .bg-warning { background: #f59e0b !important; }
    .bg-danger { background: #ef4444 !important; }
    .bg-info { background: #06b6d4 !important; }
    .bg-secondary { background: #6b7280 !important; }

    /* Pagination mobile */
    .pagination {
        justify-content: center;
        gap: 8px;
    }
    
    .page-link {
        border-radius: 12px;
        border: 1px solid #e5e7eb;
        background: #ffffff;
        color: #374151;
        padding: 10px 14px;
        font-weight: 500;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
        transition: all 0.2s ease;
    }
    
    .page-link:hover {
        background: #f9fafb;
        border-color: #d1d5db;
        color: #111827;
        transform: translateY(-1px);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    }
    
    .page-item.active .page-link {
        background: #3b82f6;
        border-color: #3b82f6;
        color: white;
        box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
    }
}

/* Skeleton Loading - Enhanced for mobile */
.placeholder-wave { 
    position: relative; 
    overflow: hidden;
    background: linear-gradient(90deg, #f0f2f5 0%, #ffffff 50%, #f0f2f5 100%);
    border-radius: 12px;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.placeholder { 
    display: inline-block; 
    background: linear-gradient(90deg, #e9ecef 0%, #f8f9fa 50%, #e9ecef 100%);
    border-radius: 8px; 
    min-height: 12px;
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.2s ease-in-out infinite;
}

.placeholder-wave .placeholder { 
    position: relative; 
    overflow: hidden;
}

.placeholder-wave .placeholder::after { 
    content: ""; 
    position: absolute; 
    inset: 0; 
    background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.8) 50%, rgba(255,255,255,0) 100%); 
    animation: placeholder-wave 1.2s linear infinite; 
    border-radius: inherit;
}

@keyframes placeholder-wave { 
    0% { transform: translateX(-100%); } 
    100% { transform: translateX(100%); } 
}

@keyframes skeleton-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes skeleton-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Enhanced skeleton cards for mobile */
@media (max-width: 767px) {
    .placeholder-wave.card {
        border-radius: 16px;
        background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
        border: 1px solid rgba(102, 126, 234, 0.1);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
        margin-bottom: 16px;
        overflow: hidden;
        position: relative;
    }
    
    .placeholder-wave.card::before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, transparent 0%, rgba(102, 126, 234, 0.1) 50%, transparent 100%);
        animation: skeleton-slide 1.5s infinite;
    }
    
    .placeholder-wave .card-body {
        padding: 20px;
    }
    
    .placeholder-wave .placeholder {
        border-radius: 8px;
        margin-bottom: 12px;
    }
    
    .placeholder-wave .placeholder:nth-child(1) { height: 20px; }
    .placeholder-wave .placeholder:nth-child(2) { height: 16px; width: 80%; }
    .placeholder-wave .placeholder:nth-child(3) { height: 14px; width: 60%; }
    .placeholder-wave .placeholder:nth-child(4) { height: 12px; width: 40%; }
}

@keyframes skeleton-slide {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Loading states */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(102, 126, 234, 0.1);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(102, 126, 234, 0.2);
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Modal enhancements for mobile */
@media (max-width: 767px) {
    .modal-dialog {
        margin: 1rem;
        max-width: calc(100vw - 2rem);
    }
    
    .modal-content {
        border-radius: 20px;
        border: none;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
        overflow: hidden;
    }
    
    .modal-header {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        border: none;
        padding: 20px;
    }
    
    .modal-title {
        font-weight: 700;
        font-size: 18px;
    }
    
    .modal-body {
        padding: 24px;
    }
    
    .modal-footer {
        border: none;
        padding: 20px 24px;
        background: #f8f9fa;
    }
    
    .btn-close {
        background: rgba(255, 255, 255, 0.3);
        border-radius: 50%;
        width: 32px;
        height: 32px;
        opacity: 1;
    }
    
    .btn-close:hover {
        background: rgba(255, 255, 255, 0.5);
    }
}

/* Alert enhancements for mobile */
@media (max-width: 767px) {
    .alert {
        border-radius: 16px;
        border: none;
        padding: 16px 20px;
        margin-bottom: 20px;
        box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
        position: relative;
        overflow: hidden;
    }
    
    .alert::before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 4px;
        background: currentColor;
    }
    
    .alert-success {
        background: #ecfdf5;
        color: #065f46;
        border-left-color: #10b981;
    }
    
    .alert-danger {
        background: #fef2f2;
        color: #991b1b;
        border-left-color: #ef4444;
    }
    
    .alert-warning {
        background: #fffbeb;
        color: #92400e;
        border-left-color: #f59e0b;
    }
    
    .alert-info {
        background: #f0f9ff;
        color: #1e40af;
        border-left-color: #3b82f6;
    }
    
    .alert i {
        font-size: 18px;
        margin-right: 12px;
    }
    
    .btn-close {
        background: transparent;
        color: currentColor;
        opacity: 0.7;
        font-size: 16px;
        width: 24px;
        height: 24px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .btn-close:hover {
        opacity: 1;
        background: rgba(0, 0, 0, 0.1);
    }
}

/* Additional mobile improvements */
@media (max-width: 767px) {
    /* Improved scrolling */
    .account-mobile-tabs {
        scrollbar-width: none;
        -ms-overflow-style: none;
        scroll-behavior: smooth;
    }
    
    .account-mobile-tabs::-webkit-scrollbar {
        display: none;
    }
    
    /* Better touch targets */
    .btn, .tab-btn, .page-link {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Improved form elements */
    .form-check-input {
        width: 20px;
        height: 20px;
        border-radius: 6px;
        border: 2px solid #dee2e6;
    }
    
    .form-check-input:checked {
        background-color: #667eea;
        border-color: #667eea;
        box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
    }
    
    .form-check-label {
        padding-left: 8px;
        font-weight: 500;
    }
    
    /* Better spacing for mobile */
    .mb-3 { margin-bottom: 1.5rem !important; }
    .mb-4 { margin-bottom: 2rem !important; }
    .py-3 { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }
    .py-4 { padding-top: 2rem !important; padding-bottom: 2rem !important; }
    
    /* Improved list groups */
    .list-group-item {
        border-radius: 12px !important;
        border: 1px solid rgba(102, 126, 234, 0.15) !important;
        margin-bottom: 8px;
        padding: 16px 20px;
        background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
        transition: all 0.3s ease;
    }
    
    .list-group-item:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    }
    
    .list-group-item.active {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
        border-color: #667eea !important;
        color: white !important;
        box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    }
}

/* Team Business Tree Visualization Styles */
.team-business-section {
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 15px;
    margin-bottom: 20px;
}

.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.stat-card i {
    font-size: 2.5rem;
    margin-bottom: 15px;
    color: #007bff;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.stat-label {
    color: #666;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Tree Visualization */
.tree-visualization {
    background: #fff;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    overflow-x: auto;
    overflow-y: visible;
    min-height: 500px;
    max-height: 800px;
    position: relative;
}

/* Custom scrollbar for tree visualization */
.tree-visualization::-webkit-scrollbar {
    height: 12px;
    width: 12px;
}

.tree-visualization::-webkit-scrollbar-track {
    background: #f1f3f4;
    border-radius: 10px;
}

.tree-visualization::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #007bff, #0056b3);
    border-radius: 10px;
    border: 2px solid #f1f3f4;
}

.tree-visualization::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #0056b3, #004085);
}

.tree-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: max(1200px, calc(100vw - 100px));
    position: relative;
    padding: 20px 40px;
    width: fit-content;
}

.tree-level-row {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    margin: 40px 0;
    position: relative;
    width: 100%;
    min-width: 100%;
    flex-wrap: nowrap;
    overflow-x: visible;
}

.tree-level-row:first-child {
    margin-top: 20px;
}

.tree-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 15px;
    position: relative;
    flex-shrink: 0;
    min-width: 140px;
}

.tree-node-card {
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    border: 2px solid #e9ecef;
    border-radius: 15px;
    padding: 18px;
    text-align: center;
    min-width: 160px;
    max-width: 180px;
    position: relative;
    transition: all 0.3s ease;
    box-shadow: 0 3px 12px rgba(0,0,0,0.08);
}

.tree-node-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    border-color: #007bff;
}

.tree-node-card.root-node {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border-color: #28a745;
    color: #fff;
    font-weight: bold;
    transform: scale(1.15);
    box-shadow: 0 6px 25px rgba(40, 167, 69, 0.3);
}

.tree-node-card.root-node:hover {
    transform: scale(1.18) translateY(-3px);
}

.tree-node-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    margin: 0 auto 12px;
    border: 4px solid #fff;
    box-shadow: 0 3px 12px rgba(0,0,0,0.15);
}

.root-node .tree-node-avatar {
    background: linear-gradient(135deg, #ffc107 0%, #ffdb4a 100%);
    color: #000;
    border-color: rgba(255,255,255,0.8);
}

.tree-node-name {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #333;
    line-height: 1.3;
}

.root-node .tree-node-name {
    color: #fff;
}

.tree-node-info {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
    line-height: 1.2;
}

.root-node .tree-node-info {
    color: rgba(255,255,255,0.9);
}

.tree-level-badge {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0,123,255,0.3);
}

.root-node .tree-level-badge {
    background: linear-gradient(135deg, #ffc107, #ffdb4a);
    color: #000;
}

/* Tree level headers */
.tree-level-header {
    text-align: center;
    margin-bottom: 25px;
    position: relative;
    z-index: 10;
}

.tree-level-title {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    padding: 10px 25px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    display: inline-block;
    box-shadow: 0 3px 15px rgba(0,123,255,0.4);
    position: relative;
}

.tree-level-title.root-title {
    background: linear-gradient(135deg, #28a745, #20c997);
    box-shadow: 0 3px 15px rgba(40,167,69,0.4);
}

.tree-level-title::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(135deg, rgba(255,255,255,0.3), transparent);
    border-radius: 27px;
    z-index: -1;
}

/* Tree Connection Lines */
.tree-connections {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 1;
}

.tree-connection-line {
    position: absolute;
    background: linear-gradient(135deg, #007bff, #6c757d);
    border-radius: 2px;
    z-index: 1;
}

.tree-connection-vertical {
    width: 3px;
    background: linear-gradient(to bottom, #007bff 0%, #6c757d 50%, #007bff 100%);
}

.tree-connection-horizontal {
    height: 3px;
    background: linear-gradient(to right, #6c757d 0%, #007bff 50%, #6c757d 100%);
}

/* Enhanced Tree Connection System */
.tree-level-connector {
    position: relative;
    height: 60px;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 10px 0;
    z-index: 1;
}

.vertical-line {
    width: 4px;
    height: 40px;
    background: linear-gradient(to bottom, #007bff, #0056b3);
    border-radius: 2px;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

.vertical-line::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 8px solid #007bff;
}

.vertical-line::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid #0056b3;
}

.horizontal-branches {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(to right, transparent 20%, #007bff 50%, transparent 80%);
    transform: translateY(-50%);
}

.branch-node {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: #007bff;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 123, 255, 0.4);
}

/* Simple Tree Connection Lines */
.tree-node::before {
    content: '';
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 25px;
    background: #007bff;
    z-index: 1;
}

.tree-node:first-child::before {
    display: none;
}

.tree-level-row[data-tree-level]::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 10%;
    right: 10%;
    height: 2px;
    background: linear-gradient(to right, transparent, #007bff, transparent);
    z-index: 1;
    pointer-events: none;
}

.tree-node-card::after {
    content: 'Click để xem thông tin';
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 15;
}

.tree-node-card:hover::after {
    opacity: 1;
}

/* Level connection indicators */
.level-connection-hub {
    position: relative;
    width: 100%;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 15px 0;
}

.connection-hub-circle {
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, #28a745, #20c997);
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 3px 12px rgba(40, 167, 69, 0.4);
    position: relative;
    z-index: 2;
}

.connection-hub-circle::before {
    content: '';
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 20px;
    background: linear-gradient(to bottom, #007bff, #28a745);
}

.connection-hub-circle::after {
    content: '';
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 20px;
    background: linear-gradient(to bottom, #28a745, #007bff);
}

/* Empty level styling */
.empty-tree-level {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 140px;
    padding: 30px;
    border: 3px dashed #dee2e6;
    border-radius: 15px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: #6c757d;
    margin: 0 30px;
    transition: all 0.3s ease;
}

.empty-tree-level:hover {
    border-color: #007bff;
    color: #007bff;
    transform: scale(1.02);
}

.empty-tree-level i {
    font-size: 32px;
    margin-bottom: 15px;
    opacity: 0.6;
}

.empty-tree-level p {
    font-weight: 600;
    margin: 0;
}

/* Level Details Tabs */
.level-tabs {
    display: flex;
    justify-content: center;
    margin: 30px 0;
    gap: 10px;
    flex-wrap: wrap;
}

.level-tab {
    position: relative;
}

.level-tab input[type="radio"] {
    display: none;
}

.level-tab label {
    display: block;
    padding: 12px 20px;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    color: #6c757d;
    min-width: 80px;
    text-align: center;
}

.level-tab input[type="radio"]:checked + label {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    border-color: #007bff;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,123,255,0.3);
}

.level-tab label:hover {
    background: #e9ecef;
    transform: translateY(-1px);
}

.level-tab input[type="radio"]:checked + label:hover {
    background: linear-gradient(135deg, #0056b3, #004085);
}

/* Member Cards in Level Details */
.member-card {
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    height: 100%;
}

.member-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border-color: #007bff;
}

.member-info {
    display: flex;
    align-items: center;
}

.member-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    margin-right: 15px;
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.member-details h6 {
    margin: 0 0 5px 0;
    color: #333;
    font-weight: 700;
    font-size: 16px;
}

.member-details small {
    color: #666;
    font-size: 13px;
    line-height: 1.3;
    display: block;
    margin: 3px 0;
}

.member-connection-indicator {
    margin-top: 10px;
    padding: 8px;
    background: linear-gradient(135deg, rgba(0, 123, 255, 0.1), rgba(0, 123, 255, 0.05));
    border-radius: 8px;
    border-left: 3px solid #007bff;
    text-align: center;
}

.member-connection-indicator i {
    margin-right: 5px;
    animation: linkPulse 2s infinite;
}

.member-connection-indicator small {
    color: #007bff;
    font-weight: 600;
}

@keyframes linkPulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* Hierarchy Tree Structure */
.hierarchy-tree-container {
    background: #fff;
    border-radius: 15px;
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
    max-width: 100%;
    position: relative;
}

.tree-level {
    margin: 30px 0;
    position: relative;
    width: 100%;
    clear: both;
}

.tree-level.level-root {
    margin-bottom: 40px;
    text-align: center;
}

.tree-level.level-root .level-nodes {
    justify-content: center !important;
}

/* Removed leader-group styles - using unified level-nodes */

.level-title {
    font-size: 14px;
    font-weight: bold;
    color: white;
    margin-bottom: 15px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #007bff, #0056b3);
    border-radius: 20px;
    display: inline-block;
    box-shadow: 0 2px 8px rgba(0,123,255,0.3);
    position: sticky;
    left: 10px;
    z-index: 5;
}

.level-nodes {
    display: flex !important;
    justify-content: flex-start !important;
    gap: 20px !important;
    flex-wrap: nowrap !important;
    position: relative;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    padding: 20px 10px 50px 10px !important;
    align-items: flex-start !important;
    width: 100%;
}

/* Custom scrollbar for level nodes */
.level-nodes::-webkit-scrollbar {
    height: 8px;
}

.level-nodes::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.level-nodes::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #007bff, #28a745);
    border-radius: 4px;
}

.level-nodes::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #0056b3, #1e7e34);
}

.tree-node {
    flex: 0 0 auto;
    position: relative;
    margin: 0;
}

.node-card {
    background: linear-gradient(135deg, #fff, #f8f9fa);
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    width: 180px;
    height: 160px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.node-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    border-color: #007bff;
}

.node-card.root-card {
    border-color: #ffc107;
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    transform: scale(1.1);
}

.node-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #007bff;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    margin: 0 auto 8px;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.node-name {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #333;
    line-height: 1.2;
}

.node-info {
    font-size: 10px;
    color: #666;
    margin-bottom: 4px;
    line-height: 1.2;
}

.node-id {
    font-size: 9px;
    color: #999;
    line-height: 1.3;
    margin-top: auto;
}

.leader-id {
    color: #ffc107 !important;
    font-weight: bold;
    margin-top: 2px;
    font-size: 9px;
}

.connection-indicator {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: #e3f2fd;
    border: 1px solid #2196f3;
    border-radius: 8px;
    padding: 2px 6px;
    font-size: 8px;
    color: #1976d2;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(33,150,243,0.2);
    z-index: 10;
}

.connection-indicator i {
    color: #007bff;
    margin-right: 3px;
}

.more-node .node-card {
    border-style: dashed;
    background: linear-gradient(135deg, #e9ecef, #f8f9fa);
    cursor: pointer;
}

.more-node .node-avatar {
    background: #6c757d;
    font-size: 24px;
}

.empty-level {
    padding: 30px;
    color: #6c757d;
    text-align: center;
}

.empty-level i {
    font-size: 24px;
    margin-bottom: 10px;
    opacity: 0.5;
}

/* Tree Connections */
.tree-connection {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    width: 3px;
    height: 25px;
    z-index: 1;
}

.vertical-line {
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, #007bff, #28a745);
    border-radius: 2px;
}

.horizontal-line {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 2px;
    background: linear-gradient(to right, transparent 20%, #007bff 50%, transparent 80%);
    margin-left: -100px;
}

/* Root connection */
.level-root + .tree-level .tree-connection {
    background: linear-gradient(to bottom, #ffc107, #007bff);
}

/* Hierarchy Connections */
.hierarchy-connection {
    box-shadow: 0 2px 6px rgba(0, 123, 255, 0.2);
}

.connection-dot {
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.start-dot {
    border-color: #007bff;
}

.end-dot {
    border-color: #28a745;
}

/* Animations for hierarchy */
@keyframes connectionDraw {
    from {
        transform: scaleX(0) rotate(var(--angle));
        opacity: 0;
    }
    to {
        transform: scaleX(1) rotate(var(--angle));
        opacity: 1;
    }
}

@keyframes dotPulse {
    from {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.8;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Leader group styling */
.leader-group::before {
    content: '';
    position: absolute;
    top: -15px;
    left: 10%;
    right: 10%;
    height: 2px;
    background: linear-gradient(to right, transparent, rgba(0, 123, 255, 0.3), transparent);
    z-index: 1;
}

/* Node positioning for better connections */
.tree-node.root-node {
    z-index: 10;
}

.tree-node.member-node {
    z-index: 5;
}

/* Responsive hierarchy */
@media (max-width: 768px) {
    .hierarchy-tree-container {
        padding: 20px;
        overflow-x: scroll;
    }
    
    .leader-group {
        gap: 10px;
        margin: 0 10px;
    }
    
    .tree-level {
        margin: 30px 0;
    }
}

/* Responsive Design */
@media (max-width: 1200px) {
    .tree-container {
        min-width: max(1000px, calc(100vw - 80px));
        padding: 20px 20px;
    }
    
    .tree-node {
        margin: 0 12px;
        min-width: 130px;
    }
    
    .tree-node-card {
        min-width: 130px;
        max-width: 150px;
        padding: 14px;
    }
}

@media (max-width: 768px) {
    .tree-visualization {
        padding: 15px 10px;
        border-radius: 12px;
    }
    
    .tree-container {
        min-width: max(800px, calc(100vw - 60px));
        padding: 15px 15px;
    }
    
    .tree-node {
        margin: 0 8px;
        min-width: 110px;
    }
    
    .tree-node-card {
        min-width: 110px;
        max-width: 130px;
        padding: 12px;
    }
    
    .tree-node-avatar {
        width: 45px;
        height: 45px;
        font-size: 14px;
    }
    
    .tree-node-name {
        font-size: 12px;
    }
    
    .tree-node-info {
        font-size: 10px;
    }
    
    .level-tabs {
        gap: 5px;
    }
    
    .level-tab label {
        padding: 8px 12px;
        min-width: 55px;
        font-size: 13px;
    }
}

@media (max-width: 576px) {
    .tree-visualization {
        padding: 10px 5px;
        margin: 0 -10px;
    }
    
    .tree-container {
        min-width: max(700px, calc(100vw - 40px));
        padding: 10px 10px;
    }
    
    .tree-node {
        margin: 0 6px;
        min-width: 100px;
    }
    
    .tree-node-card {
        min-width: 100px;
        max-width: 120px;
        padding: 10px;
    }
    
    .tree-node-avatar {
        width: 40px;
        height: 40px;
        font-size: 12px;
    }
    
    .tree-node-name {
        font-size: 11px;
        line-height: 1.2;
    }
    
    .tree-node-info {
        font-size: 9px;
    }
    
    .tree-level-title {
        font-size: 13px;
        padding: 6px 12px;
    }
    
    .separator-line {
        width: 100px;
    }
}

/* Enhanced Tree Animation Keyframes */
@keyframes lineGrowHorizontal {
    from {
        transform: scaleX(0);
        opacity: 0;
    }
    to {
        transform: scaleX(1);
        opacity: 0.8;
    }
}

@keyframes lineGrowVertical {
    from {
        transform: translateX(-50%) scaleY(0);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) scaleY(1);
        opacity: 1;
    }
}

@keyframes dotAppear {
    from {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.8;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes arrowAppear {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Tree Node Enhancements */
.tree-node-details {
    font-size: 10px;
    color: #6c757d;
    margin: 5px 0;
    line-height: 1.2;
}

.tree-node-details small {
    display: block;
    margin: 1px 0;
}

.tree-node-card {
    min-height: 160px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Connection Line Styles */
.tree-horizontal-line {
    transform-origin: center;
}

.tree-main-vertical {
    transform-origin: top center;
}

.tree-junction-dot {
    box-shadow: 0 2px 6px rgba(0, 123, 255, 0.3);
}

/* Node Connection Lines */
.node-connection-line {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 20px;
    background: linear-gradient(to bottom, transparent, #007bff);
    z-index: 1;
    opacity: 0.6;
}

/* Scroll Indicator */
.scroll-indicator {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 123, 255, 0.1);
    border: 2px solid #007bff;
    border-radius: 20px;
    padding: 8px 12px;
    font-size: 12px;
    color: #007bff;
    font-weight: 600;
    animation: pulseIndicator 2s infinite;
    z-index: 5;
    pointer-events: none;
}

.scroll-indicator.hidden {
    opacity: 0;
    transition: opacity 0.3s ease;
}

@keyframes pulseIndicator {
    0%, 100% {
        opacity: 0.7;
        transform: translateY(-50%) scale(1);
    }
    50% {
        opacity: 1;
        transform: translateY(-50%) scale(1.05);
    }
}

/* Tree Level Width Management */
.tree-level-row[data-tree-level] {
    justify-content: flex-start;
    padding-left: 20px;
}

.tree-level-row[data-tree-level="2"] .tree-node:nth-child(n+4) {
    margin-left: 25px;
}

.tree-level-row[data-tree-level="3"] .tree-node:nth-child(n+6) {
    margin-left: 20px;
}

.tree-level-row[data-tree-level="4"] .tree-node:nth-child(n+4) {
    margin-left: 15px;
}

.tree-level-row[data-tree-level="5"] .tree-node:nth-child(n+5) {
    margin-left: 15px;
}

/* Enhanced Empty Level */
.empty-tree-level {
    min-width: 300px;
    max-width: 400px;
    margin: 0 auto;
}

/* Loading State for Tree */
.tree-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    text-align: center;
}

.tree-loading .spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.3em;
}

.tree-loading-skeleton {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
}

.skeleton-node {
    width: 140px;
    height: 180px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeletonLoading 1.5s infinite;
    border-radius: 12px;
}

@keyframes skeletonLoading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Connection Animation Styles */
.sibling-connection-line {
    transform-origin: left center;
    animation: connectionGrow 0.8s cubic-bezier(0.4, 0.0, 0.2, 1) 0.5s both;
}

.parent-child-connector {
    animation: connectorFadeIn 0.6s cubic-bezier(0.4, 0.0, 0.2, 1) 0.8s both;
}

.connection-junction {
    animation: junctionPulse 0.4s cubic-bezier(0.4, 0.0, 0.2, 1) 1s both;
}

@keyframes connectionGrow {
    from {
        transform: scaleX(0);
        opacity: 0;
    }
    to {
        transform: scaleX(1);
        opacity: 0.6;
    }
}

@keyframes connectorFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
    to {
        opacity: 0.7;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes junctionPulse {
    from {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.5);
        opacity: 0.8;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Enhanced connector arrows */
.connector-arrow {
    background: rgba(0, 123, 255, 0.1);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 10px auto;
    transition: all 0.3s ease;
}

.connector-arrow:hover {
    background: rgba(0, 123, 255, 0.2);
    transform: scale(1.1);
}

.connector-arrow i {
    animation: arrowBounce 2s infinite;
}

@keyframes arrowBounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-3px);
    }
    60% {
        transform: translateY(-2px);
    }
}

/* Tree structure enhancements */
.tree-level-row[data-tree-level] {
    position: relative;
    margin: 30px 0;
}

.tree-level-row[data-tree-level="1"] {
    margin-top: 20px;
}

.tree-level-row[data-tree-level]:not(:last-child)::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 30px;
    background: linear-gradient(to bottom, #007bff, transparent);
    opacity: 0.5;
    animation: verticalLineGrow 0.6s cubic-bezier(0.4, 0.0, 0.2, 1) 1.2s both;
}

@keyframes verticalLineGrow {
    from {
        height: 0;
        opacity: 0;
    }
    to {
        height: 30px;
        opacity: 0.5;
    }
}

/* Root node special styling - remove conflicting after */
.root-node {
    position: relative;
}

.root-node .tree-node-card::after {
    content: 'Người sáng lập hệ thống' !important;
}

.more-members-card::after {
    content: 'Click để xem tất cả thành viên' !important;
}

/* Simple vertical connectors */
.tree-connector {
    width: 100%;
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 5px 0;
}

.tree-connector-line {
    width: 2px;
    height: 100%;
    background: linear-gradient(to bottom, #007bff, #6c757d);
    border-radius: 1px;
}

/* Level separation with visual connection */
.tree-level-separator {
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 10px 0;
}

.tree-level-separator .separator-line {
    width: 2px;
    height: 30px;
    background: linear-gradient(to bottom, #007bff, #28a745);
    border-radius: 1px;
    position: relative;
}

.tree-level-separator .separator-line::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    background: #007bff;
    border-radius: 50%;
    border: 2px solid white;
}

.tree-level-separator .separator-line::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    background: #28a745;
    border-radius: 50%;
    border: 2px solid white;
}

/* Tree Animations */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

@keyframes treeNodeAppear {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes connectionGrow {
    from {
        width: 0;
        opacity: 0;
    }
    to {
        width: 100%;
        opacity: 0.3;
    }
}

.tree-node-card {
    animation: treeNodeAppear 0.6s cubic-bezier(0.4, 0.0, 0.2, 1) backwards;
}

.tree-connection-horizontal {
    animation: connectionGrow 0.8s ease-out 0.3s backwards;
}

/* Hover effects for tree */
.tree-node-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0,123,255,0.1), rgba(0,123,255,0.05));
    border-radius: 15px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.tree-node-card:hover::before {
    opacity: 1;
}

.root-node::before {
    background: linear-gradient(135deg, rgba(255,193,7,0.2), rgba(255,193,7,0.1)) !important;
}

/* More Members Card Styling */
.more-members-card {
    transition: all 0.3s ease !important;
}

.more-members-card:hover {
    background: linear-gradient(135deg, #6c757d, #495057) !important;
    color: white !important;
    border-color: #6c757d !important;
    transform: translateY(-3px) scale(1.02) !important;
    box-shadow: 0 8px 25px rgba(108, 117, 125, 0.3) !important;
}

.more-members-card:hover .tree-node-name,
.more-members-card:hover .tree-node-info {
    color: white !important;
}

/* Tree Level Separator */
.tree-level-separator {
    display: flex;
    justify-content: center;
    margin: 20px 0;
    position: relative;
    height: 20px;
}

.separator-line {
    width: 200px;
    height: 2px;
    background: linear-gradient(to right, transparent, #007bff, transparent);
    opacity: 0.3;
    border-radius: 2px;
    position: relative;
}

.separator-line::before,
.separator-line::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: #007bff;
    border-radius: 50%;
    top: -3px;
    opacity: 0.6;
}

.separator-line::before {
    left: -4px;
}

.separator-line::after {
    right: -4px;
}

/* Pulse Animation */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 8px 25px rgba(0, 123, 255, 0.4);
    }
    100% {
        transform: scale(1);
    }
}

/* Enhanced Statistics Card Animation */
.stat-card {
    transform: translateY(20px);
    opacity: 0;
    animation: slideUpFadeIn 0.6s cubic-bezier(0.4, 0.0, 0.2, 1) forwards;
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }
.stat-card:nth-child(4) { animation-delay: 0.4s; }

@keyframes slideUpFadeIn {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Interactive tooltips for tree nodes */
.tree-node-card {
    cursor: pointer;
    position: relative;
}

.tree-node-card::after {
    content: 'Click để xem thông tin';
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.tree-node-card:hover::after {
    opacity: 1;
}

.more-members-card::after {
    content: 'Click để xem tất cả thành viên' !important;
}

.root-node::after {
    content: 'Người sáng lập hệ thống' !important;
}

/* Improved responsive behavior */
@media (max-width: 576px) {
    .tree-container {
        min-width: 500px;
        padding: 10px 0;
    }
    
    .tree-level-title {
        font-size: 14px;
        padding: 8px 16px;
    }
    
    .tree-node-card::after {
        display: none; /* Hide tooltips on mobile */
    }
    
    .separator-line {
        width: 150px;
    }
}
